I am going to setup Amanda backup into our office’s server to enable network backup to all of our servers located in different geographical area. The idea will be as below:

 

All servers are running on CentOS 6 64bit with iptables and SELINUX have been turned off.

Install Amanda Server

1. Install amanda packages using yum:

$ yum install -y amanda*

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

3. Create the core configuration file, amanda.conf:

$ vim /etc/amanda/ServerNetBackup/amanda.conf

And paste following line:

org "ServerNetBackup"                 # Organization name for reports
mailto "[email protected]"        # 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

1. Prepare the directory to store all backups:

$ mkdir -p /central_backup/ServerNetBackup/slots

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

3. Login as user amandabackup:

$ su - amandabackup

4. 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

5. We then need to label all slots:

$ for n in `seq 1 15` ; do amlabel ServerNetBackup ServerNetBackup-${n} slot ${n}; done

4. 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

1. 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.krispykream.net /home/webby/public_html   comp-user-tar
gogogo.my-server.org  /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.

2. Exit from amandabackup user and get back to root user:

$ exit

3. Enable amanda service in xinetd.d directory:

$ vim /etc/xinetd.d/amanda

And change following line from “yes” to “no”:

disable = no

4. Enable on boot and restart xinetd service:

$ chkconfig xinetd on
$ service xinetd restart

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

1. Login to the client’s server and install required package for Amanda using yum:

$ yum install -y amanda amanda-client

2. 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.servering.com amandabackup amdump
localhost amandabackup amdump
localhost.localdomain amandabackup amdump

3. Exit from user amandabackup and turn to root user:

$ exit

4. Enable amanda service in xinetd.d directory:

$ vim /etc/xinetd.d/amanda

And change following line from “yes” to “no”:

disable = no

5. Enable on boot and start the xinetd service:

$ chkconfig xinetd on
$ service xinetd start

6. Add an entry in /etc/hosts to define backup server IP by adding following line:

125.10.90.90      office.servering.com

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

1. 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.

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

3. As root user, reload the crond service to activate this job:

$ service crond reload

If the backup process completed, you should receive an email with backup report. In this email, it will tell you where is the backup location and process summary. I will continue on Amanda restoration process on the next post!

Update: I just updated this post on 5th Feb 2013 to use yum repository instead of package from zmanda.

27 Responses to CentOS: Install and Configure Amanda Backup Server

  1. Jose OmeraNo Gravatar says:

    I am stuck at step 2:
    2. Create the virual tape and label it. This is where the backup files will be stored. We will need to create 15 slots as per tapecycle keyword:

    It doesnt do anything! Kindly assist! @jpmuga

    • SecaGuyNo Gravatar says:

      That command should create a lot of directory named slot1 slot2 …. slot15 under /central_backup/ServerNetBackup/slots. Have you checked if the directory exist? What is the error that you see?

  2. SherlyNo Gravatar says:

    Hi,, I have a problem in restoring the data.
    I have labelled my vtapes and it showed well when I used “amtape show” command.
    However, when I used amrestore command, the output showed “ERROR: Error loading device header — unlabeled volume”.
    Could you please give me any advice?
    Thanks in advance.

    • SecaGuyNo Gravatar says:

      Are you having leading zero on the slot number? You may refer to this page for more info regards to this error. On Zmanda wiki also stated :
      “Do not add a leading zero to the slot number, as chg-disk would not understand that.”

  3. Mac MahaNo Gravatar says:

    I am having this issues when I run amcheck command.

    amcheck: error while loading shared libraries: libamserver-3.3.2.so: cannot open shared object file: No such file or directory

    what possibly have went wrong? can you help. I am using desktopbackup instead of ServerNetBackup. but I am sure it has nothing to do in here.
    another issue I think could be the permissions on the /central_backup directory. I was not able to create this directory from amandabackup user login. Is this going to cause trouble. But I chown the directory with recurssive and force option from root user.
    your help is truly appreciated.
    thanks in advance.
    Mac Maha.

    • SecaGuyNo Gravatar says:

      The naming should not be the problem. Try to locate whether libamserver-3.3.2.so is exist or not in your server. If exist, execute following command:
      ldconfig

  4. TomNo Gravatar says:

    I do not understand why I need “tapecycle 15 tapes”. I will do backup on hard drive. Can I setup the Amanda for only 1 tape (harddrive)? I mean:
    dumpcycle 1 week
    runspercycle 7
    tapecycle 1 tape
    ???

    What is advantage of using multiple tapes? Is there any?

  5. Jose OmeraNo Gravatar says:

    Hey, thanks for the tutorial, now in my environment CENTOS is the server but the servers I am backing up are mostly FreeBSD and Ubuntu. 1 question, when am creating the disklist file in the place of dumptype for all the servers can i just put “root-tar”?

    thanks
    twitter.com/jpmuga

  6. Thorsten BertramNo Gravatar says:

    There is a small mistake in the client configuration section: the file which defines the name of the amanda server must be named
    .amandahosts
    (there is an s at the end).
    Specifying the wrong name here would lead to an error like this:
    user amandabackup from w.x.y.z. is not allowed to execute the service noop: Please add the line ...

  7. Jake GNo Gravatar says:

    Great blog!

    OK now how do we restore after a successful backup?
    Amanda`s howtos are like reading a foreign language for me. Thank you!

    Also why is your install method not the YUM install way like everyone else?

    Thanks again!

  8. Rajan MaharjanNo Gravatar says:

    I am getting error after

    #for n in `seq 1 15` ; do amlabel ServerNetBackup ServerNetBackup-${n} slot ${n}; done

    The error:
    Can’t load tapelist file (/etc/amanda/testBackup/tapelist)

    Please help!

    • SecaGuyNo Gravatar says:

      You should use the same name of your project in the command depending on your configuration file. Your command should be like this:
      for n in `seq 1 15` ; do amlabel testBackup testBackup-${n} slot ${n}; done

      Anyway, I have updated the post with a better/simple way. I received some complaint that the older post is misleading some how.

  9. jasNo Gravatar says:

    Everything is fine with the server but when i label the slots it shows the error

    Reading label…
    Found an empty tape.
    Writing label ‘ServerNetBackup-1′…
    Error writing label: Can’t open file //central_backup/ServerNetBackup/slots/data//00000.ServerNetBackup-1: Permission denied

    if i run with sudo it shows this error:
    sudo: Reading: command not found
    -bash-4.1$ sudo Reading label…
    sudo: Reading: command not found
    -bash-4.1$ Found an empty tape.
    -bash: Found: command not found
    -bash-4.1$ Writing label ‘ServerNetBackup-1′…
    -bash: Writing: command not found
    -bash-4.1$ Error writing label: Can’t open file //central_backup/ServerNetBackup/slots/data//00000.ServerNetBackup-1: Permission denied
    >

    Actually i had changed the amanda.conf [tape size to 10000] because i have only 500 gb. kindly resolve this issue.

    • SecaGuyNo Gravatar says:

      Have you assign correct ownership to the directory?
      chown amandabackup.disk /central_backup/ServerNetBackup -Rf

      You dont need to use sudo if you run the command as amandabackup user. Anyway, I have updated the post with a better/simple way. I received some complaint that the older post is misleading some how.

  10. rachidNo Gravatar says:

    is that this configuration works if I put ipv6 address?

  11. Mahboob AliNo Gravatar says:

    I am facing some problem when i check finally using ‘amcheck ServerNetBackup’ command then like-
    ============================================
    -bash-4.1$ amcheck ServerNetBackup
    Amanda Tape Server Host Check
    —————————–
    slot 15:read label `ServerNetBackup-15′, date `X’.
    NOTE: skipping tape-writable test
    Tape ServerNetBackup-15 label ok
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/bx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/bx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/cx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/cx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    Server check took 1.019 seconds

    Amanda Backup Client Hosts Check
    ——————————–
    WARNING: bx.husenitravels.com: selfcheck request failed: timeout waiting for ACK
    WARNING: cx.husenitravels.com: selfcheck request failed: timeout waiting for ACK
    Client check: 2 hosts checked in 30.038 seconds. 2 problems found.
    ======================================

    Please provide me solution of this problem.

  12. Mahboob AliNo Gravatar says:

    I am facing the following error while i check using ‘amcheck ServerNetBackup’ command.

    ============================================

    -bash-4.1$ amcheck ServerNetBackup
    Amanda Tape Server Host Check
    —————————–
    slot 15:read label `ServerNetBackup-15′, date `X’.
    NOTE: skipping tape-writable test
    Tape ServerNetBackup-15 label ok
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/bx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/bx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/cx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/cx.husenitravels.com does not exist
    NOTE: it will be created on the next run.
    Server check took 1.019 seconds

    Amanda Backup Client Hosts Check
    ——————————–
    WARNING: bx.husenitravels.com: selfcheck request failed: timeout waiting for ACK
    WARNING: cx.husenitravels.com: selfcheck request failed: timeout waiting for ACK
    Client check: 2 hosts checked in 30.038 seconds. 2 problems found.
    ======================================

    Please provide me solution.Thanks

  13. UmbertoNo Gravatar says:

    hi,
    thanks for this how to.
    The amcheck gives me this error:

    -bash-4.1$ amcheck ServerNetBackup
    Amanda Tape Server Host Check
    —————————–
    slot 7:Found an empty or non-amanda tape.
    slot 8:Found an empty or non-amanda tape.
    slot 9:Found an empty or non-amanda tape.
    slot 10:Found an empty or non-amanda tape.
    slot 11:Found an empty or non-amanda tape.
    slot 12:Found an empty or non-amanda tape.
    slot 13:Found an empty or non-amanda tape.
    slot 14:Found an empty or non-amanda tape.
    slot 15:Found an empty or non-amanda tape.
    slot 1:Found an empty or non-amanda tape.
    slot 2:Found an empty or non-amanda tape.
    slot 3:Found an empty or non-amanda tape.
    slot 4:Found an empty or non-amanda tape.
    slot 5:Found an empty or non-amanda tape.
    slot 6:Found an empty or non-amanda tape.
    (expecting a new tape)
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/server.eclettica.it does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/server.eclettica.it does not exist
    NOTE: it will be created on the next run.
    Server check took 4.190 seconds

    Amanda Backup Client Hosts Check
    ——————————–
    Client check: 1 host checked in 3.486 seconds. 0 problems found.

    (brought to you by Amanda 2.6.1p2)

    suggestions?

    tnx

  14. Tim McManusNo Gravatar says:

    I run with both iptables and SELINUX on, and there are three things you need to do to get Amanda to work properly.

    On the server the following line needs to be added to /etc/sysconfig/iptables

    -A INPUT -m state –state NEW -m tcp -p tcp –dport 50000:50100 -j ACCEPT

    On the client computers you need to add this line to iptables:

    -A INPUT -m state –state NEW -m udp -p udp –dport 10080 -j ACCEPT

    On both the client and the server you need to enter this command:

    modprobe ip_conntrack_amanda

    And then you need to change /etc/sysconfig/iptables-config with the following option:

    IPTABLES_MODULES=”ip_conntrack_amanda”

    After making these changes you need to reload iptables on both the server and the clients using this command:

    service iptables restart

    After making all of those changes you should be able to run Amanda backups successfully with iptables running.

  15. marcosNo Gravatar says:

    hi, the only doubt is , where is the place for /central_backup/, because i didn’t find this folder in my arquiteture, can you help me with this? thanks

  16. MaheshNo Gravatar says:

    Hi,

    I am receiving error “Load tape ServerNetBackup-15 now
    Continue [?/Y/n/d]? Y
    Not an amanda tape: Can’t open tape device changer: No such file or directory” while trying to restore. Please help.

    Thanks
    Mahesh

  17. BrahamNo Gravatar says:

    getting this error

    amcheck ServerNetBackup
    Amanda Tape Server Host Check
    —————————–
    ERROR: program /usr/lib/amanda/planner: not executable
    ERROR: program /usr/lib/amanda/dumper: not executable
    ERROR: program /usr/sbin/amcheck: not setuid-root
    slot 15: volume ‘ServerNetBackup-15′
    Will write to volume ‘ServerNetBackup-15′ in slot 15.
    NOTE: skipping tape-writable test
    NOTE: host info dir /etc/amanda/ServerNetBackup/curinfo/192.168.110.221 does not exist
    NOTE: it will be created on the next run.
    NOTE: index dir /etc/amanda/ServerNetBackup/index/192.168.110.221 does not exist
    NOTE: it will be created on the next run.
    Server check took 0.670 seconds

    Amanda Backup Client Hosts Check
    ——————————–
    WARNING: 192.168.110.221: selfcheck request failed: Permission denied
    Client check: 1 host checked in 10.015 seconds. 1 problem found.

    (brought to you by Amanda 3.3.3)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>