Skip to content

Own cloud backup & update the Bitnami ownCloud EC2 and google cloud

Own cloud backup & update the Bitnami ownCloud EC2 and google cloud

How To Create A Full Backup Of OwnCloud?

Backup

The Bitnami ownCloud Stack is self-contained and the simplest option for performing a backup is to copy or compress the Bitnami stack installation directory. To do so in a safe manner, you will need to stop all servers, so this method may not be appropriate if you have people accessing the application continuously.

Follow these steps:

  • Change to the directory in which you wish to save your backup:
    cd /your/directory
    
  • Stop all servers:
    sudo /opt/bitnami/ctlscript.sh stop
    
  • Create a compressed file with the stack contents:
    sudo tar -pczvf application-backup.tar.gz /opt/bitnami
    
  • Restart all servers:
    sudo /opt/bitnami/ctlscript.sh start
    

You should now download or transfer the application-backup.tar.gz file to a safe location.

Restore

Follow these steps:

  • Change to the directory containing your backup:
    cd /your/directory
    
  • Stop all servers:
    sudo /opt/bitnami/ctlscript.sh stop
    
  • Move the current stack to a different location:
    sudo mv /opt/bitnami /tmp/bitnami-backup
    
  • Uncompress the backup file to the original directoryv
    sudo tar -pxzvf application-backup.tar.gz -C /
    
  • Start all servers:
    sudo /opt/bitnami/ctlscript.sh start
    

If you want to create only a database backup, refer to these instructions for MySQL and PostgreSQL.

How To Upgrade The Bitnami OwnCloud Stack?

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

Comments are closed, but trackbacks and pingbacks are open.