Nextcloud

Nextcloud 18 backup and restore

This-one-logo-cloud-only9-center-purple-bk-h450-w650.png

By jplee ~ Published – 2020/03/09  /  Updated – 2020/03/10

Backup Nextcloud

Table of Content

About Us

Ahuitech is a website prepared especially for the latest version of Nextcloud updates.  This is a step by step manual guide.

Nextcloud is a self-hosted productivity application software platform on Ubuntu or other Linux systems that keeps you in total control of all your Data!  You can use this latest Nextcloud version for free.  Create your awesome remarkable cloud system today!

Privacy Policy – You act on your own accord and risk – No Warranty.

Categories

Backup Nextcloud

It’s a very good idea to schedule regular backups times from 00:00:00 (Sunday) to 23:59:59 (Saturday) of your Nextcloud system.  Including at least the following folders:
         1.    the webfolder: /var/www/nextcloud
         2.    the datafolder: /var/nc_data/appdata
         3.    and the database: nextcloud.

Please substitute ubuntu username and the database password nextcloud with yours.   Enter into sudo mode:

sudo -s

Turn maintenance mode on:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
  1.  Backup the webfolder:

tar -cpzf /home/username/ncserver_`date +”%w”`.tar.gz -C /var/www/nextcloud

     2.  Backup the datafolder:

tar -cpzf /home/username/ncdata_`date +”%w”`.tar.gz -C /var/nc_data

    3.  Backup the database:

mysqldump –single-transaction -h localhost -unextcloud -pnextcloud nextcloud > /home/username/ncdb_`date +”%w”`.sql

Turn maintenance mode off:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

You have completed the process of backup!  Done!

Restore Nextcloud

Restore your Nextcloud using the following process.  Including the following folders:
         1.    the webfolder: /var/www/nextcloud
         2.    the datafolder: /var/nc_data/appdata
         3.    and the database: nextcloud.

Remember to substitute ubuntu username and the database password nextcloud with yours.     Enter into sudo mode:

sudo -s

Turn maintenance mode on:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on

Stop services:

service nginx stop
service php7.3-fpm stop

Move the old directories:

cd /var/www/
mv nextcloud oldnextcloud
cd /var/
mv nc_data olddata

Create the directories new again:

mkdir -p /var/www/nextcloud/
mkdir -p /var/nc_data/
tar -xpzf /home/username/ncserver_1.tar.gz -C /var/www/nextcloud/
tar -xpzf /home/username/ncdata_1.tar.gz -C /var/nc_data/

Apply the permissions:

chown -R www-data:www-data /var/nc_data /var/www

Restore the databases:

      Delete the old database:

mysql -h localhost -uroot -pnextcloud -e “DROP DATABASE nextcloud”

     Create an empty database:

mysql -h localhost -uroot -pnextcloud -e “CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci”

     Grant access:

mysql -h localhost -uroot -pnextcloud -e “GRANT ALL PRIVILEGES on nextcloud.* to nextcloud@localhost”

     Restore the database:

mysql -h localhost -unextcloud -pnextcloud nextcloud < /home/username/ncdb_1.sql

Delete the old directories:

rm -rf /var/www/oldnextcloud/
rm -rf /var/olddata/

Restart services:

/usr/sbin/service php7.3-fpm start
/usr/sbin/service nginx start

Fingerprint:

After restoring a backup of your data directory or the database, you should always call maintenance:data-fingerprint once. This changes the ETag for all files in the communication with sync clients, allowing them to realize a file was modified.

sudo -u www-data php /var/www/nextcloud/occ maintenance:data-fingerprint

Turn maintenance mode off:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

Congratulations, you now have your own personal data on your own secured Nextcloud 18 system backup and restored!  

At Ahuitech, we create clouds systems that allow you to have complete control of your Data.  You are always in Control!

Done!

An alternative method to backup Nextcloud

The following backup procedure is probably the easiest way to insure you always have a complete Nextcloud system backup including all your data.

This is based on using VMware vCenter Server Appliance (VCSA) application software.

  1.  Right click Nextcloud VMware server and select Clone to Template.
Click on image to enlarge

2.  Enter Virtual Machine name.  20200308_1556-ubuntu18vm21-c1-temp-usb1-57 and click Next.

Screenshot-from-2020-03-08-15-59-34.png
Click on image to enlarge

3.  Select ESXi host 10.1.100.41 and click Next

Screenshot-from-2020-03-08-16-16-31.png
Click on image to enlarge

4.  Select storage and virtual disk format:  usb1-1-1.82t and Thin Provision, then click Next

Screenshot-from-2020-03-08-16-24-46.png
Click on image to enlarge

5.  Ready to complete and click Finish to begin cloning the virtual machine to template

Screenshot-from-2020-03-08-16-31-17.png
Click on image to enlarge

You have completed the process of backup!  Done!

An alternative method to restore Nextcloud

In order to restore Nextcloud and all your data, please follow this procedure below.

  1.  Right click on the Template and select New VM from This Template…
Click on image to enlarge

2.  Enter Virtual Machine name.  ubuntu18vm21-c2 and click Next.

Screenshot-from-2020-03-08-17-12-04.png
Click on image to enlarge

3.  Select ESXi host 10.1.100.41 and click Next

Screenshot-from-2020-03-08-17-15-56.png
Click on image to enlarge

4.  Select storage and virtual disk format:  sdb1-1-1.82t and Thin Provision, then click Next

Screenshot-from-2020-03-08-17-17-41.png
Click on image to enlarge

5.  Select clone options, or select none and then click Next

Screenshot-from-2020-03-08-17-22-45.png
Click on image to enlarge

6.  Ready to complete and click Finish to begin cloning the template to a new virtual machine!

Screenshot-from-2020-03-08-17-26-53.png
Click on image to enlarge

The above cloning procedure is an excellent process to restore your Nextcloud system and data.

After powering on the new ubuntu virtual machine, you may need to edit Wired Settings to your network environment in order to completely restore and control nextcloud system.  Please review image below as an example.

Click on image to enlarge

Congratulations, you now have your own personal data on your own secured Nextcloud 18 system backup and restored!  

At Ahuitech, we create clouds systems that allow you to have complete control of your Data.  You are always in Control!

Leave a Reply

Your email address will not be published. Required fields are marked *