ociowncloud

Upgrade ownCloud

It is strongly recommended to create a backup before starting the update process. If you have important data, create and try to restore a backup to ensure that everything works properly.

  • Log in to the server console via SSH. Please check our FAQ for instructions on how to connect to your server through SSH.
  • Create a directory to save all the data you need to backup.

    $ mkdir ~/owncloud-backup

  • Backup the bitnami_owncloud database as described on the MySQL page.

  • Copy the conf/, data and htdocs//config directories to your backup directory. You can use the commands below:

    $ sudo cp -rf /opt/bitnami/apps/owncloud/data ~/owncloud-backup $ sudo cp -rf /opt/bitnami/apps/owncloud/conf/ ~/owncloud-backup $ sudo cp /opt/bitnami/apps/owncloud/htdocs/config ~/owncloud-backup

  • Compress the backup directory:

    $ tar cfz owncloud-backup.tar.gz ~/owncloud-backup/
    
  • Download the backup files owncloud-backup.tar.gz and backup.sql using SFTP. Refer to the FAQ for more information on this.

  • Launch a new ownCloud server with the latest version.

  • Upload via SFTP the backup files espocrm-backup.tar.gz and backup.sql to the new server.

  • Log in to the new server console via SSH.

  • Restore the database backup as described on the MySQL page.

  • Edit the backup ~/owncloud-backup/config/config.php file and change the dbpassword parameter using the new one that can be found in the new /opt/bitnami/apps/owncloud/htdocs/config/config.php file. To do so, use an editor to modify it manually or the commands below:

    $ sudo cat /opt/bitnami/apps/owncloud/htdocs/config/config.php | grep -oP “(?<=‘dbpassword’ => )(‘.’)” | xargs -I % sed -e “s/‘dbpassword’ => ‘.’/‘dbpassword’ => ‘%’/g” -i ~/owncloud-backup/config/config.php

  • Restore the backup files in the new Bitnami ownCloud Stack. You can use the commands below:

    $ sudo cp -rf ~/owncloud-backup/data /opt/bitnami/apps/owncloud/data $ sudo cp -rf ~/owncloud-backup/config /opt/bitnami/apps/owncloud/htdocs/

  • Restore the permissions.

    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/data/ $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/config/ $ sudo chmod 664 /opt/bitnami/apps/owncloud/htdocs/config/config.php

  • Restore the Apache configuration files in the new ownCloud stack. Use the command below:

    $ sudo cp -rf ~/owncloud-backup/conf/ /opt/bitnami/apps/owncloud/conf/
    
  • Restart Apache:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    

That’s it! You updated the whole stack!

Upgrade only ownCloud in the Bitnami ownCloud Stack (Admin Panel)

ownCloud already ships an “Updater” tool installed that allows upgrading the ownCloud application from the admin panel directly. For security reasons, ownCloud files do not have write access for the web server user, but this will be required if you want to upgrade the application.

  • Before running the “Updater” app, run the following commands to change the owner of the files in your installation:

    $ sudo chown -R daemon /opt/bitnami/apps/owncloud/htdocs/
    $ sudo chmod 644 /opt/bitnami/apps/owncloud/htdocs/.user.ini
    
  • Run the upgrade process from the admin panel by navigating to “Settings -> General -> Updater -> Open Updater” and running the upgrade process.

  • If the upgrade works well, restore the permissions of your folder.

    $ sudo chown -R bitnami /opt/bitnami/apps/owncloud/htdocs/
    $ sudo chmod 444 /opt/bitnami/apps/owncloud/htdocs/.user.ini
    $ sudo chown -R daemon /opt/bitnami/apps/owncloud/htdocs/config /opt/bitnami/apps/owncloud/htdocs/apps
    

That’s it! You updated the application! You can find more information about the Upgrade process at the ownCloud official documentation.

Upgrade only ownCloud in the Bitnami ownCloud Stack (Manually)

  • Log in to the server console via SSH. Please check our FAQ for instructions on how to connect to your server through SSH.
  • Set the Maintenance Mode:

    $ sudo -u daemon /opt/bitnami/bin/php /opt/bitnami/apps/owncloud/htdocs/occ maintenance:mode --on
    $ sudo /opt/bitnami/ctlscript.sh stop apache
    
  • Backup the bitnami_owncloud database as described on the MySQL page.

  • Download and uncompress the latest version of ownCloud from ownCloud Official Website. For example (for version 10.0.2), use the commands below:

    $ wget https://download.owncloud.org/community/owncloud-10.0.2.tar.bz2
    $ tar xjf owncloud-10.0.2.tar.bz2
    
  • Backup the current installation and substitute it with the new one:

    $ sudo mv /opt/bitnami/apps/owncloud/htdocs/ /opt/bitnami/apps/owncloud/htdocs-backup
    $ sudo mv owncloud /opt/bitnami/apps/owncloud/htdocs/
    $ sudo mv /opt/bitnami/apps/owncloud/htdocs-backup/config/config.php /opt/bitnami/apps/owncloud/htdocs/config/
    
  • Restore the permissions:

    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/
    
  • Run the upgrade command (this could take a few minutes) and unset the Maintenance mode:

    $ sudo -u daemon /opt/bitnami/php/bin/php /opt/bitnami/apps/owncloud/htdocs/occ upgrade
    $ sudo -u daemon /opt/bitnami/php/bin/php /opt/bitnami/apps/owncloud/htdocs/occ occ maintenance:mode --off
    
  • Restore the strong permissions configuration:

    $ sudo find /opt/bitnami/apps/owncloud/htdocs/ -type d -exec chmod 0750 {} \;
    $ sudo find /opt/bitnami/apps/owncloud/htdocs/ -type f -exec chmod 0640 {} \;
    $ sudo chown -R bitnami:daemon /opt/bitnami/apps/owncloud/htdocs/
    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/apps
    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/assets
    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/config
    $ sudo chown -R daemon:daemon /opt/bitnami/apps/owncloud/htdocs/themes
    
  • Restart Apache:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    

That’s it! You updated the application! You can find more information about the Upgrade process at the ownCloud official documentation.

Troubleshooting I: Upgrade ownCloud and all stack components from 4.0.x to 4.5.x

  • Follow the same steps described at Upgrade ownCloud and all stack components section.
  • After restoring the database. Access the new phpMyAdmin installation and log in. Please check our FAQ for instructions on how to connect to phpMyAdmin.
  • Select the bitnami_owncloud database and execute the following SQL commands to create the tables that they are not present in the previous version:

    CREATE TABLE IF NOT EXISTS `oc_queuedtasks` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `app` varchar(255) NOT NULL DEFAULT '',
    `klass` varchar(255) NOT NULL DEFAULT '',
    `method` varchar(255) NOT NULL DEFAULT '',
    `parameters` varchar(255) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    
    CREATE TABLE IF NOT EXISTS `oc_group_admin` (
    `gid` varchar(64) NOT NULL DEFAULT '',
    `uid` varchar(64) NOT NULL DEFAULT ''
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    
    CREATE TABLE IF NOT EXISTS `oc_share` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `share_type` tinyint(4) NOT NULL DEFAULT '0',
    `share_with` varchar(255) DEFAULT NULL,
    `uid_owner` varchar(255) NOT NULL DEFAULT '',
    `parent` int(11) DEFAULT NULL,
    `item_type` varchar(64) NOT NULL DEFAULT '',
    `item_source` varchar(255) DEFAULT NULL,
    `item_target` varchar(255) DEFAULT NULL,
    `file_source` int(11) DEFAULT NULL,
    `file_target` varchar(512) DEFAULT NULL,
    `permissions` tinyint(4) NOT NULL DEFAULT '0',
    `stime` bigint(20) NOT NULL DEFAULT '0',
    `accepted` tinyint(4) NOT NULL DEFAULT '0',
    `expiration` timestamp DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    
  • Follow the rest of the steps.

Troubleshooting II: Upgrade ownCloud and all stack components from 6.0.x to 7.0.x

Last modification September 7, 2018