Transfer Nextcloud-Data from old Server v20.0.14 to new Server Nextcloud v29

Hello,
I was a bit lazy with my server and did not do any updates, thus I am at Nextcloud v20.0.14 on Ubuntu 18.04 now. Now have to refresh my server, when installing Ubuntu 22.04 LTS. I want to install the latest Nextcloud here (v29).

I have some data like calendars, task lists, users, … on the nextcloud server, that I would like to backup and restore on the new server. Can you give me any advise, if and how I can manage that best? The Backup-App starts only from php7.3, but now I have 7.2. When trying to update php I get even other errors. I guess it does not make sense to update through all the way to the latest nextcloud, as this would also be very time-consuming. So, I would prefer to make a backup from the data of the old nextcloud (v20) and take it somehow to the new nextcloud server (v29).

  1. Is it possible without doing many updates on the old server?
  2. Which directories do I need to backup and restore?
  3. is there any app making it easier?

Best regards
Stefan

Maybe this app helps: User migration - Apps - App Store - Nextcloud

It’s all a bit complicated. All shares, users, contacts, decks, etc. are stored in the database. However, the files are stored in a directory structure.

a.) Update across all versions
You can update across all versions, i.e. Nextcloud 20, 21, 22, 23, 24, 25, 26, 27, 28 and 29. If this works, everything will continue to work. This takes a long time and often does not work. In the meantime, you have to change the ubuntu-version and/or PHP version. Bear in mind that you haven’t looked after yourself for 4 years and now you have to invest this time.

Requirements Nextcloud 20
till
Requirements Nextcloud 29

b.) Build from scratch
Export contacts and calendars. It is best to install Nextcloud 29 from scratch first on a new system Ubuntu 24.04 LTS or Debian 12 and keep old system for backup, create users, copy all user files to the correct folders (data/username/files) and run

sudo -u www-data php occ files:scan --all.
documentation

All files are back but all share, deck, … are lost. You will have to import contacts and calendars again from the export of them. Maybe you can live with that.

If you still need all shares, decks, etc., the only option left is a.)

I think that does not work because the function is only since Nextcloud 24 available. I also don’t know whether all app data is exported. I also don’t know whether the import works well in newer Nextcloud versions.

Thanks for the tip with the user files. So users are nit stored in MySQL?

I already installed new from scratch and imported calendars, my data, …

Import of user files helps, that my users can stay with old passwords. I will try it tonight.

They are stored in MariaDB. But you can create the new user on the new Nextcloud 29 and then copy the files to the correct place and re-scan with occ. Command is above. Then the files are back again in file system and Nextcloud database.