Upgrading ownCloud on Debian Stable to official packages


Last March, Debian maintainers decided to drop the ownCloud Server package. Sadly, due to the nature of the Debian packages, upgrading to the ownCloud-provided packages is not easily doable so users risk getting stuck. This blog will tell you how to upgrade to normal ownCloud packages.

Background

ownCloud 7 is no longer supported by the ownCloud community, and in general running an up to date ownCloud release brings significant benefits in terms of features and performance but also stability. Upgrading is thus highly recommended. However, that upgrade will take some work.

When upgrading ownCloud you can not skip any releases – ownCloud does not support this. While it would not be impossible to devise a way to move in one go from 7 to 9, it would be a very significant effort and unlikely to happen. The best solution, right now, is thus to move from ownCloud 7.0.x on Debian to ownCloud 7.0.14 from our packages and then onwards. The process will thus go like this:

  • Upgrade from 7.0.3-debian to 7.0.14
  • Upgrade from 7.0.14 to 8.0.12
  • upgrade from 8.0.12 to 8.1.7
  • upgrade from 8.1.7 to 8.2.4
  • and possibly to 9.0.2

Special Debian changes

The Debian maintainers have made some specific changes to ownCloud, moving files from their default positions and adjusting code to deal with that. This will pose a problem for the upgrade so we’ll have to do some manual steps to make things work.

The process

We’re going to start with upgrading the ownCloud 7 Debian packages to ownCloud 7 from our packages. This will be the hardest part as they are quite different. Follow these steps:

  • Make a backup of the database and, if possible, the data folder. See our documentation.
  • Backup the config file. The config.php file is in /etc/owncloud. You can opt to also preserve also /etc/owncloud/htaccess if you made changes but you’ll have to merge it with the htaccess from the final ownCloud version you will end up with. It is probably better and easier to re-do the changes separately.
  • Put ownCloud in maintenance mode: sudo -u www-data php /usr/share/owncloud/occ maintenance:mode --on or by editing /etc/owncloud/config.php. Change "maintenance" => false to "maintenance" => true
  • Uninstall the current ownCloud packages: apt-get remove owncloud
  • install the latest upstream ownCloud 7.0.14 packages and put the config files in the right spot:
    • Visit this page and execute the commands for Debian. If you are OK with standard Apache and PHP, pick the normal owncloud package. If you have a special setup, for example with NGNIX and PHP7, install owncloud-files. That package just installs the ownCloud files and is more flexible but requires you to handle dependencies yourself.
    • Copy /etc/owncloud/config.php to /var/www/owncloud/config
    • Edit the config file and remove the line apps_path which refers to /usr/share/owncloud/apps – ownCloud will just store apps under /var/www/owncloud/apps.
    • Adjust the user rights: chown -R www-data:www-data /var/www/owncloud/config
  • Run the updater via the command line: sudo -u www-data php /var/www/owncloud/occ upgrade
  • After the upgrade you can disable maintenance mode: sudo -u www-data php /var/www/owncloud/occ maintenance:mode --off

Note that the Debian packages have set your data directory to /var/lib/owncloud/data. In newer ownCloud releases moving the data directory is possible but it is risky if your ownCloud install was upgraded from before ownCloud 8.1. We thus recommend to keep it where it is.

Apps

If you have apps enabled outside of those part of the default ownCloud install, you’ll have to re-install them and then upgrade them on each upgrade step. Don’t forget this as ownCloud apps don’t support skipping upgrades either!

  • Enable the app store. Remove this from the config.php file or turn it in ‘true’: 'appstoreenabled' => false,
  • Go into the app store in the ownCloud web UI ownCloud and install/upgrade the apps you had. You usually have to refresh the page with F5 after each app, and ownCloud will then run the upgrade routines.

With regards to the calendar and contacts app, it is wise to export the calendar and contacts at the beginning of the process. A weird or broken calendar or contact entry could break the upgrade process somewhere and result in data loss. Having an export allows you to re-import at the end of the upgrades.

On to newer releases

Once you have upgraded to the official ownCloud packages, you’re ready to move to a newer ownCloud release: 8.0, 8.1, 8.2 and 9 are waiting for you! It is wise to upgrade to ownCloud 8.2 at the least as this release will bring you a much nicer ownCloud experience. See some reasons why you should upgrade here. Just remember you can’t skip any releases.

The upgrade can be done through the ‘usual’, documented process. It will take time but it should work now you’re on supported packages. For each release, you first remove the existing debian package repository and add the new one (or edit the existing entry). Then follow the steps in the manual. We strongly recommend to use the command line upgrade method, not the web UI! Some steps can take a long time and might cause a time-out resulting in a broken installation.

Enjoy your freshly updated ownCloud!

Thanks to the following people for their feedback and help developing this upgrade how-to:

6 Responses to “Upgrading ownCloud on Debian Stable to official packages”

  1. Gclub casino

    Kingston’s student musicians have been left distraught after the town’s last music shop went into receivership.

  2. Karellen

    Why is the update so tricky? Why can’t you just backup your data (and config), uninstall the old version, install the newest version (and apps), set whatever config changes you need, and then restore your data?

    • Chris

      Exactly this is described very thoroughly in the “Background” and “Special Debian changes” parts of this blogpost.

      • Karellen

        Really? Where?

        “When upgrading ownCloud you can not skip any releases – ownCloud does not support this.”

        That’s not a proper answer to “why?”, it’s a “just because”.

        “The Debian maintainers have made some specific changes to ownCloud, moving files from their default positions and adjusting code to deal with that.”

        Yeah, that’s why you can’t just copy your config; like I said, you have to set whatever config *changes* you need, from the default(s). That is, if you made any. (How many people would have needed to make any? Maybe authorisation using e.g. LDAP? What else?)

        I understand you’re saying that upgrading in-place won’t work. For unspecified reasons. But a backup, uninstall, reinstall, and restore should just get all your data back correctly – shouldn’t it? I see you said “no”, but I still don’t understand “why”. Even after re-reading the “background” and “special debian changes” sections above.

        • Chris

          See:

          “When upgrading ownCloud you can not skip any releases – ownCloud does not support this. While it would not be impossible to devise a way to move in one go from 7 to 9, it would be a very significant effort and unlikely to happen.”

          Its currently not possible because no one has implemented it. Easy answer

  3. Mike

    I just tried to follow this procedure, but the Suse deb packages want to uninstall MariaDB and replace with MySQL. I don’t want to do that. What is the workaround for this, if any?

Comments are closed.