Howto set up auto backup of your system with backup-manager
Every
Linux newbies in some part of his/her adventure will get to the part
where backup is needed. In this howto we will explain the basics of the
backup, why a backup is needed and the easiest way to backup your
system.
Linux's configuration files are plain text human readable files.
That means that if you have configured some application or program you
have done that through editing a text file most likely ending with
".conf". Backing up your system will help you in a lot of ways: due to
a program/system failure, human failre of hardware failure. Let's
imagine something happens to your Linux machine. Getting new
machine up and running will take you about an hour, but what about all
the programs and configuration files that you have edited manually. You
will have to do this all over again, unless you have backed up your
system. Then restoring will be easy as executing several commands. In
this
howto we will install and set automatic backing up with backup-manager.
NOTE: backup-manager is available
from the official source of almost every distribution :
Ubuntu/Debian : apt-get install <package>
Gentoo : emerge <package>
Sabayon : equo install <package>
ArchLinux : pacman <package>
and so on ... it depends on the distribution
If not let's compile the tarball:
1. Download
$ wget
http://www.backup-manager.org/download/backup-manager-0.6.3.tar.gz
At this time this is the latest version. You can always check for
new releases on the Official
Website
2. Extract the tarball
$ tar vfx
backup-manager-0.6.3.tar.gz
3. Enter (use "cd") the directory
$ cd backup-manager-0.6.3
4. Install
backup-manager-0.6.3 ~ $ sudo make && sudo make install
"sudo" is being used due to permission problems
Now is time for the configuration file. If you try to start it
without configuration file you will end up seeing error like this :
backup-manager-0.6.3 ~ $ sudo
/usr/sbin/backup-manager
/usr/sbin/backup-manager: line
135: /etc/backup-manager.conf: No such file or directory
A sample configuration file is located at :
/usr/share/backup-manager/backup-manager.conf.tpl
Let's copy it :
backup-manager-0.6.3 ~ $ cp
/usr/share/backup-manager/backup-manager.conf.tpl
/etc/backup-manager.conf
Now edit /etc/backup-manager.conf
according to your needs. The sample configuration file is pretty
well explained itself but if you haven't understand something,
Example :
Specified directory where the archives will be stored :
export
BM_REPOSITORY_ROOT="/home/kickar/backup/"
For security reasons the archives MUST be readable/writeable to a
specific user/group:
export BM_REPOSITORY_USER="user"
export BM_REPOSITORY_GROUP="users"
We want the name of the archives to be long type so there are no
confusions :
export
BM_TARBALL_NAMEFORMAT="long"
tar.gz is the most common and secure archive type :
export
BM_TARBALL_FILETYPE="tar.gz"
We want /etc and /var/www (web server) to be backed up :
BM_TARBALL_TARGETS[0]="/etc"
BM_TARBALL_TARGETS[1]="/var/www"
We want master tarball every week :
export
BM_TARBALLINC_MASTERDATETYPE="weekly"
on monday :
export
BM_TARBALLINC_MASTERDATEVALUE="1"
We want to backup all the mysq databases :
export
BM_MYSQL_DATABASES="__ALL__"
export
BM_MYSQL_ADMINLOGIN="root"
export
BM_MYSQL_ADMINPASS="youPass"
There are also other options that will let you transfer the backup
over the network via ssh, but a better decision is a second HDD
conected to the same machine.Now save the configuration file. and lets
start it to see is it all good
~ $ sudo
/usr/sbin/backup-manager
If you see no output everything is fine! Check the archive
directory that you specified just to make surethe archives are all
there.
Integrating to CRON is pretty easy. You will have to create very
simple script that calls backup-manager. We suggest this script to be
in /etc/cron.daily , because it handles out daily archives:
~ $ sudo su
Enter /etc/cron.daily directory :
# cd /etc/cron.daily
Create a simple bash script called "backup-manager"
# nano backup-manager
#!/bin/sh
/usr/sbin/backup-manager
Save and exit... and thats it you are all set!
If you have any questions please refer to our FORUM
de.li.cio.us