Menu

AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup solution that allows the IT administrator to set up a single master backup server to back up multiple hosts over network to tape drives/changers or disks or optical media. Amanda uses native utilities and formats (e.g. dump and/or GNU tar) and can back up a large number of servers and workstations running multiple versions of Linux or Unix.


Install Amanda Server
==============
Install amanda packages using yum:
# yum install -y amanda*
Create the configuration file. I am going to name this backup project is ServerNetBackup. We need to create a directory named by this project and all configuration files for this project will be underneath it:
# mkdir /etc/amanda/ServerNetBackup
Create the core configuration file, amanda.conf:
vim /etc/amanda/ServerNetBackup/amanda.conf
And paste following line:
org "ServerNetBackup"                 # Organization name for reports
mailto "address@hackthesec.co.in"        # Email address to receive reports
netusage 10000 Kbps                   # Bandwidth limit, 10M
 
dumpcycle 1 week                      # Backup cycle is 7 days
runspercycle 7                        # Run 7 times every 7 days
tapecycle 15 tapes                    # Dump to 15 different tapes during the cycle
tpchanger "chg-disk"                  # The tape-changer glue script
 
changerfile "/etc/amanda/ServerNetBackup/changer"     # The tape-changer file
 
tapedev "file://central_backup/ServerNetBackup/slots" # The no-rewind tape device to be used
tapetype HARDDISK                                     # Define the type of tape
 
infofile "/etc/amanda/ServerNetBackup/curinfo"        # Database directory
logdir "/etc/amanda/ServerNetBackup/logs"             # Log directory
indexdir "/etc/amanda/ServerNetBackup/index"          # Index directory
 
define tapetype HARDDISK {                            # Define our tape behaviour
length 100000 mbytes                                  # Every tape is 100GB in size
}
 
amrecover_changer "changer"                           # Changer for amrecover
 
define dumptype global {                              # The global dump definition
maxdumps 2                                            # The maximum number of backups run in parallel
estimate calcsize                                     # Estimate the backup size before dump
holdingdisk yes                                       # Dump to temp disk (holdingdisk) before backup to tape
index yes                                             # Generate index. For restoration usage
}
 
define dumptype root-tar {                            # How to dump root's directory
global                                                # Include global (as above)
program "GNUTAR"                                      # Program name for compress
comment "root partitions dumped with tar"
compress none                                         # No compress
index                                                 # Index this dump
priority low                                          # Priority level
}
 
define dumptype user-tar {                            # How to dump user's directory
root-tar                                              # Include root-tar (as above)
comment "user partitions dumped with tar"
priority medium                                       # Priority level
}
 
define dumptype comp-user-tar {                       # How to dump & compress user's directory
user-tar                                              # Include user-tar (as above)
compress client fast                                  # Compress in client side with less CPU (fast)
}

Configure Backup Location
=================
Prepare the directory to store all backups:
mkdir -p /central_backup/ServerNetBackup/slots
Assign correct permission to user amandabackup for the configuration directory and backup directory:
$ chown amandabackup.disk /central_backup -Rf
$ chown amandabackup.disk /etc/amanda/ServerNetBackup -Rf
Login as user amandabackup:
su - amandabackup
Create the virtual tape. This is where the backup files will be stored. We will need to create 15 slots as per tapecycle keyword:
$ for n in `seq 1 15`; do mkdir /central_backup/ServerNetBackup/slots/slot${n}; done
We then need to label all slots:
$ for n in `seq 1 15` ; do amlabel ServerNetBackup ServerNetBackup-${n} slot ${n}; done
Create all required directories as defined in the configuration file:
$ mkdir /etc/amanda/ServerNetBackup/curinfo
$ mkdir /etc/amanda/ServerNetBackup/logs
$ mkdir /etc/amanda/ServerNetBackup/index
Configure Service and What to Backup

We need to define what to backup in a file called disklist. As user amandabackup, create this file:
$ su - amandabackup
$ vim /etc/amanda/ServerNetBackup/disklist
And add following line:
sv101.hackthesec.co.in /home/webby/public_html   comp-user-tar
gogogo.hackthesec.co.in  /etc                      root-tar
Notes: Make sure the hostname is FQDN and can be resolved to an IP. Add the host entry into /etc/hosts is recomended.

Exit from amandabackup user and get back to root user:

Enable amanda service in xinetd.d directory:
vim /etc/xinetd.d/amanda
And change following line from "yes" to "no"

Enable on boot and restart xinetd service:
$ chkconfig xinetd on
$ service xinetd restart
Check the amanda server whether it is running properly by using following command:
$ netstat -a | grep amanda
udp        0          0       *:amanda                *:*
If you see result as above, amanda server is ready to serve!

Install Amanda Backup Client
======================
Login to the client’s server and install required package for Amanda using yum:
$ yum install -y amanda amanda-client
As user amandabackup, add following line into /var/lib/amanda/.amandahosts to specify where is Amanda backup server:
$ su - amandabackup
$ vim /var/lib/amanda/.amandahosts
And make sure the value as below:
office.hackthesec.co.in amandabackup amdump
localhost amandabackup amdump
localhost.localdomain amandabackup amdump
Exit from user amandabackup and turn to root user:

Enable amanda service in xinetd.d directory:
$ vim /etc/xinetd.d/amanda
And change following line from"yes" to "no"

Enable on boot and start the xinetd service
$ chkconfig xinetd on
$ service xinetd start
Add an entry in /etc/hosts to define backup server IP by adding following line:
125.10.90.90      office.hackthesec.co.in
In some case, you may need to change the permission of the directory that you want to backup. For example, I need to allow user amandabackup to access directory /home/webby/public_html to create backup:

As root user, change the permission of the directory:
$ chmod 755 /home/webby
Run the Backup Process
=================
Now go back to the Amanda server and check our configuration file as amandabackup user:
$ su - amandabackup
$ amcheck ServerNetBackup
You should see the output similar to this:
Client check: 2 host checked in 2.070 seconds.  0 problems found.
If no error found, you can start the backup process immediately by running following command:
$ amdump ServerNetBackup
Or, we can automate this process using cronjob. Run following command as amandabackup user:
$ crontab -e
And add following line:
45 0 * * 2-6 /usr/sbin/amdump ServerNetBackup
As root user, reload the crond service to activate this job:
$ service crond reload


About Author:


I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Next
This is the most recent post.
Previous
Older Post

0 comments:

Post a Comment

 
Top