Migrate from old to new setup

The server field is moving on fast with new versions. My current NC is 19.0.8 on Ubuntu18.04 and php7.3. nginx and MariaDB are also probably older versions.
I have successfully made a clone of my current setup and tried to make sequential upgrades and reached NC20.3 but I lost some of the apps on the way probably becaause of php7.3.
With lots of trial and errors I have finally succeeded to upgrade php to 7.4. But in the end I guess I will soon need to make a complete reinstall with Ubuntu 20, php8.0 and newer versions on nginx, MariaDB and so forth.

I have a complete new NC22 setup and am looking at a way of moving the data from the current old install. The files are all in Groupfolders so can easily be moved. Users having own files can be asked to make a backup and move them themselves.

I can probably also move the calendars by exporting and reimporting them as CalDav.

Remain to move the users. Can this be done?

I have searched this forum. Found some not very encouraging comments. I guess it is possible to extract the users information and passwords from the database tables and import to the new database.

I think this could work but am tired of doing trial and error. I guess this may be a common problem with a need for a “How-to” instruction.

I would be very thankful if someone with insights could give advices.

1 Like

I think it is not only a username/password problem. There are also problems e.g. with public shares and other data stored in the database.

Normally admins use the standard php- and other software-versions in the ubuntu release e.g. 18.04 LTS or 20.04 LTS and make dist-upgrades. Also you can read and use backup and restore

The best way is to solve the problems actually on the supported version “NC20”.
Maintenance and Release Schedule · nextcloud/server Wiki · GitHub and then change to Nextcloud 21. Sorry i do not know the time you must dist-upgrade from Ubuntu 18.04 LTS to 20.04 LTS. You do not need PHP8.0 https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html

For a new server i think you must also install the old nextcloud version and then use “restore” and then upgrade to a new nextcloud version. Then all data are included.

Thanks.

But it seems I still need to upgrade php to 7.4 to go higher than NC20? I succeded to do that after lots of trial and errors. In the end I do not remember how I did it. I need to redo and take notes before I will do it on the production server. It would help with a detailed manual on how to do that.

“For a new server i think you must also install the old nextcloud version and then use “restore” and then upgrade to a new nextcloud version. Then all data are included.”

I would welcome a detailed manual on that alternative as well. I have a NC22 server installed with the last versions of most elements.
When I did the clone of the current old server I followed these instructions for backing up and restoring a server and that worked finally.

I have thus copies of the data-folder and the server-folder (/Var/www/nextcloud/) and a database-dump. Can I use them to migrate to the upgraded server?

You say I first need to "install the old server version. Is that what I do if I replace the /var/www/nextcloud-folder in the new server with the old one?

And then you say “restore”. How? Is that to replace the data-folder and the sql-dump?

On the new server:

  • perhaps new ubuntu version
  • perhaps new php version
  • configure virtual webserver
  • install MariaDB
  • Restore MariaDB data
  • restore data e.g. /var/www/nextcloud …

And if it works upgrade to new nextcloud version.

As I said - I had a working NC22 on Ubuntu 20, php8.0, latest MariadB and nginx.
I tried by migrating the old /var/www/nextcloud-folder, the /var/nc_data-folder and the databasedump. I could install php7.4 and worked from there, had lots of issues to solve but finally could reach NC21 that way. But it seems there are still bugs so I will just update my production server to 19.0.13 or maybe NC20 for the moment.

by doing this you would downgrade to your old nc version. you are aware of this?

Yes. But I do not find out how to migrate without downgrading. I hoped I could migrate the nc_data folder and the database-dump from the old NC13 to the new NC22 but I got the advice (see answer from devnull above) that this was not possible. Or can you tell me how to do it? At least I think I upgraded the Ubuntu, MariaDB, nginx and php by this aproach.

i did something similar. from 14 to 20. if i remember well.

i do this in the following way:

  • get a vserver (virtualbox, cloud, something similar)

  • use my playbook to get a complete nextcloud installation
    GitHub - ReinerNippes/nextcloud at nextcloud-reloaded

  • you can edit the inventory to get a special nc version (default => latest)

  • edit the inventory to choose mariadb version (postgres => default) and php version.
    (mariadb and version are two different links!)

  • make a backup and restore to this server of your nc instance.

  • follow all update steps in the nextcloud gui.

  • if error free: make a backup and setup a new “production” server and do a backup/restore to this server.

in case you encounter any error you can’t handle post it here.

if you have to update php because your old nc version can’t handle php7.4/8.0 and you can’t do it on the server. just make backup, new server, restore. with the playbook you always get a running nextcloud.

Thanks. Very complete and interesting installation scripts. I understand this as making an installation from scratch, but the problem remains how to migrate all the data and users from the production server? When I move the data and the database I also need to move the /var/www/nexcloud folder which will bring the NC-version present in the production server to the new installation, and you still need to do the sequential upgrade. There is no way of just taking the data and database from a server with a lower NC-version to another server with a higher version?

When I did upgrading I got messages about incompatible apps. I missunderstood them as I needed to upgrade the server, but the messages were about compatibility to the NC-version - not the server itself.

I have finally accepted to keep my versions of Ubuntu, php, nginx, MariaDB and so forth and do the conventional sequential upgrade on the production server. For the moment everything works and it seems I have no issues of outdated elements in that server. When that comes I will probably migrate to a new server with the latest elements installed from scratch but with identical NC-version as the production server.

not to my knowledge. i assume that with each major update changes to the database are made. and these changes are sequential. 13 → 14 → 15 → … so there is to no way from 13 → 20.

so what? normally you disable or delete them in case they abandoned and won’t work with higher versions anymore. or you have to update them manually and/or accept the risk that they are incompatible. but that won’t stop nextcloud from working.

and if you get some error messages migrating e.g. from version 15 → 16. what do you expect updating version 13 → 21?

well. i still don’t understand your problem.

would you mind to share your error messages? maybe the answer is simply: delete that app because it’s outdated.

Sorry I have given wriong version of the current production server in my first post. It is not NC13, but NC 19.0.8. It warns that it is no longer supported. I could of course just upgrade to NC19.0.13 or NC20 and stop there. I thought that if I would give the server an overhaul I could just as well make a complete upgrade of the server and the NC to the latest version, ie NC 22.0.1, Ubuntu 20, php8.0 and so forth. I hoped that would give better performance.

So I made a complete new server installation on a VPS with latest server elements and NC22.0. But then I got into the trouble of migrating the data and the database. I had hoped I could move them to the new server right away but as you confirm you cannot just do that but need to upgrade the NC sequentially. I now understand and will do that. I may upgrade the NC version to NC21 but use the old server without any changes. I have tested this trail in a testserver and it works. So I will do it also on the production server and will of course have a snapshot and backup so I can reverse if I get into trouble.

My confusion was related to for instance Groupfolders which warned it was not compatible with the new version while upgrading. I thought it was related to php3 so I thought I needed to upgrade php. But all these apps turned out to work after each upgrade. In some cases I had to activate a “non-tested app”. There were other apps with similar warnings - I think Mail and Pico. I deactivated and removed some apps I did not use. After I reached the NC-version I aimed for I reinstalled those I needed.

So I do not have any unsolved problems for the moment. The upgraded testserver works normally even at NC20.0.0 and I feel confident that the upgrade of the production server will also go fine. I will do it after august 3rd though.

I will test your scripts on a testserver. It seems very interesting. I am especially interested in installing elastic search.