How to effortlessly migrate OwnCloud to NextCloud
Both OwnCloud and NextCloud are two popular software used to build a personal cloud: a place where to store Files, Calendars, Contacts and more. Since NextCloud is a fork of OwnCloud, OwnCloud users can switch to NextCloud for the moment (in future builds this may change). Let’s take a look at how to do so using a script provided by NextCloud developers.
The switch procedure using the script is pretty buggy and sometimes it can be unreliable, use it with caution. Also not every version is supported and sometimes you may need to trick the script into thinking the installed version is different. So here’s a few things you should know before you actually start:
- If you installed OwnCloud using a package manager this procedure will be reverted with the next update. It is advised to perform the upgrade manually.
- OwnCloud >10.0.0.0 (and from my experiments even 10.0.0.0) isn’t upgradable (yet), developers are working on it.
- You might have to update PHP/database versions during the procedure, I’ll assume you know the requirements for each version and will act accordingly.
- Latest minor versions of OwnCloud usually have some problems.
- The procedure mainly uses CLI. It is not a simple “click-a-button” process, it is advisable to have some experience before starting.
- Most of the time you will be tricking the script or avoiding its errors.
- If something breaks, you’re basically on your own. Although you can get some help through the official forum.
Migrating OwnCloud to NextCloud
The first thing you need to do in order to upgrade your OwnCloud installation is to get the updater script. I will assume the installation resides in /var/www/html/owncloud for the rest of the procedure, if your installation resides somewhere else be sure to adjust the commands accordingly.
Once you are done, you will need to visit the updater script using your browser. Go to http://YOUR_INSTALLATION/owncloud/updater . If everything goes well, you should be seeing this screen:
Here you might encounter the Could not determine migration path to Nextcloud situation. When you’re ready, click on Start update. Now you might encounter Check for expected files or the Check for write permissions cases.
Past the cluster of errors, the download will start, but you might encounter the Downloaded version is lower than installed version situation, in that case check the Lowering version number solution.
If you cruise past this point, you’re already fairly well and you will be seeing this screen:
At this point the decision depends on your installation size:
- Small: if your installation is small I suggest you to select No and continue with the web interface.
- Large: you should continue the upgrade process through the CLI and select Yes.
Upgrading from the web interface
Following this procedure you will just need to click Start update and after a few seconds you should be seeing the following screen:
The procedure is complete, reload the page and you will be in your new NextCloud installation. Now you might need to Restore correct permissions and might consider Moving the installation folder.
Upgrading from the CLI
The procedure from the CLI is different and it is based on the operating system. You should impersonate the user which owns the OwnCloud files (root on CentOS and www-data on Ubuntu, for other distributions refer to your distribution/web server’s documentation).
If everything went correctly you may now connect to your previous address and enjoy your new NextCloud installation.
Could not determine migration path to Nextcloud
This is the first problem you might encounter, some version can be migrated, some can not. Here’s a compatibility overview directly from the official migration guide:
- ownCloud 9.0.x is compatible with Nextcloud 9.0.x
- ownCloud 9.1.x is compatible with Nextcloud 10.0.x
- ownCloud 10.0.x is compatible with Nextcloud 12.0.x
Although the preceding states OwnCloud 10 can be migrated, that is currently not possible. If you want to give a shot try to Lower version number.
How to lower version number
There are two important files that contain version number, you need to change them both. Be sure to use the same version!
For starters, try lowering to the precedent base version:
- 184.108.40.206 becomes 220.127.116.11
- 9.0.5 becomes 9.0.0
If that doesn’t work try lowering one number altogether:
- 18.104.22.168 becomes 22.214.171.124
- 9.0.5 becomes 9.0.0
Remember that you can’t upgrade OwnCloud 10 yet, developers are working on a fix, do not try to update it yourself using this trick. (I tried, it fails.)
Check for expected files
This issue arise when there are (almost always) files that are not recognized from the script. One common example seems to be the .well-known folder from Let’s Encrypt. In this case you should remove (or better, move) such files out of the installation directory:
Check for write permissions
This problem usually arises when permissions were not set correctly. For the time being you can use the following command:
After the whole procedure is complete, it is advisable to Restore correct permissions.
Downloaded version is lower than installed version
This error is a tricky one, since we’re on OwnCloud 9.1.6 (the only case where I encountered this), the internal version of Nextcloud is lower, we need to Lower version number this one setting it to 9.1.4 . If you encounter this issue with other version 9.1.6 try lowering the value until the process resumes. After you’ve lowered the version number RELOAD the page, do not click on retry or you will get the Can’t handle ZIP file. Error code is: 28 error. If you already clicked retry, just reloading the page will do the trick.
Restore correct permissions
If you had problems with permissions and followed this guide, you will have relaxed your permissions over the installation directory. In order to set them correctly once again do:
Move the installation directory
One last step you might consider is to move the owncloud/ directory to a more appropriate nextcloud/ one. To do so you will need a few things:
- Move the directory.
- Modify a few lines in the config/config.php file.
- Adjust the web server configuration. I can’t guide you in this last one since there are way too many possibilities you could have configured the server, please refer to your web server’s configuration.
Did I miss something?
If I missed some errors you encountered, feel free to write a comment here to let me know!
- 2020 A year in review for Marksei.com - 30 December 2020
- Red Hat pulls the kill switch on CentOS - 16 December 2020
- OpenZFS 2.0 released: unified ZFS for Linux and BSD - 9 December 2020
There is another issue upgrading: the PHP version. Ubuntu 18.04 runs 7.2 wich it doesn’t compatible with Nextcloud 12.0.X. Do you have a piece of advice of how we can deal this annoying issue with?
I found out this, but isn’t quite clear:
Thanks for your help.
the suggested method in the GitHub issue is more of a hack rather than a proper migration: it isn’t tested. What I suggest you to do is to temporarily switch to PHP7.1 using a ppa (you can start with this guide), upgrade to NextCloud 12, then to NextCloud 13. NC13 can run with PHP 7.2, you can now uninstall PHP7.1 and re-enable PHP7.2 . This if you want to follow the “official” migration. As I stated at the beginning, placing a newer version of NC inside the folder and have it run is not tested and may produce unexpected behaviors.
It`s quite cumbersome at the end! Thanks for your time. I’ll try it