Upgrade Owncloud through several major versions - while using your repository
This was quite a bummer to me… I suppose I've grown to just say yum update sometimes and everything just works.
Owncloud has been very active in increasing their major version numbers when considering the time and visible changes. In fact so active that one may smell a bit of enterprise version merchandising between the lines.. or major versions. Upgrading owncloud even from repository requires constant manual labor and is not what I really appreciate.
I had Owncloud 8.0.10 in CentOS 7 box and it was a bit forgotten and by the time I said yum update it gave me Owncloud 9.0.4. And since there seems to be no history available with EPEL repository it was a manual labor ahead. Here is shortest possible documentation on how to do it.
Download the major release versions
Find out what was the release you had when it was working
grep owncloud /var/log/yum,log*
Get the latest versions from Owncloud changelog. I had to take 8.0.14, 8.1.9 and 8.2.7.
Backup your current owncloud folder
Backup current Owncloud folder but do not backup data as there may be quite a lot of it and the upgrade process does not touch your data at all. I had a good situation since my folder was in another tree, in fact it is in a network storage server so I did not have to take it into account at all. It was just there along the ride.
systemctl stop httpd cd /usr/share mv owncloud owncloud.org
Upgrade to latest 8.0.14
This procedure is the same with every upgrade so learn this just once.
Untar the package
cd /usr/share tar -xjf /path/to/owncloud.8.0.14.tar.bz2
Copy config, set ownership and SELinux contexts right
These must be done in order for Owncloud to work. In CentOS config directory is a symbolic link to /etc/owncloud but you can just copy them over there and recreate the symbolic ling after all is fully restored.
cp -a owncloud.org/confif/config.php owncloud/config/ chown -R apache.apache owncloud/config chcon -R --reference owncloud.org owncloud chcon --reference owncloud.org/config/config.php owncloud/config/config.php #move data directory there too if yours is under the tree
Upgrade the config and database
systemctl start httpd cd owncloud sudo -u apache php occ upgrade
Upgrade from 8.0 -> 8.1
It is an identical procedure with the addition of encryption upgrade if you are using one.
Copy config, set ownership and SELinux contexts right
These must be done in order for Owncloud to work. In CentOS config directory is a symbolic link to /etc/owncloud but you can just copy them over there and recreate the symbolic ling after all is fully restored.
systemctl stop httpd cd /usr/share mv owncloud owncloud.8.0.14 tar -xjf /path/to/owncloud.8.1.9.tar.bz2 cp -a owncloud.8.0.14/config/config.php owncloud/config/ chown -R apache.apache owncloud/config chcon -R --reference owncloud.org owncloud chcon --reference owncloud.org/config/config.php owncloud/config/config.php #move data directory there too if yours is under the tree
Upgrade the config and database
systemctl start httpd cd owncloud sudo -u apache php occ upgrade
Upgrade encryption [only on 8.0 -> 8.1]
Upgrade this if you are using encryption and you are upgrading from 8.0!
sudo -u apache php occ encryption:migrate
Other upgrades
The procedure is the same as above but in the future releases there may come some tricks so watch out.
Final upgrade with repository
Now we have 8.2.7 in /usr/share/owncloud and it is time to upgrade it with the repository version.
cd /usr/share cp -a owncloud owncloud.8.2.7 yum reinstall owncloud cd owncloud sudo -u apache php occ upgrade
Now we're back in business and we remember to say yum update more frequently… and sadly too we must be ready to do the occ upgrade every time the major release is increased.