A shell script for migrating the NcVM between different Ubuntu Versions.
Please note: You are free to run this script at your personal risk. I am not responsible for any damaged systems and will not provide any personal support. So please keep backups!
Connect to your NcVM via ssh and run:
wget https://raw.githubusercontent.com/szaimen/NcVM-migration/master/migration.sh && sudo bash migration.sh
That's it!
- The whole backup-restore functionality is based on the great scripts provided by DecaTec, please see here: https://codeberg.org/DecaTec/Nextcloud-Backup-Restore
- The migration.sh script produces automatically the backup files and a restore.sh script, which can be called from the new NcVM after running the startup-scrip and restores all Nextcloud-relevant files and data, which is the database, the datadirectory and the Nextcloud-folder to the new NcVM.
- In the last step of the restore.sh script, are you asked if you want to activate tls on the new server, which is the only step left, to make the new server work again.
- After that, you can simply execute the by the NcVM provided scripts again, to get additional apps working again.
- Create a backup of your NcVM
- Mount a SMB-share to your NcVM using the built-in smbmount script by running
sudo bash /var/scripts/menu.sh
->Additional Apps
->SMB-mount
- Execute the migration.sh script
- Download a new NcVM
- Import and start the new NcVM and run the startup-script
- Mount the same SMB-share to the new NcVM using the built-in smbmount script again (see point 2)
- Execute the by the migration.sh script produced restore.sh script on the new NcVM
- Logg in to the restored Nextcloud using the local ipaddress of the new NcVM in a Browser and test if everything works as expected
(e.g. check the Nextcloud logs, test all installed Nextcloud apps, etc.) - If yes, enable lets encrypt by running
sudo bash /var/scripts/menu.sh
-> chooseServer Configuration
-> chooseActivate TLS
- If needed, manually restore crontab entries, fstab entries, etc.
- Reinstall NcVM apps by running
sudo bash /var/scripts/menu.sh
->Additional Apps
- This should be it 🎉
- You have to connect a SMB-mount by executing the by the NcVM provided smbmount script before running both - migration.sh & restore.sh - scripts since you need to store the backup files outside of the NcVM to be able to restore them to a new NcVM afterwards.
- If you have mounted and used SMB-mounts in the NcVM before, you need to restore them manually in the correct order at the correct mountpoint before executing the restore.sh scipt
- The migration.sh script only works on NcVM based machines with Ubuntu 18.04 and php 7.2 and the restore.sh script only works on NcVM based machines with Ubuntu 20.04 and php 7.4.
- Only the default NcVM configuration is supported.
- At least Nextcloud 18 is needed to run the migration.sh script
- Apps, that are provided by the NcVM and were installed on your old system will not be automatically installed by the restore.sh script, since they can get easily reinstalled by running the by the NcVM provided scripts.
- Backup of official Bitwarden is not supported.
- Non-standard customization on the old NcVM will not get backed up and restored, and has to get manually redone on the new NcVM after restoring.
- The crontabs are saved in a no-restore folder. They are backed up here, so that you can look at them to better remember which cronjobs where running in your old system. You need to manually restore missing cronjobs, since that can't be automated.
- The update.sh file is backed up in this folder, as well, since you could possibly have changed something in there, which has to get manually restored, if needed.
- The fstab is also getting backed up in the no-restore folder so that you can see your old configuration, which is helpful e.g. to be able to manually restore the correct order of smb-mounts, etc.
- If you have Bitwarden_rs running on your old NcVM, the migration.sh script will automatically backup all needed files and create a bitwarden-restore.sh script.
- Execute all steps of In a nutshell
- Install Bitwarden_rs on the new NcVM by running 'sudo bash /var/scripts/menu.sh' and choosing Additional Apps -> Bitwarden -> Bitwarden_rs and enter during the installation the Bitwarden_rs-Domain of your old Bitwarden_rs installation
- Execute bitwarden-restore.sh
- That's it 🎉