Friday 27 August 2010

Amanda Backup Installation Guide

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.


    1. As root Type setup in a terminal and hit ENTER.

    2. Choose Network Configuration.

    3. Select the eth0 interface.

    4. Configure your IP settings.


    5. 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:


  • vi /etc/motd


  • 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:


  • mkdir /root/amanda


    cd /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


  • 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:


  • mkdir /etc/amanda/DailySet1


    cd /etc/amanda/DailySet1


    wget http://portfolio.itas.ca/~leeb/amanda/files/amanda.conf


  • 5. Open Amanda.conf (vi Amanda.conf) and make sure it matches the following lines of code (insert your own information):


  • 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


    }


  • 6. In the dumptype global block, add:


  • auth "bsdtcp"


  • 7. We will now continue setting up the tapes for backing up. Create the tapelist file and input this information:


  • touch /etc/amanda/DailySet1/tapelist


    vi /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


  • 8. Now have to create those slot folders on the server machine:


  • mkdir -p /var2/amandadumps/tape01/data

    mkdir -p /var2/amandadumps/tape02/data

    mkdir -p /var2/amandadumps/tape03/data

    mkdir -p /var2/amandadumps/tape05/data


  • 9. Change permissions so the amandabackup user can read and write to the tapes:



  • chown -R amandabackup:disk /var2/amandadumps/


    chmod -R 770 /var2/amandadumps/


    chown -R amandabackup:disk /etc/amanda/DailySet1/


  • 10. Next, switch to the amandabackup user, we will now label the tapes:


  • su – amandabackup


    amlabel DailySet1 DailySet101 slot 1

    amlabel DailySet1 DailySet102 slot 2

    amlabel DailySet1 DailySet103 slot 3


    amlabel DailySet1 DailySet104 slot 4


  • 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):


  • vi /etc/amanda/DailySet1/disklist


    Server.cswanson.info /myfiles comp-root-tar


    Client.cswanson.info /myfiles comp-root-tar


  • 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:



  • vi /var/lib/amanda/.amandahosts


    localhost root amindexd amidxtaped

    localhost amandabackup amdump

    localhost.localdomain root amindexd amidxtaped

    localhost.localdomain amandabackup amdump


    server.cswanson.info amandabackup

    server.cswanson.info root amindexd amidxtaped

    server amandabackup

    server root amindexd amidxtaped



    localhost amandabackup

    localhost root amindexd amidxtaped

    localhost.localdomain amandabackup

    localhost.localdomain root amindexd amidxtaped


  • 14. Now we must edit the host file on the server. Make sure the following is present:


  • 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 localhost6


    142.25.97.144 server.cswanson.info amserver amserver

    142.25.97.152 client.cswanson.info amlinuxclient amlinuxclient


  • 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:


  • service sendmail start


    mkdir -p /dumps/amanda


    chown -R amandabackup:disk /dumps



  • 16. Create these directories and files, amcheck will bring up errors if they are not present:


  • mkdir -p /etc/amanda/DailySet1/curinfo/server.cswanson.info/_myfiles

    touch /etc/amanda/DailySet1/curinfo/server.cswanson.info/_myfiles/info


    mkdir -p /etc/amanda/DailySet1/curinfo/client.cswanson.info/_myfiles

    touch /etc/amanda/DailySet1/curinfo/client.cswanson.info/_myfiles/info


    mkdir -p /etc/amanda/DailySet1/index/server.cswanson.info/_myfiles

    touch /etc/amanda/DailySet1/index/server.cswanson.info/_myfiles/info


    mkdir -p /etc/amanda/DailySet1/index/client.cswanson.info/_myfiles


    touch /etc/amanda/DailySet1/index/client.cswanson.info/_myfiles/info


  • 17. Create the myfiles directory for the Server and change permissions:


  • mkdir /myfiles


    chown –R amandabackup:disk /myfiles


  • 18. Make sure everything in the DailySet1 configuration is accessible by amandabackup:


  • chown -R amandabackup:disk /etc/amanda/DailySet1


  • 19. Lastly add firewall permissions to allow for Amanda to communicate. Save and exit the file, and restart iptables:



  • 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:


  • vi /etc/motd


  • 2. Make the directory you will wget the Amanda Client rpm package. Then run the rpm and unlock the amandabackup user the RPM created:



  • mkdir /root/amanda


    cd /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


  • 3. Edit the .amandahosts file so that all machines can communicate with each other. Make sure contents are similar (insert your own information):


  • vi /var/lib/amanda/.amandahosts


    localhost amandabackup amdump


    localhost.localdomain amandabackup amdump


    client.cswanson.info amandabackup

    client.cswanson.info root amindexd amidxtaped

    client amandabackup

    client root amindexd amidxtaped


    localhost amandabackup

    localhost root amindexd amidxtaped

    localhost.localdomain amandabackup

    localhost.localdomain root amindexd amidxtaped



    server.cswanson.info amandabackup amdump


  • 4. Now edit the host file, contents should look like:


  • 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 localhost6


    142.25.97.144 server.cswanson.info amserver amserver


    142.25.97.152 client.cswanson.info amlinuxclient amlinuxclient


  • 5. Create myfiles folder that will be used for backing up onto the server, change the permissions for the amandabackup user:


  • mkdir /myfiles


    chown –R amandabackup:disk /myfiles


  • 6. Lastly add firewall permissions to allow for Amanda to communicate. Save and exit the file, and restart iptables:


  • 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:


      1. Right-click, Properties

      2. 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:


  • yum install samba


    service smb start


  • 7. Next, mount the share. Username, no password unless one was created and then the IP of the windows machine:


  • mount -t cifs -o username=amandabackup //142.25.97.151/myfiles /myfiles


  • 8. You should now be able to see the Windows files on the Linux client in 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:



  • su - amandabackup


    amcheck DailySet1


  • 2. You should get no errors if it’s done correctly, you are now able to perform the backup:


  • amdump DailySet1


  • 3. Next exit the amandabackup user and run amrecover:


  • Exit


    Amrecover


  • 4. List the hosts, select host then, list the disk and select the disk:



  • Listhost


    Sethost client.cswason.info


    Listdisk


    Setdisk /myfiles


  • 5. The backup will now be present on the server, type ls command and you should see both the Windows and Linux client files:


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






Top