sudo snap install nextcloud sudo nextcloud.enable-https lets-encrypt sudo snap connect nextcloud:removable-media
sudo apt-get update sudo apt-get install -y xrdp xfce4 xfce4-terminal echo xfce4-session >~/.xsession
How to backup your instance
Kyle Fazzari edited this page on 8 Aug 2019 · 7 revisions
The nextcloud snap includes an utility to backup and restore your instance. Right now it can export:
- The apps
- The database
- The config
- The raw data
But note that this does not cover exporting other settings, like HTTPS certificates.
nextcloud.export and it’ll turn on maintenance mode and dump a backup of your entire instance into a timestamped folder, something like
After the export is complete the snap will forget about it, so feel free to do whatever you like with it; one option could be to tar it, with a command like this:
sudo tar -cvf 20190121-153921_nextcloud-backup.tar /var/snap/nextcloud/common/backups/20190121-153921
You can import an exported backup by running
sudo nextcloud.import path/to/backup/dir.
Important! Importing a backup will completely blow away the current instance: it’ll drop the database, delete the installed apps, and delete all raw data, replacing each with that from the backup.
The only constraints are that:
- This path needs to be available from confinement, so put it in
rootneeds to be the owner.
So continuing with the previous example, these two commands would need to be executed before importing:
sudo mv 20190121-153921_nextcloud-backup.tar /var/snap/nextcloud/current/
sudo chown -R root:root /var/snap/nextcloud/current/20190121-153921/
Note that you can limit what is exported (and what is imported) with arguments that are documented if you run
nextcloud.export -h or
Usage: nextcloud.export [OPTIONS] Export data suitable for migrating servers. By default this includes the Nextcloud database, configuration, and data (equivalent to running nextcloud.export -abcd). Available options: -h: Display this help message -a: Include the (non-default) apps -b: Include the database -c: Include the config -d: Include the data (can be quite large)
Q. Can exporting specify the data directory?
A. Not directly, but you should be able to use a symlink. For example, creating a symlink from the data directory to
Q. Can I somehow export/import my HTTPS certs?
A. Yes, everything related to them is stored in the
/var/snap/nextcloud/current/certs directory, so copying it and preserving its permissions and owner works.
The export/import tools are mostly written from the perspective of wanting to migrate your current install to another instance of the snap. Keep that in mind:
- It won’t be particularly helpful in migrating to the snap from a non-snap install
- Likewise, it won’t be particularly helpful in migrating away from the snap
- It creates a copy of your config, trusted domains and all. If you’re migrating to a new domain name, keep this in mind– you’ll need to update the trusted domains yourself.
sudo apt-get update
sudo apt-get –purge –reinstall install firefox