awsowncloud

Upgrade ownCloud

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

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.

Approach A: Bitnami installations using system packages

  • Log in to the server console via SSH. Please check our FAQ for instructions on how to connect to your server through SSH.
  • Backup the bitnami_owncloud database as described on the MySQL page.
  • Compress and backup the current installation data in /bitnami/owncloud:

    $ sudo tar czf ~/owncloud-backup.tar.gz /bitnami/owncloud
    
  • 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 Bitnami ownCloud Stack with the latest version.

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

  • Log in to the new server console via SSH.

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

  • Locate and store the original database password for the new installation (from now on it will be referred to as DBPASSWORD):

    $ sudo cat /opt/bitnami/owncloud/config/config.php | grep -oP "(?<='dbpassword' => ')([^']*)"
    
  • Restore the owncloud-backup.tar.gz backup files in the new Bitnami ownCloud Stack. You can use the commands below:

    $ sudo rm -rf /bitnami/owncloud/*
    $ sudo tar xzf ~/owncloud-backup.tar.gz -C /
    
  • Edit the backup /opt/bitnami/owncloud/config/config.php file and change the dbpassword parameter to use the value of the new database password DBPASSWORD, which was obtained previously:

    $ sudo sed -E -i "s/('dbpassword' =>) '[^']*'/\\1 'DBPASSWORD'/" /opt/bitnami/owncloud/config/config.php
    

That’s it! You updated the whole stack!

Upgrade only ownCloud using the built-in update tool

ownCloud already ships an “Updater” tool installed that allows upgrading the ownCloud application from the admin panel directly. For security reasons, some 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 ownership of the required files in your installation:

    $ sudo chmod 660 /opt/bitnami/owncloud/.user.ini /opt/bitnami/owncloud/.htaccess
    
  • Run the upgrade process from the admin panel by navigating to “Settings -> General -> Updater -> Open Updater” and running the upgrade process.

  • If the upgrade worked well, restore the permissions:

    $ sudo chmod 440 /opt/bitnami/owncloud/.user.ini /opt/bitnami/owncloud/.htaccess
    

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

Upgrade only ownCloud manually

For security reasons, some 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 upgrade process, run the following commands to change the ownership of some required files in your installation:

    $ sudo chmod 660 /opt/bitnami/owncloud/.user.ini /opt/bitnami/owncloud/.htaccess
    
  • Enable 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
    
  • Compress and backup the current installation data in /bitnami/owncloud:

    $ sudo tar czf ~/owncloud-backup.tar.gz /bitnami/owncloud
    
  • Run the upgrade command (this could take a few minutes) and disable maintenance mode:

    $ sudo -u daemon /opt/bitnami/php/bin/php /opt/bitnami/owncloud/occ upgrade
    $ sudo -u daemon /opt/bitnami/php/bin/php /opt/bitnami/owncloud/occ occ maintenance:mode --off
    
  • If the upgrade worked well, restore the permissions:

    $ sudo chmod 440 /opt/bitnami/owncloud/.user.ini /opt/bitnami/owncloud/.htaccess
    

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

Approach B: Self-contained Bitnami installations

  • 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 czf 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 Bitnami ownCloud Stack with the latest version.

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

  • Log in to the new server console via SSH.

  • Restore the backup.sql 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 using the built-in update tool

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 ownership of the required 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 worked well, restore the permissions:

    $ 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 in the official ownCloud documentation.

Upgrade only ownCloud manually

  • Enable 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 disable 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 in the official ownCloud documentation.

Last modification January 19, 2021