Upgrading ownCloud on Ubuntu

I often hear people complain that ownCloud is impossible to upgrade and I have been through that pain myself. However after repeatedly going to such extremes as uninstalling and starting from scratch I have found a series of steps that while simple are not entirely obvious.

Update

I has been pointed out to me on Reddit that the ownCloud project now gives similar instructions here much needed instructions on how to back up all information first.

 

WARNING: This tutorial assumes that your server is running Ubuntu and you have installed ownCloud from the repositories. If you are running another distribution or have installed ownCloud by hand your mileage may vary.

  1. Log into your sever as root
  2. Update the package cache and upgrade all packages installed on the server:
    root@cloud:~# sudo apt-get update
    root@cloud:~# sudo apt-get upgrade
  3. Go into the directory where ownCloud is kept:
    root@cloud:~# cd /var/www/owncloud
  4. Ensure ownCloud is in maintenance mode:
    root@cloud:/var/www/owncloud# sudo -u www-data php occ maintenance:mode –on

    Maintenance mode enabled

  5. Run the upgrade script:
    root@cloud:/var/www/owncloud# sudo -u www-data php occ upgrade
  6. Disable maintenance mode:
    root@cloud:/var/www/owncloud# sudo -u www-data php occ maintenance:mode –off

    Maintenance mode disabled

  7. Finally log into the admin account of your ownCloud installation and re-enable any plugins that you use.

The full session should look something like this:
Upgrading ownCloud

PS

If you want a cheap VPS to run ownCloud on click on the link in the sidebar to get an account with DigitalOcean with two months of free hosting.