Updating from 25 to 27

So, I have this Debian 11 machine with nextcloud 25 running fine in my LAN for some years (with apache and MariaDb)
I cannot update to 26 with the update mechanism because Debian 11’s latest php is 7.4.
Nextcloud 25 is the last supported nextcloud for this php.

Because of this (and a few other reasons) I want to set up a new machine with Debian 12 and go with Nextcloud 27.
And here the trouble begins.

I just cannot figure out how to carry over my current installation data (tasks, calendars, contacts and stuff) to a new installation on a different machine.

I sqldumped my current database and imported it on the new machine.
I tried importing before executing the nextcloud setup and I tried importing after the nextcloud setup.
Because I think the database from NC25 is not compatible to NC27, I tried to install NC25 on my new machine (just for testing), but again, I was not able to get it running with my old database.
I’m just not able to login after I import my old db.

Long story short:
What is the proper way of migrating a nextcloud from one machine to another while also updating to latest version in the process?

Migrate first (same version on both ends).

Upgrade after things are migrated.

The migration itself is as documented: Migrating to a different server — Nextcloud latest Administration Manual latest documentation

(with variance depending on installation method - see AIO docs if using AIO for example).

If you need to an intermediate PHP version that is cross-compatible with the an NC version, use the Sury PHP packages: https://deb.sury.org/ (same maintainer as the actual PHP packages in Debian).

Also, if you go the Sury route, you can upgrade Nextcloud beforehand if you prefer that approach for some reason. That’s up to you.

Also, not incidentally, once you use Sury you technically don’t have to upgrade to Debian 12 at all. But I personally would not use that as an excuse not to do so… :slight_smile:

There was an upgrade path for your problem. Read here.

You can (after backup your old installation, data, database, …):

a.) use the path on your old maschine
or better:
b.) install the old Debian Bullseye on your new maschine, migrate your old installation on your new maschine and then use the upgrade path
or much better:
c.) maybe you can direct restore Nextcloud 25 on your Debian Bookworm and then use the updater.phar.

b.) is far more expensive but minimizes your risk if my way fails. Do not destroy your data on your old system (a.))

For migration read also backup, restore and updater.phar.

Solved it.
Migrated my installation from Debian 11 / NC25 to Debian 12 / NC 27 with the following steps:

  • sqldumped complete nextcloud database on old machine
  • downloaded/unziped NC25 source files on new machine
  • created empty nextcloud database in mariadb
  • run the installer by calling the web address of your machine (for this to work, you need external php8.1 packages from https://packages.sury.org/ because Debian 12 ships with php8.2, which is to high for NC25)
  • AFTER installing nextcloud, I dropped the nextcloud database and then imported my sql dump from the old machine. The other way around didn’t work for me
  • run updater from CLI for upgrading to NC26
  • run updater from CLI for upgrading to NC27
  • (optional) drop php8.1 and the external repo in favor of php8.2

Thanks all.

1 Like

If you had added the Sury repos before upgrading to Debian 12, you could have simply installed PHP8.1 on Debian 11, then updated Nextcloud to the latest version using the built-in updater, and only then upgraded to Debian 12 :wink:

Matter of fact I’m using the Sury Apache and PHP repos, and the official MariaDB Repos. That way I can manage PHP, Apache and MariaDB versions independently from the OS version. Perhaps it is worth considering for the future to keep at least the PHP repo.

Anyways, I’m glad it worked out. :slight_smile: