CentOS 7.x Upgrade owncloud to newer version or updated stack

From Notes_Wiki
Revision as of 12:09, 17 March 2019 by Saurabh (talk | contribs)

<yambe:breadcrumb>CentOS_7.x_owncloud|Owncloud</yambe:breadcrumb>

CentOS 7.x Upgrade owncloud to newer version or updated stack

CentOS 7.x upgrade owncloud to newer version or updated stack using following steps:

The steps were built while upgrading source based installation of owncloud 9.1 and migrating to bitnami stack based installation of 10.1. For other versions use steps judiciously.

  1. Take database dump of older owncloud
  2. Restore database dump to newer owncloud using database crendentials of new server. For this no need to start apache/owncloud interface. Only start mysqld database on new server.
    For example in case of bitnami do "./ctlscript.sh start mysql"
    For this use steps similar to:
    1. Run "/opt/owncloud-10.1.0-1/mysql/bin/mysql -u bn_owncloud -p" on bash to get mysql prompt for running further commands
    2. drop database bitnami_owncloud;
    3. create database bitnami_owncloud;
    4. use bitnami_owncloud;
    5. source <path-to-sql-dump-from-old-server>;
    6. exit
  3. Ensure data folder from older owncloud is copied/moved to newer owncloud and permissions are updated
    Example steps:
    cd /opt/owncloud-10.1.0-1/apps/owncloud
    mv data data2
    mv /var/www/html/owncloud/data data
    chown -R daemon:daemon data
    ls -l #validate 770 permission on new data folder
    • Other option is to leave files at same place and modify 'datadirectory' parameter in '/opt/owncloud-<version>/apps/owncloud/htdocs/config/config.php file. But even after this setting daemon:daemon ownership is important.
  4. cd owncloud htdocs folder
    Eg /opt/owncloud-10.1.0-1/apps/owncloud/htdocs
  5. Then try to upgrade owncloud
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ maintenance:mode --on
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ upgrade
    This might show error such as
    ownCloud or one of the apps require upgrade - only a limited number of commands are available
    You may use your browser or the occ upgrade command to do the upgrade
    2019-03-13T09:01:56+00:00 Set log level to debug
    2019-03-13T09:01:56+00:00 Repair step: Upgrade app code from the marketplace
    2019-03-13T09:01:56+00:00 Repair warning: You have incompatible or missing apps enabled that could not be found or updated via the marketplace.
    2019-03-13T09:01:56+00:00 Repair warning: Please install or update the following apps manually or disable them with:
    occ app:disable activity
    occ app:disable files_pdfviewer
    occ app:disable files_texteditor
    occ app:disable gallery
    occ app:disable templateeditor
    2019-03-13T09:01:56+00:00 Repair warning: For manually updating, see https://doc.owncloud.org/server/10.1/go.php?to=admin-marketplace-apps
    2019-03-13T09:01:56+00:00 OC\RepairException: Upgrade is not possible
    2019-03-13T09:01:56+00:00 Update failed
    2019-03-13T09:01:56+00:00 Maintenance mode is kept active
    2019-03-13T09:01:56+00:00 Reset log level
    In lab tests we have observed error for 'files_antivirus' is not shown during upgrade from 9.1 to 10.0. Also it makes sense to download apps such as onlyoffice and user_ldap at this stage if they were in use in previous setup before continuing with 'occ upgrade' so that these apps also get upgrades properly.
  6. Based on this disable apps using
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ app:disable activity
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ app:disable files_pdfviewer
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ app:disable files_texteditor
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ app:disable gallery
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ app:disable templateeditor
  7. Then again try update using:
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ upgrade
    which might show error such as
    ownCloud or one of the apps require upgrade - only a limited number of commands are available
    You may use your browser or the occ upgrade command to do the upgrade
    2019-03-13T09:07:29+00:00 Set log level to debug
    2019-03-13T09:07:29+00:00 Repair step: Upgrade app code from the marketplace
    2019-03-13T09:07:29+00:00 Repair step: Repair MySQL database engine
    2019-03-13T09:07:29+00:00 Repair step: Repair MySQL collation
    2019-03-13T09:07:29+00:00 Repair info: Change collation for oc_activity ...
    2019-03-13T09:07:29+00:00 Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER TABLE `oc_activity` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;':
    SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
    2019-03-13T09:07:29+00:00 Update failed
    2019-03-13T09:07:29+00:00 Maintenance mode is kept active
    2019-03-13T09:07:29+00:00 Reset log level
    This error is common while upgrading from 9.1 to 10.0. Hence while upgrading from 9.1 to 10.0 to avoid this error in first place edit '/opt/owncloud-10.1.0-1/apps/owncloud/htdocs/config/config.php' and update to ''mysql.utf8mb4' => false,'
  8. To fix MySQL issues on upgrade use
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ config:system:set mysql.utf8mb4 --type boolean --value="false"
    then upgrade using
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ upgrade
    and then disable maintenance mode using:
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ maintenance:mode --off
  9. If user_ldap app was used in 9.1 and then upgraded to 10.0 then note that LDAP users do not automatically show up until sync is run. For this use steps:
    1. Run manual sync using:
      cd /opt/owncloud-10.1.0-1/apps/owncloud/htdocs
      sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php occ user:sync "OCA\User_LDAP\User_Proxy"
      Example IO for this is
      If unknown users are found, what do you want to do with their accounts? (removing the account will also remove its data)
      [0] disable
      [1] remove
      [2] ask later
      > 2
      Analysing known accounts ...
      3 [============================]
      No removed users have been detected.
      Inserting new and updating all known users from OCA\User_LDAP\User_Proxy ...
      169 [============================]
      Based on below references:
  10. Optionally create /etc/cron.daily/owncloud-maintenance.sh with
    #!/bin/bash
    cd /opt/owncloud-10.1.0-1/apps/owncloud/htdocs
    sudo -u daemon /opt/owncloud-10.1.0-1/php/bin/php -f cron.php
  11. Set execute permissions on cron file and test it:
    chmod +x /etc/cron.daily/owncloud-maintenance.sh
    /etc/cron.daily/owncloud-maintenance.sh
  12. At this point apache/owncloud frontend can be started.
    Example command ./ctlscript.sh start apache


Refer:



<yambe:breadcrumb>CentOS_7.x_owncloud|Owncloud</yambe:breadcrumb>