Migrate Nextcloud snap installation from one VPS to another

Yes. It finally worked :grinning:

What I did on the old server:

sudo apt autoremove #free up a little space for the backup
sudo apt clean #free up a little more!
sudo nextcloud.export -abc #backup apps, databse, and configs, but not files (since there was no space left on the server for duplicating all the files)

What I did on the new server:

sudo snap install nextcloud
scp -pr <username>@<old_VPS_IP_address>:/var/snap/nextcloud/common/ /var/snap/nextcloud/common/ #copy files directly from the old server to the new one
sudo scp -pr <username>@<old_VPS_IP_address>:/var/snap/nextcloud/common/backups /media/ #copy the backup (apps, database, and config) to the new server as well
sudo chown -R root:root /media/backups/ #make sure files belong to root
sudo snap connect nextcloud:removable-media :removable-media #give nextcloud permission to read /media directory
sudo nextcloud.import -abc /media/backups/<backup-date>/ #import the backup

And after all that, of course on the new server:

sudo nextcloud.enable-https lets-encrypt
4 Likes