How to effortlessly migrate OwnCloud to NextCloud

Nextcloud Logo White

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.

Preliminary Notes

I take absolutely NO responsibility of what you do with your machine; use this tutorial as a guide and remember you can possibly cause data loss if you touch things carelessly.

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 > (and from my experiments even 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.


For the rest of the guide, we will operate from the installation root directory.

# cd /var/www/html/owncloud
# curl -o updater/index.php

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:

OwnCloud NextCloud Migration available

OwnCloud NextCloud Migration available

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:

OwnCloud NextCloud Update ready

OwnCloud NextCloud Update ready

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

OwnCloud NextCloud Start update

OwnCloud NextCloud Start update

Following this procedure you will just need to click Start update and after a few seconds you should be seeing the following screen:

OwnCloud NextCloud Update successful

OwnCloud NextCloud Update successful

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

OwnCloud NextCloud Maintenance mode

OwnCloud NextCloud Maintenance mode

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).

sudo -u www-data php occ upgrade
sudo -u www-data php occ maintenance:mode --off
sudo -u apache php occ upgrade
sudo -u apache php occ maintenance:mode --off

Sometimes you may find that root is the owner of the files, in that case replace apache with root.

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

OwnCloud NextCloud Could not determine migration path to Nextcloud

OwnCloud NextCloud 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!


This file resides in your installation directory under the config directory, you will need to find (and change) the following line:

'version' => '',

Change it accordingly to your needs, for example you might fake version 9.1.5 by changing it to:

'version' => '',

This file resides in your installation directory, you will need to find (and change) the following lines:

$OC_Version = array(9,1,6,2);
$OC_VersionString = '9.1.6';

For example, if we wanted to fake version 9.1.5 we would change theml like this:

$OC_Version = array(9,1,5,0);
$OC_VersionString = '9.1.5';

For starters, try lowering to the precedent base version:

  • becomes
  • 9.0.5 becomes 9.0.0

If that doesn’t work try lowering one number altogether:

  • becomes
  • 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

OwnCloud NextCloud Check for (un)expected files

OwnCloud NextCloud Check for (un)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:

Move file(s)

In my example the etc directory isn’t recognized, be sure to repeat this process for each file/folder:

mv FILE /home/

This command will move the file(s) to the home directory, once the procedure is complete you might move them to their original location, although that’s not strictly needed.

Check for write permissions

OwnCloud NextCloud Check for write permissions

OwnCloud NextCloud Check for write permissions

This problem usually arises when permissions were not set correctly. For the time being you can use the following command:

# chmod 770 -R /var/www/html/owncloud

This command will relax permissions on the whole folder.

After the whole procedure is complete, it is advisable to Restore correct permissions.

Downloaded version is lower than installed version

OwnCloud NextCloud Downloaded version is lower than installed version

OwnCloud NextCloud 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:

# find /var/www/html/owncloud/ -type d -exec chmod 750 {} \;
# find /var/www/html/owncloud/ -type f -exec chmod 640 {} \;

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.
Move the folderModify config.php
# cd /var/www/html
# mv owncloud nextcloud

This command will simply move the directory, but you also need to change the config.php file.

This file resides in your installation directory under the config directory, you will need to find (and change) the following lines:

'datadirectory' => '/var/www/html/nextcloud/data',
'overwrite.cli.url' => 'http://YOUR_INSTALLATION/nextcloud',

Change these line accordingly to your new installation directory path, notice the “data” part in the first line.

Did I miss something?

If I missed some errors you encountered, feel free to write a comment here to let me know!

Images courtesy of mark | marksei and

You may also like...

3 Responses

  1. k0man says:

    Hi Mark,

    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.

    • mark says:

      Hello k0man,
      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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: