Open Source Backup Solution
Abstract:
Amanda is an open source backup solution, and although it is very difficult to setup, the functionality and reliability are unrivaled. In today’s IT world backups are becoming more and more important as technology changes and hard drives expand.
Introduction:
This guide will help the user step by step through a basic Amanda installation. We will be installing Amanda on three different machines all run through Virtual Box, open source virtualization software similar to VMWare which can be found here: Virtual Box
Before we get started, write down the IP addresses of each of the machines required for this guide. The three machines I will be using are:
- Server.cswanson.info – 142.25.97.144 – the Linux Server (CentOS 5)
- Client.cswanson.info – 142.25.97.152 – the Linux Client (CentOS 5)
- Winclient.cswanson.info – 142.25.97.151 – the Windows Client (Windows XP)
Part 1A - Server:
- 1. Install CentOS 5.
- 2. Apply all available updates.
- 3. Set static IP for the machine.
- As root Type setup in a terminal and hit ENTER.
- Choose Network Configuration.
- Select the eth0 interface.
- Configure your IP settings.
- Run service network restart to apply the changes.
Part 1B - Linux Client:
- 1. Repeat the Server steps.
- 2. Enter the Linux client network information when setup is run.
Part 2 - Installing Amanda:
Server - Linux:
- 1. Start by creating the message of the day, this will allow us to determine if we are properly connected to the right machine via SSH:
- 2. Insert into the MOTD file; AMANDA SERVER, then save:
- 3. Create a directory to where we will wget the Amanda RPM file. RPM the file and unlock the amandabackup user it creates:
- 4. Now we will need to create a configuration folder for Amanda. For this I used DailySet1, which is a common name for most Amanda installations. Then find the default Amanda.conf file from the internet, I have taken one from my student files:
- 5. Open Amanda.conf (vi Amanda.conf) and make sure it matches the following lines of code (insert your own information):
- 6. In the dumptype global block, add:
- 7. We will now continue setting up the tapes for backing up. Create the tapelist file and input this information:
- 8. Now have to create those slot folders on the server machine:
- 9. Change permissions so the amandabackup user can read and write to the tapes:
- 10. Next, switch to the amandabackup user, we will now label the tapes:
- 11. Next, the disklist file needs to be created. This file lists all of the hosts including the server that will be engaging in the backup. This will be important later when we choose which client we will be backing up. Add the following to the file (insert your own information):
- 12. Type exit and return to root:
- 13. Next edit the .amandahosts file so that the machines can communicate with each other. Make sure the following is present:
- 14. Now we must edit the host file on the server. Make sure the following is present:
- 15. To make sure it can send mail start the sendmail service and create the directory where the holding disk will be created and edit the permissions:
- 16. Create these directories and files, amcheck will bring up errors if they are not present:
- 17. Create the myfiles directory for the Server and change permissions:
- 18. Make sure everything in the DailySet1 configuration is accessible by amandabackup:
- 19. Lastly add firewall permissions to allow for Amanda to communicate. Save and exit the file, and restart iptables:
vi /etc/motd
mkdir /root/amandacd /root/amanda
wget http://www.zmanda.com/downloads/community/Amanda/2.6.0p2/Redhat_Enterpri...
rpm -ivh amanda-backup_server-2.6.0p2-1.rhel5.i386.rpm
passwd -u -f amandabackup
mkdir /etc/amanda/DailySet1cd /etc/amanda/DailySet1
wget http://portfolio.itas.ca/~leeb/amanda/files/amanda.conf
org "Chris’s Backup"
mailto "chris.swanson@itas.ca
dumpuser "amandabackup"
dumpcycle 14 days
tapecycle 4 tapes
runtapes 1
tpchanger "chg-multi"
tapedev "file:/var2/amandadumps"
labelstr "^DailySet1[0-9][0-9]*$"define tapetype HARD-DISK {
comment "Save to disk"
length 4000 mbytes
}
holdingdisk hd1 {
comment "main holding disk"
directory "/dumps/amanda" # where the holding disk is
use -700 Mb # how much space can we use on it
# a non-positive value means:
# use all space but that value}
auth "bsdtcp"
touch /etc/amanda/DailySet1/tapelistvi /etc/amada/DailySet1/changer.conf
In changer.conf enter:
multieject 0
gravity 0
needeject 0
ejectdelay 0
statefile /var/lib/amanda/DailySet1/changer-status
firstslot 1
lastslot 4
slot 1 file:/var2/amandadumps/tape01
slot 2 file:/var2/amandadumps/tape02
slot 3 file:/var2/amandadumps/tape03
slot 4 file:/var2/amandadumps/tape04
mkdir -p /var2/amandadumps/tape01/data
mkdir -p /var2/amandadumps/tape02/data
mkdir -p /var2/amandadumps/tape03/data
mkdir -p /var2/amandadumps/tape05/data
chown -R amandabackup:disk /var2/amandadumps/chmod -R 770 /var2/amandadumps/
chown -R amandabackup:disk /etc/amanda/DailySet1/
su – amandabackupamlabel DailySet1 DailySet101 slot 1
amlabel DailySet1 DailySet102 slot 2
amlabel DailySet1 DailySet103 slot 3
amlabel DailySet1 DailySet104 slot 4
vi /etc/amanda/DailySet1/disklistServer.cswanson.info /myfiles comp-root-tar
Client.cswanson.info /myfiles comp-root-tar
vi /var/lib/amanda/.amandahostslocalhost root amindexd amidxtaped
localhost amandabackup amdump
localhost.localdomain root amindexd amidxtaped
localhost.localdomain amandabackup amdumpserver.cswanson.info amandabackup
server.cswanson.info root amindexd amidxtaped
server amandabackup
server root amindexd amidxtapedlocalhost amandabackup
localhost root amindexd amidxtaped
localhost.localdomain amandabackup
localhost.localdomain root amindexd amidxtaped
vi /etc/hosts# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost amserver
::1 localhost6.localdomain6 localhost6142.25.97.144 server.cswanson.info amserver amserver
142.25.97.152 client.cswanson.info amlinuxclient amlinuxclient
service sendmail startmkdir -p /dumps/amanda
chown -R amandabackup:disk /dumps
mkdir -p /etc/amanda/DailySet1/curinfo/server.cswanson.info/_myfiles
touch /etc/amanda/DailySet1/curinfo/server.cswanson.info/_myfiles/infomkdir -p /etc/amanda/DailySet1/curinfo/client.cswanson.info/_myfiles
touch /etc/amanda/DailySet1/curinfo/client.cswanson.info/_myfiles/infomkdir -p /etc/amanda/DailySet1/index/server.cswanson.info/_myfiles
touch /etc/amanda/DailySet1/index/server.cswanson.info/_myfiles/infomkdir -p /etc/amanda/DailySet1/index/client.cswanson.info/_myfiles
touch /etc/amanda/DailySet1/index/client.cswanson.info/_myfiles/info
mkdir /myfileschown –R amandabackup:disk /myfiles
chown -R amandabackup:disk /etc/amanda/DailySet1
vi /etc/sysconfig/iptables-A RH-Firewall-1-INPUT –m state –state NEW –m tcp –p tcp –dport 10080 –j ACCEPT
service iptables restart
Client – Linux:
- 1. Setup message of the day for SSH purposes, insert AMANDA CLIENT then save the file:
- 2. Make the directory you will wget the Amanda Client rpm package. Then run the rpm and unlock the amandabackup user the RPM created:
- 3. Edit the .amandahosts file so that all machines can communicate with each other. Make sure contents are similar (insert your own information):
- 4. Now edit the host file, contents should look like:
- 5. Create myfiles folder that will be used for backing up onto the server, change the permissions for the amandabackup user:
- 6. Lastly add firewall permissions to allow for Amanda to communicate. Save and exit the file, and restart iptables:
vi /etc/motd
mkdir /root/amandacd /root/amanda
http://www.zmanda.com/downloads/community/Amanda/2.6.0p2/Redhat_Enterpri...
rpm -ivh amanda-backup_client-2.6.0p2-1.rhel5.i386.rpm
passwd -u -f amandabackup
vi /var/lib/amanda/.amandahostslocalhost amandabackup amdump
localhost.localdomain amandabackup amdumpclient.cswanson.info amandabackup
client.cswanson.info root amindexd amidxtaped
client amandabackup
client root amindexd amidxtapedlocalhost amandabackup
localhost root amindexd amidxtaped
localhost.localdomain amandabackup
localhost.localdomain root amindexd amidxtapedserver.cswanson.info amandabackup amdump
vi /etc/hosts# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost amlinuxclient
::1 localhost6.localdomain6 localhost6142.25.97.144 server.cswanson.info amserver amserver
142.25.97.152 client.cswanson.info amlinuxclient amlinuxclient
mkdir /myfileschown –R amandabackup:disk /myfiles
vi /etc/sysconfig/iptables-A RH-Firewall-1-INPUT –m state –state NEW –m tcp –p tcp –dport 10080 –j ACCEPT
service iptables restart
Client - Windows:
- 1. Download and install the Amanda windows client here Zmanda Client.
- 2. Install and run package. Make sure you setup the proper server IP when installing.
- 3. Create a myfiles folder on your amandabackup user, save it to desktop.
- 4. Share the folder onto the network:
- Right-click, Properties
- Go to the Sharing tab and make sure all the middle box items are selected, call the network share ‘myfiles’.
- 5. We now have a Windows network share which we can mount inside the /myfiles folder on the already setup Linux Client. This way we can skip creating a separate Windows Client on the server which can be very troublesome:
- 6. Go back to the Linux client and navigate to /myfiles, now install and start samba:
- 7. Next, mount the share. Username, no password unless one was created and then the IP of the windows machine:
- 8. You should now be able to see the Windows files on the Linux client in myfiles:
yum install sambaservice smb start
mount -t cifs -o username=amandabackup //142.25.97.151/myfiles /myfiles
Alternate Windows Client Solution
- If you are wanting set this up so you do not have to mount/unmount to switch between the linux and windows files, you can create a dedicated linux virtual machine to handle all windows clients. Here, the mounted shares can all be setup in the same folder and windowsclient.cswanson.info can be selected when setting the host.
Part 3 - Backing up:
- 1. Hop on the Linux Server and login as amandabackup and run amcheck to see if any errors are present:
- 2. You should get no errors if it’s done correctly, you are now able to perform the backup:
- 3. Next exit the amandabackup user and run amrecover:
- 4. List the hosts, select host then, list the disk and select the disk:
- 5. The backup will now be present on the server, type ls command and you should see both the Windows and Linux client files:
su - amandabackupamcheck DailySet1
amdump DailySet1
ExitAmrecover
ListhostSethost client.cswason.info
Listdisk
Setdisk /myfiles
Part 4 - Summary:
If you have followed this guide step by step, the installation should have gone through with very minimal problems. Every machine and operating system may pose different issues, so it’s necessary to tackle these as they arise. Google is a very good place to start. You should now have a fully functional and very reliable backup solution, the fact that it is open source aids in it being one of the most used in it's field. I hope this guide was helpful and feel free to contact me with any questions you may have.
This article is adapted from the referenced website as for my own notes. Further additions will be made on my implementation.
References:
http://portfolio.itas.ca/~chris.swanson/?q=node/45
It's error here:
ReplyDeletesh-3.2$ amlabel DailySet1 DailySet101 slot 1
amlabel: could not load slot "1": chg-multi: /usr/adm/amanda/changer-status does not exist
Please help me!