In this article we will see how to use this script backup and restore for GNUPanel gnupanel-backup_0.1.0.tar.bz2
Thank GNUtransfer the loan us a VPS and other resources to write this article.
Note: We have available a ftp account to backup our server.
Note 2: This script is designed to backup GNUPanel.
We make sure have installed the packages duplicity, rsync, ncftp, mawk and of course GNUPanel.
root@vps146167:/# apt-get install rsync duplicity ncftp mawk Reading package lists... Done Building dependency tree Reading state information... Done mawk is already the newest version. rsync is already the newest version. ncftp is already the newest version. duplicity is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@vps146167:/#
Download the script, unzip it, we entered into the directory gnupanel-backup_0.1.0 and execute ./install.sh
root@vps146167:/#cd /tmp root@vps146167:/tmp# wget http://downloads.geeklab.com.ar/files/scripts/gnupanel-backup_0.1.0.tar.bz2 --2013-02-06 18:06:50-- http://downloads.geeklab.com.ar/files/scripts/gnupanel-backup_0.1.0.tar.bz2 Resolving downloads.geeklab.com.ar (downloads.geeklab.com.ar)... 69.61.29.79 Connecting to downloads.geeklab.com.ar (downloads.geeklab.com.ar)|69.61.29.79|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3941 (3.8K) [application/x-bzip2] Saving to: `gnupanel-backup_0.1.0.tar.bz2' 100%[=====================================================================================================================================================================================================================================================================================>] 3,941 --.-K/s in 0s 2013-02-06 18:06:50 (61.7 MB/s) - `gnupanel-backup_0.1.0.tar.bz2' saved [3941/3941] root@vps146167:/tmp# tar xf gnupanel-backup_0.1.0.tar.bz2 root@vps146167:/tmp# cd gnupanel-backup_0.1.0/ root@vps146167:/tmp/gnupanel-backup_0.1.0# ./install.sh root@vps146167:/tmp/gnupanel-backup_0.1.0#
Then edit the file /etc/gnupanel/gnupanel-backup.conf, will see the different variables.
DIRS: It is a list of directories to be backed up should look like
For Ubuntu
#DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats /var/lib/dbconfig-common" #DEBIAN DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats" #UBUNTU
For Debian
DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats /var/lib/dbconfig-common" #DEBIAN #DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats" #UBUNTU
PG_VERSION: The version we have installed postgresql typically 8.1, 8.3, 8.4, 9.1
PG_VERSION=9.1
FTP_USER: FTP User
FTP_PASSWORD: FTP Password
FTP_SERVER: FTP address
FTP_USER=ftpuser FTP_PASSWORD=ftppassword FTP_SERVER=192.168.1.50
LOCAL_DIR_BACKUP: Local directory where copied the files before they are uploaded to the FTP server.
LOCAL_DIR_RESTORE: Local directory where copied the files from the FTP before doing the restore.
LOCAL_DIR_BACKUP=/var/backups/gnupanel LOCAL_DIR_RESTORE=/var/backups/gnupanel-restore
These four parameters are for the duplicity
REMOVE_OLDER: Delete all backup sets older than the given time.
VOLSIZE: Change the volume size in Mb.
DAY_FULL: Duplicity does an incremental backup, this value indicates that day of the week do a full backup, possible values of 1, 2, 3, 4, 5, 6, 7
DUPLICITY_GPG_PASSPHRASE: Duplicity encrypts data sent to the FTP, this is the password that is used for the encryption.
REMOVE_OLDER=7D VOLSIZE=100 DAY_FULL=7 DUPLICITY_GPG_PASSPHRASE=change_for_random_string
DROP_LOCAL_DIR_BACKUP: «yes» deletes the directory LOCAL_DIR_BACKUP once uploaded to FTP.
DROP_LOCAL_DIR_BACKUP=no
Then a typical configuration should look like this (the highlighted lines are those that typically must be modified)
#DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats /var/lib/dbconfig-common" #DEBIAN DIRS="/etc /var/log /var/www /var/spool/squirrelmail /var/lib/squirrelmail /var/mail/correos /var/lib/mailman/archives /var/lib/mailman/data /var/lib/mailman/lists /var/lib/awstats" #UBUNTU PG_VERSION=9.1 FTP_USER=ftpuser FTP_PASSWORD=ftppassword FTP_SERVER=192.168.1.50 LOCAL_DIR_BACKUP=/var/backups/gnupanel LOCAL_DIR_RESTORE=/var/backups/gnupanel-restore REMOVE_OLDER=7D VOLSIZE=100 DAY_FULL=7 DUPLICITY_GPG_PASSPHRASE=change_for_random_string DROP_LOCAL_DIR_BACKUP=no
Then run the command manually to check that everything works properly
root@vps146167:/# gnupanel-backup.sh root@vps146167:/#
and checked the /var/log/gnupanel-backup.sh.err where the script runs all errors
root@vps146167:/# cat /var/log/gnupanel-backup.sh.err root@vps146167:/#
and then the file /var/log/gnupanel-backup.sh.log where the script goes to stdout
root@vps146167:/# cat /var/log/gnupanel-backup.sh.log BEGIN backup PostgreSQL END backup PostgreSQL BEGIN backup MySQL END backup MySQL Import of duplicity.backends.giobackend Failed: No module named gio Import of duplicity.backends.sshbackend Failed: No module named paramiko NcFTP version is 3.2.5 Synchronizing remote metadata to local cache... Deleting local /root/.cache/duplicity/b630c5d253d414ed6c552487122e44fc/duplicity-full-signatures.20130206T025047Z.sigtar.gz (not authoritative at backend). Deleting local /root/.cache/duplicity/b630c5d253d414ed6c552487122e44fc/duplicity-full.20130206T025047Z.manifest (not authoritative at backend). Deleting local /root/.cache/duplicity/b630c5d253d414ed6c552487122e44fc/duplicity-inc.20130206T025047Z.to.20130206T054111Z.manifest (not authoritative at backend). Deleting local /root/.cache/duplicity/b630c5d253d414ed6c552487122e44fc/duplicity-new-signatures.20130206T025047Z.to.20130206T054111Z.sigtar.gz (not authoritative at backend). Last full backup date: none No signatures found, switching to full backup. --------------[ Backup Statistics ]-------------- StartTime 1360194685.50 (Wed Feb 6 18:51:25 2013) EndTime 1360194696.93 (Wed Feb 6 18:51:36 2013) ElapsedTime 11.43 (11.43 seconds) SourceFiles 5377 SourceFileSize 47382494 (45.2 MB) NewFiles 5377 NewFileSize 47382494 (45.2 MB) DeletedFiles 0 ChangedFiles 0 ChangedFileSize 0 (0 bytes) ChangedDeltaSize 0 (0 bytes) DeltaEntries 5377 RawDeltaSize 45737257 (43.6 MB) TotalDestinationSizeChange 10863678 (10.4 MB) Errors 0 ------------------------------------------------- Import of duplicity.backends.giobackend Failed: No module named gio Import of duplicity.backends.sshbackend Failed: No module named paramiko NcFTP version is 3.2.5 Local and Remote metadata are synchronized, no sync needed. Last full backup date: Wed Feb 6 18:51:24 2013 No old backup sets found, nothing deleted. Import of duplicity.backends.giobackend Failed: No module named gio Import of duplicity.backends.sshbackend Failed: No module named paramiko NcFTP version is 3.2.5 Local and Remote metadata are synchronized, no sync needed. Last full backup date: Wed Feb 6 18:51:24 2013 No extraneous files found, nothing deleted in cleanup. root@vps146167:/#
With this we have the full backup, disaster the restore is done as follows
Install GNUPanel but only these three steps
./install-dep.sh ./gnupanel-install.sh gnupanel-config.sh
IP values, primary domain, etc should be the same as in the original installation.
Once finished gnupanel-config.sh install the script gnupanel-backup_0.1.0.tar.bz2 and configured with the values exactly like I had at the time of the backup. Only two values can be changed
FTP_PASSWORD: If that has changed.
PG_VERSION: You must have installed version.
Then run the script with the parameter restore
root@vps146167:/# gnupanel-backup.sh restore root@vps146167:/#
And we check the /var/log/gnupanel-backup.sh.err
root@vps146167:/# cat /var/log/gnupanel-backup.sh.err psql:/var/backups/gnupanel-restore/databases/postgresql/all_postgres.dump:22: ERROR: role "postgres" already exists root@vps146167:/#
That error is normal and should not cause problems.
And in the /var/log/gnupanel-backup.sh.log have every script stdout
Finally reboot the server
This completes the article.

About Ricardo Marcelo Alvarez
- Web |
- More Posts(58)