Hello there, welcome to our guide on how to upgrade ownCloud 9 to ownCloud 10 on Ubuntu 16.04 . ownCloud 10 also ownCloud X is the lastest version.
So you could be still running ownCloud server version 9 and whenever you want to synchronize your files with your upto-date ownCloud desktop client you get some version mismatch issues? Worry not because in this guide, we will show you on how to upgrade to the latest version of ownCloud so that you can continue enjoying the beauty of sharing you files and data over this amazing platform.
The interface for ownCloud 9 looks like as shown below;
Upgrade ownCloud 9 to ownCloud 10
Pre-requisites
Well, before you can begin the upgrade process, ensure that you meet the following minimums;
- The upgrade process involves putting the server in maintenance mood. Hence notify users on the same.
- Make a backup of your ownCloud server
data directory
,config.php
,3rd party apps
andownCloud database
. - If any third party application is installed, review them for compatibility and disable them before upgrade. You can re-enable them after upgrade in case they are compatible.
Update the server
Update and upgrade your server to ensure that other ownCloud mandatory requirements are updated.
apt update && apt upgrade -y
There are three ways in which ownCloud server can be upgraded;
- Manually upgrade method using the latest release ownCloud source code. This is the recommended method.
- Using OS specific distribution package manager in conjunction with official ownCloud repositories.
- Using Updater App in the case where admins have no command line access to the server.
In this guide, we are going to learn how to upgrade ownCloud using, of course, the recommended method, manual upgrade.
Manual ownCloud Upgrade
As mentioned above, make the necessary backups as shown below;
Backup ownCloud server directory;
rsync -avpP /var/www/owncloud /opt/backups/
This ensures that a copy is made with permissions preserved.
Backup the ownCloud database;
mysqldump -u root -p owncloud > /home/amos/owncloud-`date +%F`.sql
Now, if you check you home folder;
ls -l /home/amos/
total 68
drwxr-xr-x 17 amos amos 4096 Nov 30 17:09 owncloud
-rw-r--r-- 1 amos amos 63216 Dec 1 11:19 owncloud-2018-12-01.sql
NOTE: You can as well take a snapshot of the current state of your server so that you can always restore to it in case things go south. Nothing outdo a snap of the finger restore!!
Enable ownCloud Maintenance Mode
Before you can proceed, put ownCloud on maintenance mode. This prevents new logins and locks the sessions of the logged in users. ownCloud will also display the status on the web UI to let users know what is happening.
To enable maintenance mode, you can edit the /var/www/owncloud/config/config.php
and change the value of 'maintenance' =>
false,
to 'maintenance' => true,
. This can also be simply done by the use of occ command
as shown below;
sudo -u www-data php /var/www/owncloud/occ maintenance:mode --on
Now, if you try to access ownCloud, you will see a status informing you of the state.
Stop Cron Jobs
systemctl stop cron
Stop the Web Server
systemctl stop apache2
Download the Latest ownCloud Server Release
Navigate to ownCloud download page and obtain the latest release source archive. Once you obtain the source archive link, you can simply download it as follows;
wget https://download.owncloud.org/community/owncloud-10.0.10.tar.bz2 -P /tmp/
Prepare ownCloud for Upgrade
Once the download is done, rename the original ownCloud folder an extract the new source archive to ownCloud web root directory, /var/www/
.
mv /var/www/owncloud /var/www/owncloud-bak
tar xjf /tmp/owncloud-10.0.10.tar.bz2 -C /var/www/
Copy the old ownCloud data directory to the new source directory.
rsync -avpP /var/www/owncloud-bak/data /var/www/owncloud/
Replace the new config.php file with the old one;
rsync -avpP /var/www/owncloud-bak/config /var/www/owncloud/
Upgrade ownCloud
Once you have your old data in place, run the command below to upgrade ownCloud.
sudo -u www-data php /var/www/owncloud/occ upgrade
Once the upgrade is done, you can verify the version of ownCloud by running the command below;
sudo -u www-data php /var/www/owncloud/occ -V
ownCloud is in maintenance mode - no app have been loaded
ownCloud 10.0.10
If you had any old Apps, you can now copy them to the new Apps directory.
Upgrade PHP to PHP 7.2
ownCloud recommends the use of PHP 7.2 in new installations. Note that there are no official PHP 7.2 repositories on Ubuntu 16.04. Thanks to Ondřej Surý’s PHP PPA repositories. Therefore, add the PPA respos and make the necessary updates.
add-apt-repository ppa:ondrej/php
apt update
You can optionally remove PHP 7.0 and install php7.2
apt remove php7.0*
apt autoremove
apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-curl php7.2-gd php7.2-intl\
php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-xml php7.2-zip php7.2-bz2
Verify the version.
php -v
PHP 7.2.12-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:55:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.12-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
Disable Maintenance Mode
If the upgrade is successful, disable maintenance mode by running the command below;
sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off
Restart the Webserver
Start your cron job service and the web server
systemctl restart cron
systemctl restart apache2
You can now login to your new ownCloud server. You should be welcomed by a new ownCloud X web interface.
You have successfully upgraded ownCloud 9 to ownCloud X on Ubuntu 16.04. You can now login and verify that every other previous setting is fine. Thank you for reading.
Other similar tutorials
Install ownCloud Desktop Client on CentOS 8
dude, you literally saved me with this guide, thank you very very much it worked like a charm.
I tried to do the config file migrating my values to the new config of owncloud X but doing it your way works amazing I was pulling my hair off.
Thanks!!!
Glad this helped you Charlie.
When I tried to upgrade the ownCloud with the command below
sudo -u www-data php /var/www/owncloud/occ upgrade
and failed with
Could not open input file: /var/www/html/owncloud/occ
just wondering how to fix it.
Hello there.
Ensure that your ownCloud installation folder, /var/www/owncloud, is the correct one.
i tried update owncloud 9.1.8 to owncloud 10.0.10 but i have problem when “sudo -u www-data php /var/www/html/owncloud/occ upgrade”
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
Cannot create “data” directory
This can usually be fixed by giving the webserver write access to the root directory.
An unhandled exception has been thrown:
exception ‘Exception’ with message ‘Environment not properly prepared.’ in /var/www/html/owncloud/lib/private/Console/Application.php:135
Stack trace:
#0 /var/www/html/owncloud/console.php(105): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/html/owncloud/occ(11): require_once(‘/var/www/html/o…’)
can you help me troubleshoot error this when occ upgrade? thanks