Nextcloud version: 22.2.3
PHP version: 7.4
Database: MariaDB 10.5
I’m running my Nextcloud instance on shared hosting and would like to migrate it to another server of the same provider (also on shared hosting) and change the domain name in the process. I have a few dozen users and quite a lot of files in different (group) folders with different shares - all of which I’d like to preserve. A lot of the standard apps like Group folders, Calendar, Deck, Polls etc. are enabled. My data directory is outside of the Nextcloud installation directory, so I have
/cloud for all the program files etc. and
/cloud/data for the data. My hosting provider allows SSH access but obviously I don’t have sudo privileges but I can run occ commands.
Also, as you can probably tell, my technical knowledge is very basic.
Since the migration guide in the manual assumes root access to the server I will have to adapt the procedure to my circumstances. Here’s what I came up with:
- Set Nextcloud in maintenance mode on the old server and wait for 10 minutes
- Set up the database on the new server
- Create a dump of the database via phpMyAdmin
- Edit: Turns out my hosting provider allows me to use mysqldump via SSH so I’ll do that instead; still, it might be useful for others who come across this thread in the future to know if doing it via phpMyAdmin works as well
- Import the database via phpMyAdmin on the new server
- Edit: Turns out my hosting provider allows me to use mysql via SSH so I’ll do that instead; still, it might be useful for others who come across this thread in the future to know if doing it via phpMyAdmin works as well
- Copy all files from the old instance over to the new instance
- Change the following in config.php:
- dbname, dbuser, dbpassword (apparently my hosting provider doesn’t allow my to set this myself when creating a new database)
- Set up the domain on the new server, set it to use PHP 7.4 and point it to the Nextcloud installation path
- Open the URL of the new Nextcloud instance in a browser and confirm that it is in maintenance mode
- Take the migrated Nextcloud instance out of maintenance mode
- Ask users to log in to the new instance and check if everything looks alright
- Delete the files and the database on the old server
Here are my questions:
- Did I miss anything or get anything wrong?
- My hosting provider allows for the transfer of data between servers via FTP from within their customer control panel. Should I use this to copy the files or should I instead create a TAR file of the Nextcloud files on the old server and unpack them on the new server?
- This post recommends installing Nextcloud on the new server and only copying over the data directory from the old server but I thought it might be better to also copy the program files so that there’s no mismatch due to different apps being installed etc. Am I missing something?
This four year old post mentioned that the absolute path to the data directory is stored in the
oc_storagestable of the database and that this needs to be changed manually when moving. But from what I gathered from following posts in the thread, this was only the case with older versions of Nextcloud and is no longer necessary since Nextcloud will cross-check the information in the database with the information in the config.php. The post also gave the impression that the information on where the individual files are located is stored in the
oc_filecachetable of the database with the absolute path (" the
oc_filecachewill be full of wrong entries from the old location"). I couldn’t find any evidence of that in the
oc_filecachedatabase table of my installation though so I guess this can be disregarded as well. - Are my assumptions correct that this information is outdated?
- The migration guide in the manual mentions that you should confirm “that a logfile entry is written by both the Web server and Nextcloud and that no error messages occur”. Where would I have to look for those logfiles and what would I have to look out for specifically since I assume that there will be (irrelevant) error messages anyway?