Install and configure Backup Manager on Debian 4.0 Etch
Backup Manager is a tool easing the backup task. It has numerous options and can handle many backup methods. It really helped me to set up a coherent backup infrastructure. Don't forget that backup are important because no one is spared when a hard drive crash, or when a system is hacked.
This howto is deprecated. Use the new version available on Biapy Help Desk:
Install and setup Backup Manager on Debian
Installing
First, install backup-manager without changing anything to the default parameters:
DEBIAN_FRONTEND='noninteractive' /usr/bin/apt-get install backup-manager
We also install some aditionnal tools such as bzip2, and a Perl FTP library:
/usr/bin/apt-get install bzip2 libnet-lite-ftp-perl
We configure Backup Manager so that "backup" group members can read the backups files, but can not edit them:
/bin/sed -i -e 's/[#]*\(.*BM_REPOSITORY_GROUP=\).*$/\1"backup"/' \ -e 's/[#]*\(.*BM_REPOSITORY_CHMOD=\).*$/\1"750"/' \ -e 's/[#]*\(.*BM_ARCHIVE_CHMOD=\).*$/\1"640"/' \ /etc/backup-manager.conf
We change the type of the created archives to tar.bz2. This compression is more powerfull than the default tar.gz:
/bin/sed -i -e 's/[#]*\(.*BM_TARBALL_FILETYPE=\).*$/\1"tar.bz2"/' \ /etc/backup-manager.conf
We setup Backup Manager to create incremental backups (in order to save disk space):
/bin/sed -i -e 's/[#]*\(.*BM_ARCHIVE_METHOD=\).*$/\1"tarball-incremental"/' \ /etc/backup-manager.conf
By default the "master" of the incremental backups are create every monday. For my use, it is fine, but it is up to you to change this setting.
Backuped folders list management
We now download a little script that I wrote. It allow you to add and/or remove folders from the list of backuped items. This is a time saver since it avoid you to edit the Backup Manager configuration file:
/usr/bin/wget http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-et-configurer-backup-manager-sur-debian-4-0-etch/update-bm-folders \ --output-document=/usr/bin/update-bm-folders /bin/chmod +x /usr/bin/update-bm-folders
This script can be used with the following syntax:
- to add a folder to the list of backuped items:
update-bm-folders add /my/folder
- to remove a folder from the list of backuped items:
update-bm-folders remove /my/folder
By default, Backup Managed is setted up to backup /etc and /home folders. In my opinion, it is a good thing to also backup /root and /var/backups, because the first one contains your root account datas, and the second, the list of installed packages for the system:
update-bm-folders add /root update-bm-folders add /var/backups
Backups export
No one can avoid a hardware breakdown. It is important to have multiple backup locations. Backup Manager has many options to "export" its archives.
Copying backups to a remote SSH server
If you have a second computer with a SSH access, you can configure Backup Manager to copy its backups to this computer. In order to do so, enter the following parameters (replace the bold values by the one that fit your configuration):
SSH_USER=backup SSH_PRIVATE_KEY=/root/backup-rsa-key SSH_HOST=server.domain.com SSH_PATH=/var/archive
Note: The SSH key is created by the ssh-keygen command line.
And apply these parameters to the Backup Manager configuration:
/bin/sed -i -e "s|[#]*\(.*BM_UPLOAD_SSH_USER=\).*$|\1\"${SSH_USER}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_SSH_KEY=\).*$|\1\"${SSH_PRIVATE_KEY}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_SSH_HOSTS=\).*$|\1\"${SSH_HOST}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_SSH_DESTINATION=\).*$|\1\"${SSH_PATH}\"|" \ /etc/backup-manager.conf
Once this done, enable Backup Manager to upload its archives to your SSH server:
/bin/sed -i -e "s/[#]*\(.*BM_UPLOAD_METHOD=\).*$/\1\"scp\"/" \ /etc/backup-manager.conf
Note: If you use Debian 5.0 Lenny (this is probably also true for Ubuntu), the copy of backups to a remote SSH server does not work unless you tell Backup Manager the port of the SSH server. Usually it is the port 22. Edit the /etc/backup-manager.conf file, and change the port setting line so that it look like:
export BM_UPLOAD_SSH_PORT="22"
Copying backups to a remote FTP server
If you rent a dedicated server from OVH company, know that your server come with a FTP space that is the size of your server hard disk. Here is an example on howto setup Backup Manager to copy its archives to a FTP server like the OVH one.
First, input the FTP connection settings (replace the bold values by the one that fit your configuration):
FTP_HOST=ftp.ovh.fr FTP_USER=some-login FTP_PASSWORD=some-password FTP_PATH=/my/ftp/folder
Note: The FTP_PATH value can be something else than the root of your FTP account. This can be any folder available in your FTP account.
Now, apply these settings to the Backup Manager configuration:
/bin/sed -i -e "s|[#]*\(.*BM_UPLOAD_FTP_USER=\).*$|\1\"${FTP_USER}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_FTP_PASSWORD=\).*$|\1\"${FTP_PASSWORD}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_FTP_HOSTS=\).*$|\1\"${FTP_HOST}\"|" \ -e "s|[#]*\(.*BM_UPLOAD_FTP_DESTINATION=\).*$|\1\"${FTP_PATH}\"|" \ /etc/backup-manager.conf
Once this done, enable Backup Manager to upload its archives to the FTP server:
/bin/sed -i -e "s/[#]*\(.*BM_UPLOAD_METHOD=\).*$/\1\"ftp\"/" \ /etc/backup-manager.conf
Thanks
- Thanks to Backup Manager developers for their work on this magnificent tool.
- Thanks to Azaad Source for the post How to disable debconf for automated install of packages using apt-get.
- Thanks to prince_jammys on irc.freenode.net#bash for pointing me to How can I handle command-line arguments to my script easily? on the website Greg's Wiki.
- Thanks to Andy Skelton for his article Bash equivalent for PHP realpath().