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:
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:
- 18.104.22.168 becomes 22.214.171.124
- 9.0.5 becomes 9.0.0
If that doesn’t work try lowering one number altogether:
- 126.96.36.199 becomes 188.8.131.52
- 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!
Latest posts by mark (see all)
- Developing on Kubernetes: my workflow for taming K8S on Windows - 25 March 2020
- Fedora 32 new features: a bunch of updates - 18 March 2020
- Ubuntu 20.04 LTS new features: Focal Fossa with GNOME 3.36 - 11 March 2020