https://docs.nextcloud.com/server/stable/admin_manual/maintenance/backup.html
https://help.nextcloud.com/t/backup-nextcloud-with-seperate-data-folder-and-the-database/5841/2
good info on rsync:
http://webgnuru.com/linux/rsync_incremental.php
more info on mysql backups:
https://www.liquidweb.com/kb/how-to-back-up-mysql-databases-from-the-command-line/
Restoring Nextcloud from backup:
https://kenfavors.com/code/how-to-restore-a-nextcloud-backup/
To backup an Nextcloud installation there are four main things you need to retain:
- The config folder
- The data folder
- The database
- The theme folder
Backup Folders
Simply copy your config, data and theme folders (or even your whole Nextcloud install and data folder) to a place outside of your Nextcloud environment.
1. Copy the data directory (if outside of the nextcloud directory):
$ sudo rsync -Aax /var/www/data/ /media/ncbackup/nextcloud-data_`date +"%Y%m%d"`/
2. Copy the entire Nexcloud install, which includes the required config and theme folders:
$ sudo rsync -Aax /var/www/html/nextcloud/ /media/ncbackup/nextcloud-dirbkp_`date +"%Y%m%d"`/
3. Backup MySQL/MariaDB:
$ mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
an example below (the ‘-h’ flag is unncessary if the database is on the same server). Also, ‘–lock-tables’ is included per the link below:
$ mysqldump --lock-tables -u root -p nextcloud > /media/ncbackup/database/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
There are some answers to common issues in this link:
https://help.nextcloud.com/t/backup-nextcloud-with-seperate-data-folder-and-the-database/5841/7
If you get a ‘Permission denied’ error when trying to backup the database, it is because the current user account you are using does not have the right permission to write to the destination path. Change permissions like this (substituting ‘username’):
$ sudo setfacl -R -m "u:username:rwx" /media/ncbackup
also found at How To Add User Permissions To A Folder in Ubuntu
Related
How to manually upgrade Nextcloud
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/manual_upgrade.html
and
Hosting
Develop and scale your apps globally with DigitalOcean and/or Vultr – or use shared hosting with no server maintenance required at iMarketHost.com.
Installation & Maintenance
If you would like to get this app installed, maintained or need training, Contact Me to get current rates.