Introduction
Amanda is the world's most popular Open Source Backup and Archiving software. Amanda allows System Administrators to set up a single
backup server to back up multiple hosts to a tape- or disk- or cloud-based storage system. Amanda uses native archival tools and can back
up a large number of workstations and servers running various versions of Linux, Unix (including OpenSolaris), Mac OS X or Microsoft
Windows operating systems (Native Win32 Client and Samba).
This documentation will cover a backup setup of Amanda on a Linux Server, Linux Client, and Windows Client. I am using the following
Virtual Machines:
- amserver.jgaetz.ca - 142.25.97.110 - the Linux Server
- amlinuxclient.jgaetz.ca - 142.25.97.181 - the Linux Client
- amwinclient.jgaetz.ca - 142.25.97.115 - the Windows Client
Preparing the machines
For this guide, I'll be using CentOS 5.4 as the Linux Client and server and Windows Vista for the Windows Client. Each of the
Clients, and the server, are running on a 32-Bit architecture.
Linux Server
- Install CentOS 5
- Apply all available updates
- Set a static IP for the machine
- Type setup in a terminal (while logged in as root) and hit ENTER.
- Choose Network Configuration
- Select the eth0 interface
- Configure your IP settings
- Static IP: 142.25.97.110
- Netmask: 255.255.255.0
- Default Gateway IP: 142.25.97.254
- Run: service network restart to apply the changes
Linux Client
- Install CentOS 5
- Apply all available updates
- Set a static IP for the machine
- Type setup in a terminal (while logged in as root) and hit ENTER.
- Choose Network Configuration
- Select the eth0 interface
- Configure your IP settings
- Static IP: 142.25.97.181
- Netmask: 255.255.255.0
- Default Gateway IP: 142.25.97.254
- Run: service network restart to apply the changes
Windows Vista Client
- Install Windows Vista which service pack does not matter
- Apply all available updates
- Set a static IP for the machine
- Navigate to your Network Connections (Control Panel -> Network and Internet -> Network Connections)
- Right Click on the "Local Area Connection" Icon and Click Properties
- If the UAC (User Account Control) promps you click Continue
- Once the Local Area Properties Window Opens, Click on Internet Protocol Version 4 (TCP/IPv4) and Click Properties
- Configure your IP settings
- Static IP: 142.25.97.115
- Netmask: 255.255.255.0
- Default Gateway IP: 142.25.97.254
- Preferred DNS server: 142.25.97.254
- Alternate DNS server: 142.25.115.12
Your IP settings should have automaticaly changed, but to be safe open up your Command Promp Under Administrater and run ipconfig
/release and once thats done run ipconfig /renew and to check if your IP Settings have been change run ipconfig /all and look
under Ethernet adapter Local Area Connection:
Installing and Configuring Amanda
Linux Server
- Login is as root.
- Make a directory to store the Amanda_RPM Run: mkdir /root/amanda_rpm
- Navigate to the directory you just created Run: cd /root/amanda_rpm
- Download the Amanda Server Run: wget http://www.zmanda.com/downloads/community/Amanda/2.6.0p2/Redhat_Enterprise_5.0/amanda-backup_server-2.6.0p2-1.rhel5.i386.rpm
- Install the Amanda Server Run: rpm -ivh amanda-backup_server-2.6.0p2-1.rhel5.i386.rpm
- Now we'll need to unlock the amandabackup user the RPM creates for us Run: passwd -u -f amandabackup
- Now to Create a configuration folder for Amanda, the most common name used is DailySet1 Run: mkdir /etc/amanda/DailySet1
- Navigate to the directory you just created Run: cd /etc/amanda/DailySet1
- Download the amanda.conf file Run: wget http://portfolio.itas.ca/~leeb/amanda/files/amanda.conf
- Open the file using vi Run: vi amanda.conf
- Once in amanda.conf, Make the following changes:
- org "John's Backup"
- mailto "john.gaetz@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]*$" (I got an error with this line so I change it to "DailySet1")
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
}
- In the dumptype global block, add: auth "bsdtcp"
- Save the file and exit out of vi
We've set the mail address where we'll receive e-mails from Amanda, the user Amanda will run as, specified that
we'll be using 4 tapes, and specified a path where the tapes will reside. In addition, a new HARD-DISK tapetype has been added with
a size of about 4GB.
- Once Amanda.conf is configured, We'll need to setup the tapes. Create the tapelist file Run: touch /etc/amanda/DailySet1/tapelist
- Setup the changer.conf file Run: vi /etc/amada/DailySet1/changer.conf
- Once in the changer.conf file make the following changes:
- 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
- Save the file and exit out of vi
- Now we need to create those slot folders on the server machine
- Run the Following commands:
- mkdir -p /var2/amandadumps/tape01/data
- mkdir -p /var2/amandadumps/tape02/data
- mkdir -p /var2/amandadumps/tape03/data
- mkdir -p /var2/amandadumps/tape05/data
- Make sure the amandabackup user can actually read and write to the tapes
- Run the Follow commands:
- chown -R amandabackup:disk /var2/amandadumps/
- chmod -R 770 /var2/amandadumps/
- chown -R amandabackup:disk /etc/amanda/DailySet1/
Now we need to label the tapes (in the manner specified in the labelstr line in Amanda.conf). Labeling needs to be done as the
amandabackup user.
- Switch over to the amandabackup user Run: su - amandabackup
- Run The following Commands:
- amlabel DailySet1 DailySet101 slot 1
- amlabel DailySet1 DailySet102 slot 2
- amlabel DailySet1 DailySet103 slot 3
- amlabel DailySet1 DailySet104 slot 4
Create a disklist file to specify which hosts will be backed up, and which folders to backup on those hosts
Run: vi /etc/amanda/DailySet1/disklist
- Once in the disklist, Make the Following Changes:
- amserver.jgaetz.ca /myfiles comp-root-tar
- amlinuxclient.jgaetz.ca /myfiles comp-root-tar
- Save and exit out of vi
- Return to the root user Run: exit
- Now edit the .amandahosts file to make sure all of the hosts can communicate with each other Run: vi /var/lib/amanda/.amandahosts
- Once in the .amandahosts file, Make the following Changes:
- localhost root amindexd amidxtaped
- localhost amandabackup amdump
- localhost.localdomain root amindexd amidxtaped
- localhost.localdomain amandabackup amdump
- amserver.jgaetz.ca amandabackup
- amserver.jgaetz.ca root amindexd amidxtaped
- amserver amandabackup
- amserver root amindexd amidxtaped
- amlinuxclient amandabackup
- amlinuxclient root amindexd amidxtaped
- amlinuxclient.jgaetz.ca amandabackup
- amlinuxclient.jgaetz.ca root amindexd amidxtaped
- Save and exit out of vi
- Now to edit the host file to make sure the hosts or communicating properly Run: vi /etc/hosts
- Once in the hosts file, Make the following Changes:
- # 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 localhost6
- 142.25.97.110 amserver.jgaetz.ca amserver amserver
- 142.25.97.181 amlinuxclient.jgaetz.ca amlinuxclient amlinuxclient
- Save and exit out of vi
- Now to make sure that Amanda can sendmail, start the sendmail service Run: service sendmail start
- The directory where the holding disk will reside will also need to be created and given proper ownership
- Run the following Commands:
- mkdir -p /dumps/amanda
- chown -R amandabackup:disk /dumps
- The following files and pathes will need to exist in order to stop amcheck from spitting out errors about them.
- Run the following Commands:
- mkdir -p /etc/amanda/DailySet1/curinfo/amserver.jgaetz.ca/_myfiles
- touch /etc/amanda/DailySet1/curinfo/amserver.jgaetz.ca/_myfiles/info
- mkdir -p /etc/amanda/DailySet1/curinfo/amlinuxclient.jgaetz.ca/_myfiles
- touch /etc/amanda/DailySet1/curinfo/amlinuxclient.jgaetz.ca/_myfiles/info
- mkdir -p /etc/amanda/DailySet1/index/amserver.jgaetz.ca/_myfiles
- touch /etc/amanda/DailySet1/index/amserver.jgaetz.ca/_myfiles/info
- mkdir -p /etc/amanda/DailySet1/index/amlinuxclient.jgaetz.ca/_myfiles
- touch /etc/amanda/DailySet1/index/amlinuxclient.jgaetz.ca/_myfiles/info
- Create the myfiles directory that will be backed up on the server Run: mkdir /myfiles
- Make the amandabackup user the owner of the /myfiles directory Run: chown -R amandabackup:disk /myfiles
- Make sure everything in the DailySet1 configuration is owned by amandabackup Run: chown -R amandabackup:disk /etc/amanda/DailySet1
Linux Client
- Login is as root.
- Make a directory to store the Amanda_RPM Run: mkdir /root/amanda_rpm
- Navigate to the directory you just created Run: cd /root/amanda_rpm
- Download the Amanda Client Run: wget http://www.zmanda.com/downloads/community/Amanda/2.6.0p2/Redhat_Enterprise_5.0/amanda-backup_client-2.6.0p2-1.rhel5.i386.rpm
- Install the Amanda Client Run: rpm -ivh amanda-backup_client-2.6.0p2-1.rhel5.i386.rpm
- Now we'll need to unlock the amandabackup user the RPM creates for us Run: passwd -u -f amandabackup
- Now we need to edit the .amandahosts file to make sure all hosts can communicate with each other Run: vi /var/lib/amanda/.amandahosts
- Once in the .amandahosts file, Make the following changes
- localhost amandabackup amdump
- localhost.localdomain amandabackup amdump
- amlinuxclient.jgaetz.ca amandabackup
- amlinuxclient.jgaetz.ca root amindexd amidxtaped
- amlinuxclient amandabackup
- amlinuxclient root amindexd amidxtaped
- localhost amandabackup
- localhost root amindexd amidxtaped
- localhost.localdomain amandabackup
- localhost.localdomain root amindexd amidxtaped
- amserver.jgaetz.ca amandabackup amdump
- Now Save and Exit Vi
- Now edit the amanda-client file Run: vi /etc/amanda/amanda-client
- Once in the amanda-client file Make the following changes
- index_server "142.25.97.110"
- tape_server "142.25.97.110"
- Now edit the hosts file Run: vi /etc/hosts
- Once in the hosts file, Make the following changes
- # 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 localhost6
- 142.25.97.110 amserver.jgaetz.ca amserver amserver
- 142.25.97.181 amlinuxclient.jgaetz.ca amlinuxclient amlinuxclient
- Now Save and Exit vi
- NowCreate the myfiles directory that will be backed up on the client Run: mkdir /myfiles
- Now give ownership of the myfiles directory to amandabackup Run: chown -R amandabackup:disk /myfiles
Windows Client
- Lets start by creating a myfiles directory in your c:\ directory
- Create an amandabackup user the machine and put the password as amanda
- Go to the c:\myfiles Properties
- Go to the Sharing tab
- Click Advanced Sharing
- Check the "Share this folder checkbox"
- Click the Permissions button
- Remove the Everyone user
- Add the amandabackup user and give it full permissions
We just made a windows share that will mount to a win_share folder in the myfiles directory on the Linux Client.
- Go back on your Linux Client and login as root.
- Make a folder for your Windows Share Run: mkdir /myfiles/win_share
- If you don't have samba install Run: yum install samba
- Now start samba Run: service smb start
- Now mount the share to the win_share folder Run: mount -t cifs -o username=amandabackup,password=amanda //amwinclient.jgaetz.ca/myfiles /myfiles/win_share
- Now anything in the myfiles folder on the Windows Client will show up in the win_share folder on the Linux Client
Backing up
- Log into your Linux server as the amandabackup Run: su - amandabackup
- Check to see if your Amanda Server is configured properly Run: amcheck DailySet1
- If everything was done right you should not get any errors
- Now it's time to run the backup Run: amdump DailySet1
Recovering Files
- Login to your Linux client as root
- Navigate to the directory you want the files backed up to in this case its /myfiles Run: cd /myfiles
- Run amrecover
- List the available hosts Run: listhost
- Set your host Run: sethost amlinuxserver.jgaetz.ca
- List the available Disks Run: listdisk
- Set the Disk Run: setdisk /myfiles
- Check what files are available to recover Run: ls
- Add the files you want to recover to the extraction list Run: Add File_Name_goes_here
- Extract the files Run: extract
All of the files you wanted to recover from your server should now be the /myfiles directory on the Linux Client.
REFERENCE