Quick start (old): Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
(double text? part1)
(deprecate)
 
(137 intermediate revisions by 16 users not shown)
Line 1: Line 1:
== Installation ==
{{Deprecated|This 'Quick Start' is neither quick nor up to date.  See [[Getting Started With Amanda]] instead.}}
== Installing Amanda ==


Amanda can be installed from pre-built RPMs or built from source tree. Please see [[installation]]
Use any of the following methods to install Amanda:
chapter for information on the installation procedure.


NOTE: If you install using pre-built RPMs, some of the configuration steps are already performed as rpm post-installation procedure.
* Run one of the installation packages available from Zmanda or elsewhere:
** The [http://www.zmanda.com/download-amanda.php Zmanda downloads] site includes installation packages for many platforms. If you are using packages from Zmanda downloads page, go to the [http://network.zmanda.com/redirect.php?/pdf/Amanda_Community_Setup_15_minutes.pdf Zmanda packages 15 minute example]. If you are using Windows client, refer to the [[Windows client]] page for installation instructions.
** Many Linux and BSD distributions include Amanda packages, as does the Sun freeware site. See your distribution's package manager docuumentation for details.


See for a list of configuration steps already performed in the page [[Amanda RPMs from Zmanda downloads page]].
* Compile Amanda from the source. Obtain the tarball from one of the sites mentioned above, or from the [http://sourceforge.net/svn/?group_id=120 subversion tree]. See [[Amanda's Requirements]], [[Installation/Installing Amanda Source]], and [[Development Dependencies]].


You can install AMANDA from pre-built RPMs or can build AMANDA using the source tree. Refer [[installation]]
Whether you are installing Amanda packages or compiling from the source, please see the [[installation]] page for detailed instructions.
chapter, for information on the installation procedure of AMANDA.


In case, you install AMANDA using pre-built RPMs, some of the configuration steps are performed as RPM post-installation procedure. Refer [[Amanda RPMs from Zmanda downloads page]], for a list of configuration steps that are performed as RPM post-installation procedure.
Note: when installing from RPM, debian or other packages, many of the steps below are already done for you. Unfortunately we can't advise you on which steps were done for you. We suggest you follow the instructions below to learn what the package management software did. You can then do the rest manually.


== Backup server configuration ==
The pre-built Amanda packages make some configuration assumptions regarding the location of log files, '''.conf''' files, binaries, etc. Packages from the Zmanda downloads page perform these configuration steps at the end of the installation procedure.  Please see [[Amanda packages from Zmanda downloads page]] for a list of configuration steps that are performed.


===Create a backup user on the server===
==Collecting configuration information==


Amanda runs as a normal user, but must be in the same group that has read access to the raw disk devicesFrequent choices are: amanda, backup, amandabackup, operator.
To set up Amanda backups, you will need to know the configuration parameters of the Amanda installation you are setting up. If you built Amanda from the source tree, these are in the form of configure script parametersIf you have installed binary packages from another source, use the '''[[amadmin]]''' command piped to '''grep''' to determine the Amanda parameters. These commands must be run as superuser (root). Note that due to variation in third party packages, the values you find may vary from the defaults noted here.
Do not use the root user to run the Amanda suite.


If you install Amanda using pre-built RPMs from Zmanda, a user "amandabackup" gets created, and is added to the group "disk" with the home directory "/var/lib/amanda". You can assign a password to the "amandabackup" user for unlocking the account.
; "CLIENT_LOGIN" : Amanda user. This user id is used by the backup process. Example: '''amandabackup''', '''amanda'''
On the other hand if you build Amanda using the source tree, you can create the user using the command:
# '''/usr/sbin/amadmin xx version | grep CLIENT_LOGIN'''


  # useradd -u amanda -g disk -d /home/amanda -s /bin/bash -c ...
; "CONFIG_DIR" : Amanda configuration directory. All Amanda configurations in the Amanda server are stored here. Default: '''/etc/amanda''' (though in some packages you may find /usr/local/etc/amanda).
  # '''/usr/sbin/amadmin xx version | grep CONFIG_DIR
'''
; "AMANDA_DBGDIR" : Amanda directory for debug log files. Default: '''/tmp/amanda'''
# '''/usr/sbin/amadmin xx version | grep AMANDA_DBGDIR'''


If you are running NIS (aka YP), you can add the Amanda user to your NIS services
; "libexecdir" : Amanda directory where executables started by '''amandad''' process are installed. Default: '''/var/lib/amanda'''
database. Consult your NIS documentation for details.
# '''/usr/sbin/amadmin xx version | grep libexecdir'''


Make sure the Amanda programs are in the PATH of the user amanda.
; "listed_incr_dir" :  This directory in Amanda client is used by the [[Gnutar|GNU '''tar''']] command. This directory only used if GNUTAR is configured as a backup program in the '''dumptype''' section of {{man|5|amanda.conf}}. Default: '''/var/lib/amanda/gnutar-lists'''
If the programs reside in e.g. /usr/local/sbin, add in the file '''.profile''', and/or '''.bashrc''':
# '''/usr/sbin/amadmin xx version | grep listed_incr_dir'''


# Prepend these directories to PATH if needed
== Configuring the backup server ==
for d in /usr/local/bin /usr/local/sbin
do
    case :$PATH: in
        *:$d:*) : ;;
        *)  PATH=$d:$PATH ;;
    esac
done


===Invent a name for the configuration===
===Create an Amanda user on the server===


Each configuration in Amanda has a dedicated name.
Amanda runs as a normal user, but must be in the same group that has read access to the raw disk devices. Do not run Amanda as the root user. The Amanda user name is defined by the CLIENT_LOGIN parameter from the [[#Collecting configuration information|Collecting configuration information]] page.  
Think of it as a label for a set of configuration files that describe a certain set of disks/partitions/directories to dump and the related targets (tapes/directories) the data should be dumped to.
Most Amanda commands need that configuration name as the first argument.
You may have many configurations.
Frequent names are: "daily" for normal daily backups, "archive" for offsite stored achive tapes having only full dumps, "test" for your test environment.
Some linux-distributions ship Amanda with a default configuration named "DailySet1".


Find out where the CONFIG_DIR is:
It is possible to change the name of the user used during Amanda compilation. Amanda packages from different distributions use different user names and home directories for Amanda.


$ amadmin x version | grep CONFIG_DIR
For example: If you install Amanda using pre-built packages from the [http://www.zmanda.com/download-amanda.php Zmanda downloads page], a user '''amandabackup''' is created, and is added to the group ''disk'' with the home directory '''/var/lib/amanda'''.
CONFIG_DIR=/usr/local/etc/amanda


and create a directory with the chosen configuration name inside it:
You must assign a password to the '''amandabackup''' user in order to unlock the account. E.g. as root:


  $ cd /usr/local/etc/amanda
  # '''passwd amandabackup'''
$ mkdir daily


You need to provide a unique name for each configuration in AMANDA. Commonly used configuration names are: "daily" -- for normal daily backups, "archive" -- for offsite stored archive tapes having only full dumps, and "test" -- for test environment. Some linux-distributions ship AMANDA with a default configuration named, "DailySet1". The configuration name works as a label for a set of configuration files that describe the source and target for taking the backup. The configuration files specifies the source, such as disks, partitions, or directories that needs to backup and the target, such as tapes or directories where the data should be backed up.
Alternatively, if you built Amanda using the source tree, create the user by running the '''useradd''' command. For example:


You can create a directory under CONFIG_DIR, for storing the configuration files. This directory works as the configuration name (label) for the configuration files. To find the location of CONFIG_DIR:
# '''useradd -u <uid> -g disk -d /var/lib/amanda -s /bin/bash -c''' ... '''amandabackup'''


$ amadmin x version | grep CONFIG_DIR
If you are running Network Information Services (NIS, a.k.a. Yellow Pages or YP), you can add the Amanda user to your NIS database. Consult your NIS documentation for details.
CONFIG_DIR=/usr/local/etc/amanda


To create a configuration name:
The Amanda user's home directory must be owned by the amanda user. For example, assuming the gnu chown and that the Amanda user's name is ''backup'':


  $ cd /usr/local/etc/amanda
  # '''chown backup:backup $(grep backup /etc/passwd | cut -d: -f6)'''
$ mkdir daily


'''Note''': Most AMANDA commands need the configuration name as the first argument.
The Amanda programs should be accessible to the Amanda user (in other words, add them to that user's PATH). For example, if the programs reside in '''/usr/local/sbin''' directory, set the PATH variable in '''.profile''', and/or '''.bashrc''' in the Amanda user's home directory. The following script excerpt shows how to set PATH variable in a shell script:


===Modify amanda.conf===
'''# Prepend these directories to PATH if needed'''
'''for d in /usr/local/bin /usr/local/sbin'''
'''do'''
    ''' case :$PATH: in'''
        ''' *:$d:*) : ;;'''
        '''*)  PATH=$d:$PATH ;;'''
    '''esac'''
'''done'''


Copy the example amanda.conf into that directory.
===Invent a name for the configuration===
Edit this file to be correct for your site, consulting the [[amanda.conf]](5) man page if necessary.


For a quick start and setting up a test environment, you may copy the parameters from a
You must provide a unique name for each configuration in Amanda.
[[Test environment with virtual tapes]].
This named configuration acts a backup profile, allowing you to reference a set of configuration files describing the source and target for the type of backup you want executed.
Each configuration specifies the ''source'' and ''target'' of the backup:
* The backup source defines the disks, partitions, or directories you intend to back up.
* The target defines the destination of the copied data, such as tapes or disk directories.


Note the values you choose for the next parameters in amanda.conf:
You may define multiple configurations. Some commonly used configuration names:
* '''daily''' for normal daily backups
* '''archive''' for offsite stored archive tapes having only full dumps,
* '''test''' for your test environment
* '''DailySet1.''' Some Linux distributions ship Amanda with this default configuration name.


'''amanda.conf''':
To create a configuration, first create a directory with the chosen configuration name in the Amanda CONFIG_DIR (See the CONFIG_DIR value described in the [[#Collecting configuration information|Collecting configuration information]] section:
logdir  "/usr/local/var/amanda/confname"                # log directory
infofile "/usr/local/var/amanda/confname/curinfo"        # database filename
indexdir "/usr/local/var/amanda/confname/index"          # index directory
tapelist "/usr/local/var/amanda/confname/tapelist"      # list of used tapes


and create the directories or files, making sure the directories and files are owned by the amanda user:
$ '''mkdir -p /etc/amanda/daily'''


# mkdir -p /usr/local/var/amanda
This directory works as the configuration name (label) for the configuration files. So you have now created a configuration called '''daily'''.
# chown -R amanda:disk /usr/local/var/amanda
# su - amanda
$ mkdir -p /usr/local/var/amanda/confname
$ touch /usr/local/var/amanda/confname/tapelist


The directories "curinfo" and "index" will be created automatically, if amanda has permission to write in their parent. Otherwise you have to create these too.
Most Amanda commands take the configuration name as the first argument.
Note the holdingdisk(s) you specified in the amanda.conf file:


'''amanda.conf''':
===Modify amanda.conf===
holdingdisk hd1 {
    directory "/space/amandahold/confname"
    ...
}


And create them:
Copy the example '''amanda.conf''' into the configuration directory. Under many Linux distributions, this file is located in '''/etc/amanda/DailySet1'''. Edit the configuration file as necessary for your site, consulting the {{man|5|amanda.conf}} man page if necessary.


# mkdir -p /space/amandahold/confname
It is recommended that you set up a quick test environment for disk based backup. See the '''amanda.conf''' parameters described in the [[Test environment with virtual tapes]] page.
# chown -R amanda:disk /space/amandahold


===Add entries in /etc/services on the server===
Note the values you choose for the next parameters in '''amanda.conf''':


Put the Amanda services into your /etc/services file.
logdir  "/etc/amanda/daily/logs"          # log directory
Check your /etc/services for existing AMANDA-entries, most UNIX/Linux-distributions already provide the needed entries. If you can't find them, add entries like:
infofile "/etc/amanda/daily/curinfo"        # database filename
indexdir "/etc/amanda/daily/index"          # index directory
tapelist "/etc/amanda/daily/tapelist"      # list of used tapes


'''/etc/services''':
Then create these directories or files, making sure the directories and files are owned by the amanda user:
amanda 10080/udp
amandaidx 10082/tcp
amidxtape 10083/tcp


You may choose a different port number if you like, but it must match the port number in the services file of your AMANDA-client hosts.
# '''chown -R amandabackup:disk /etc/amanda'''
If you are running NIS (aka YP), you have to enter the Amanda service into your NIS services database. Consult your NIS documentation for details.
# '''su - amandabackup'''
You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
$ '''mkdir -p /etc/amanda/daily'''
$ '''touch /etc/amanda/daily/tapelist'''


===Configure (x)inetd on server===
The directories '''curinfo''' and '''index''' are created automatically if amandabackup has write permission in the '''/etc/amanda''' directory.


Find out if you server uses inetd, xinetd, or Dan Bernstein's daemontools.
Specify holding disks in the amanda.conf file:
:*Strictly speaking, the serverside configuration of amanda does not include the "amandad" entries below, but because the amanda-server is usually a client for itself (i.e. you make backups of the amanda server too), I added the "amandad" entries already.


====Configuring inetd on server====
'''amanda.conf''':
holdingdisk hd1 {
    directory "/space/amandahold/daily"
    ...
}


If the server uses inetd, then add these lines to the inetd.conf on the tape server host:
And create them:


'''/etc/inetd.conf''':
# '''mkdir -p /space/amandahold/daily'''
  amanda dgram udp wait $USER $LIBEXECDIR/amandad amandad
  # '''chown -R amandabackup:disk /space/amandahold'''
amandaidx stream tcp nowait $USER $LIBEXECDIR/amindexd amindexd
amidxtape stream tcp nowait $USER $LIBEXECDIR/amidxtaped amidxtaped


where $LIBEXECDIR is the complete path to where the amandad, amindexd and amidxtaped executables are located, and $USER is the Amanda user.  Find the compile time values:
===Add entries in /etc/services on the server===


  $ amadmin x version | grep libexecdir
Add the Amanda services to '''/etc/services''' file on the server. Before you do so, examine '''/etc/services''' for existing Amanda entries. Most UNIX and Linux distributions already provide the required entries. If you can't find them, add entries such as:
  $ amadmin x version | grep CLIENT_LOGIN


The first entry (amandad) is not strictly needed when the server itself is not configured as a client.
''' amanda 10080/udp'''


You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
''' amandaidx 10082/tcp'''


Make inetd reread its configuration file:
''' amidxtape 10083/tcp'''
 
# kill -1 <pid-of-inetd>
 
On older systems you may have to kill it completely and restart it.
 
====Configuring xinetd on server====
 
If the tape server uses xinetd, then you have to add the following file to the xinetd-configuration (usually /etc/xinetd.d) and edit the paths:
 
'''/etc/xinetd.d/amanda''':
service amanda
{
    disable          = no
    socket_type      = dgram
    protocol        = udp
    wait            = yes
    user            = $USER
    group            = $GROUP
    groups          = yes
    server          = $LIBEXECDIR/amandad
}
service amandaidx
{
    disable          = no
    socket_type      = stream
    protocol        = tcp
    wait            = no
    user            = $USER
    group            = $GROUP
    groups          = yes
    server          = $LIBEXECDIR/amindexd
}
service amidxtape
{
    disable          = no
    socket_type      = stream
    protocol        = tcp
    wait            = no
    user            = $USER
    group            = $GROUP
    groups          = yes
    server          = $LIBEXECDIR/amidxtaped
}


where $LIBEXECDIR is the complete path to where the amandad, amindexd and amidxtaped executables are located, and $USER is the Amanda user. Find the compile time values:
You may specify a different port number if desired, but it must match the port number in the '''/etc/services''' file of the Amanda clients that connect to the Amanda server. If you are running NIS (aka YP), you must add the Amanda service to the NIS services database. Consult the NIS documentation for details.


  $ amadmin x version | grep libexecdir
===Configuring Internet services on the Amanda server===
  $ amadmin x version | grep CLIENT_LOGIN


The first entry (amandad) is not strictly needed when the server itself is not configured as a client.
Determine whether the Amanda server uses '''inetd'''(8), '''xinetd'''(8), or Dan Bernstein's '''daemontools'''.
:*Note that the server configuration of Amanda does not ''require'' the '''amandad''' entries shown in the examples below. However, because the Amanda server is usually a client for itself (i.e. the Amanda server should be backed up), the '''amandad''' entries have been added.


Some administrators like to split up the above entries in 3 files instead of one.
====Configuring xinetd and inetd on the server====
Note that BSDTCP and SSH are the recommended mechanisms for new installs.  See [[How To:Configure bsdtcp authentication]] or [[How To:Set up transport encryption with SSH]].  Avoid BSD and BSDUDP if at all possible.


Make xinetd reread its configuration file:
Now skip down to [[#Create_the_disklist_file|Create_the_disklist_file]].


# kill -HUP <pid-of-xinetd>
====Configuring daemontools on the server====


====Configuring daemontools on server====
If your tape server uses Dan Bernstein's '''daemontools''' (http://cr.yp.to/daemontools.html) instead of (x)inetd, you must create '''amandaidx''' and '''amidxtape''' services manually.


If your tape server uses Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html) instead of (x)inetd, you have to create amandaidx and amidxtape services by hand.
*NOTE*: In Amanda 2.6.x, you no longer create the amandaidx and amidxtape services separately.  Instead, the amanda service is provided command line arguments of the services allowed/used.


mkdir -p $prefix/etc/amanda/supervise/amanda
''' mkdir -p $prefix/etc/amanda/supervise/amanda'''
mkdir -p $prefix/etc/amanda/supervise/amandaidx
''' mkdir -p $prefix/etc/amanda/supervise/amandaidx'''
mkdir -p $prefix/etc/amanda/supervise/amidxtape
''' mkdir -p $prefix/etc/amanda/supervise/amidxtape'''


Create service startup files and make them executable:
Create service startup files and make them executable:
Line 230: Line 173:
  /usr/local/libexec/amidxtaped >/dev/null 2>/dev/null
  /usr/local/libexec/amidxtaped >/dev/null 2>/dev/null


Link service directories into your svscan directory:
Link the service directories to the '''svscan''' directory:


  # cd /service
  # '''cd /service'''
  # ln -s $prefix/etc/amanda/supervise/amandaidx .
  # '''ln -s $prefix/etc/amanda/supervise/amandaidx .'''
  # ln -s $prefix/etc/amanda/supervise/amidxtape .
  # '''ln -s $prefix/etc/amanda/supervise/amidxtape .'''


svscan should detect and start your new services automatically.
'''svscan''' should detect and start the new services automatically.


===Create the disklist file===
===Create the disklist file===


In the same directory as the amanda.conf file is the disklist file.  Begin with a few entries while you are testing.
The '''disklist''' file is located in the same directory as the {{man|5|amanda.conf}} file.  Start with a small number of entries while you are testing.


'''disklist''':
'''disklist''':
Line 246: Line 189:
  client2.example.com  /var        comp-user-tar
  client2.example.com  /var        comp-user-tar


Note that you might want to temporarily set the option "record no" in all your dumptypes when first installing Amanda if you'd like to run tests of Amanda in parallel with your existing dump scheme. Amanda will then run but will not interfere with your current dumpdates. However, you don't want to run with "record no" under normal operations.
Note that you might want to temporarily set the option "record no" in all your dumptypes when first installing Amanda if you'd like to run tests of Amanda in parallel with your existing dump scheme. Amanda will still run, but it will not interfere with your current dumpdates. However, you should remove the "record no" option under normal backup operations.


===Add crontab entries===
===Create file .amandahosts on the server===


Schedule the amcheck and amdump command by use of crontab:
When compiled with the configure option '''--without-amandahosts''', use the file '''.rhosts''' and/or '''/etc/hosts.equiv''' instead.
As the dumpuser execute "crontab -e". Here is a sample:


0 16 * * 1-5 /usr/local/sbin/amcheck -m confname
Create a file named '''.amandahosts''' in the home directory of the Amanda user. The syntax is similar to that of the '''.rhosts''' file. An '''.amandahosts''' file is required on each client containing a line to allow the server access to the client (see [[Quick start#Backup client configuration|Backup client configuration]]).
45 0 * * 2-6 /usr/local/sbin/amdump confname
 
'''Note:''' some OS'es have a shared crontab for all users, and may require a userid on each cron line. See your cron(8) for details.
 
With these cron lines, Amanda will check that the correct tape is in the drive every weekday afternoon at 4pm (if it isn't, all the operators will get mail). At 12:45am that night the dumps will be run.
 
It may be wise to add these crontab entries later, when all the tests succeeded.
 
===Create file .amandahosts on the server===
 
Create a file named ".amandahosts" in the home directory of the dumpuser. The syntax is similar as a .rhosts file. Such a file should exist on each client containing a line to allow the server access to the client (see [[Quick start#Backup Client configuration|Backup Client configuration]]).
On the server additional entries are needed for each client in the disklist file that wants to use [[amrecover]] (amrecover needs to be run as root).
On the server additional entries are needed for each client in the disklist file that wants to use [[amrecover]] (amrecover needs to be run as root).


  # su - amanda
  # '''su - amandabackup'''
  $ cat .amandahosts
  $ '''cat .amandahosts'''
  amandahost.yourdomain.com  amanda
  amandahost.yourdomain.com  amandabackup
  amandahost.yourdomain.com  root
  amandahost.yourdomain.com  root
  client1.yourdomain.com  root
  client1.yourdomain.com  root
  client2.yourdomain.com  root
  client2.yourdomain.com  root


The first line in the .amandahosts file above is for the Amanda client running on the server itself.
The first line in the '''.amandahosts''' file above is for the Amanda client running on the server itself.
The next lines allow the user root on each client computer to access the Amanda tape server and Amanda index server on this host with the [[amrecover]] command.
The next lines allow the root user on each client computer to access the Amanda tape and Amanda index servers on this host with the {{man|8|amrecover}} command.


When compiled with the configure option --without-amandahosts, use the file .rhosts and/or /etc/hosts.equiv instead.
The '''.amandahosts''' file also requires strict permissions. It should be owned by the Amanda user, which should have exclusive read privileges to it; it should not be accessible to any other user.
Also, the home directory of the Amanda user (containing the '''.amandahosts''' file) should be write-protected from modification by any other user:


The .rhosts file or (since version 2.5.0) the .amandahosts file need also strict permissions.
  # '''chown amandabackup ~amanda ~/.amandahosts'''
They should be owned by the dumpuser and not be readable or writeable by anyone else. 
  # '''chmod 755 ~amanda'''
Also, the home directory of the dumpuser (containing the .amandahosts file) should not be writeable by anyone else:
  # '''chmod 600 ~amanda/.amandahosts'''
 
  # chown amanda ~amanda ~/.amandahosts
  # chmod 755 ~amanda
  # chmod 600 ~amanda/.amandahosts


==Backup client configuration==
==Backup client configuration==


Each client in the disklist file of the server needs to be configured with the client part of Amanda.
Each client in the '''disklist''' file on the Amanda server must be configured as an Amanda client.


'''Note:''' The server itself is usually also a client; this section applies to the server, too.
'''Note:''' Because the server itself is usually also a client, this section applies to the server as well.


===Create a backup user on the client===
===Create an Amanda user on the client===


The dump user on the client does not have to be same name, uid or gid as the server.
The Amanda user on the client does not have to be same user name, uid or gid as the server's Amanda user.
It must be in the same group that has read access to the raw disk devices.
It must, however, be included in the group that has read access to the raw disk devices.
A real login shell is not really needed (therefore you might also set the shell to something like /bin/false inside /etc/passwd, but this isn't exactly "quickstart", maybe ... we do that in the following example, anyway.).


If the user does not exist, create one:
If an Amanda user does not exist on the client, create one. For example:


  # useradd -u amanda -g disk -d /home/amanda -s /bin/false -c ...
  # '''useradd -u <uid> -g disk -d /var/lib/amanda -s /bin/bash -c ... amandabackup'''
 
Do not use root to run the Amanda suite (TODO: add link to meaningful explanation here. sgw).


If you are running NIS (aka YP), you can add the Amanda user to your NIS services  
If you are running NIS (aka YP), you can add the Amanda user to your NIS services  
database. Consult your NIS documentation for details.
database. Consult your NIS documentation for details.


===Create file .amandahosts on the client===
You can use an Amanda client user name different from the Amanda server user name. If a different user is used in the client, you must configure '''amanda.conf''' appropriately. See the CLIENT_USER field in the DUMPTYPE section of {{man|5|amanda.conf}}.


Create a file named ".amandahosts" in the home directory of the dumpuser on the client. The syntax is similar as a .rhosts file. Fill it with the hostname of the Amanda server and the Amanda user on the server:
===Create the .amandahosts file on the client===


amandahost.example.com  amanda
Create a file named '''.amandahosts''' in the home directory of the Amanda user on the client. The syntax is similar to that of a '''.rhosts''' file. It should contain an entry with the hostname of the Amanda server and the Amanda user on the server:


This entry allows the user amanda on host amandahost.example.com to initiate a backup on this client.
'''amandahost.example.com amandabackup'''


When compiled with the configure option --without-amandahosts, use the file .rhosts and/or /etc/hosts.equiv instead.
This entry allows the user '''amandabackup''' on host '''amandahost.example.com''' to initiate a backup on this client.


The .rhosts file or (since version 2.5.0) the .amandahosts file also need strict permissions.
When compiled with the configure option '''--without-amandahosts''', use the '''.rhosts''' and/or the '''/etc/hosts.equiv''' file instead.
They should be owned by the dumpuser and not be readable or writeable by anyone else. 
Also, the home directory of the dumpuser (containing the .amandahosts file) should not be writeable by anyone else:


# chown amanda ~amanda ~/.amandahosts
The .'''rhosts''' file or, since version 2.5.0, the .'''amandahosts''' file also requires strict permissions. These files should be owned by the Amanda user, which should have exclusive read privileges to them; they should not be accessible to any other user. Also, the home directory of the Amanda user (containing the .amandahosts file) should be write-protected from modification by any other user:
# chmod 755 ~amanda
# chmod 600 ~amanda/.amandahosts


===Create file /etc/amandates and chmod /etc/dumpdates===
# '''chown amandabackup ~amandabackup ~/.amandahosts'''
# '''chmod 755 ~amandabackup'''
# '''chmod 600 ~amandabackup/.amandahosts'''


Create an empty file /etc/amandates and make it owned by the dumpuser.
===Create file /var/amanda/amandates and chmod /var/amanda/dumpdates===


Note: when installing from RPM's, this step is already done.
Create an empty file '''/var/amanda/amandates''' and change its ownership to the Amanda user.


  # touch /etc/amandates
  # '''touch /var/amanda/amandates'''
  # chown amanda /etc/amandates
  # '''chown amandabackup:disk /var/amanda/amandates'''


Make the file /etc/dumpdates writable by the dumpuser:
Make the file '''/var/amanda/dumpdates''' writable by the Amanda user:


  # chmod 664 /etc/dumpdates
  # '''chmod 664 /var/amanda/dumpdates'''
  # chgrp disk /etc/dumpdates
  # '''chgrp''' ''disk_user_group'' '''/var/amanda/dumpdates'''


where "disk" is the group that amanda is in, and the group that has read access to the raw disk devices (see "ls -l /dev/hda1" or whatever your disks are).
where ''disk_user_group'' is the group that amanda is in (i.e., the group that has read access to the raw disk devices). Use '''ls -l /dev/hda1''' or a similar operating system command to list the raw disk devices and who has access to them.


===Add entries in /etc/services on the client===
===Add entries in /etc/services on the client===


Put the Amanda service into your /etc/services file:
Put the Amanda service into your '''/etc/services''' file:


'''/etc/services''':
'''/etc/services''':
amanda 10080/udp
''' amanda 10080/udp'''


You may choose a different port number if you like, but it must match that in the services file on the tape server host, too.
You may specify a different port number if desired, but the port must match that specified in the '''/etc/services''' file on the tape server host.


If you are running NIS (aka YP), you have to enter the Amanda service into your NIS services database. Consult your NIS documentation for details.
If you are running NIS (aka YP), you must enter the Amanda service into your NIS services database. Consult your NIS documentation for details.


You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
You may use the `patch-system' script, from client-src, in order to modify this file. Run it with the '''-h''' argument to display help.


===Configure (x)inetd on the Client===
===Configure Internet services on the client===


Find out if the host uses inetd, xinetd, or Dan Bernstein's daemontools.
If you are using BSDTCP authentication, determine whether the host uses '''inetd''', '''xinetd''', or Dan Bernstein's '''daemontools'''. Skip accordingly to [[#Configuring inetd on the client|Configuring inetd on the client]], [[#Configuring xinetd on the client|Configuring xinetd on the client]] or [[#Configuring daemontools on the client|Configuring daemontools on the client]].


====Configuring inetd on client====
If you are using SSH authentication, you need not worry about any of these configurations.


If the Amanda client uses inetd, put the Amanda client service into inetd's config file. This file is usually found in /etc/inetd.conf, but on older systems it is /etc/servers. The format is different on different OSes, so you must consult the inetd man page for your site.
====Configuring inetd on the client====


'''/etc/inetd.conf''':
See the [[How To:Configure bsdtcp authentication]] page.
amanda dgram udp wait $USER $LIBEXECDIR/amandad amandad


where $LIBEXECDIR is the complete path to where the amandad executable is located and $USER is the Amanda user.  
====Configuring xinetd on the client====
See the [[How To:Configure bsdtcp authentication]] page.


You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
====Configuring daemontools on the client====


Make inetd reread its configuration file:
If the Amanda client uses Dan Bernstein's '''daemontools''' (http://cr.yp.to/daemontools.html) instead of '''(x)inetd''', you must manually create the Amanda service. You will also need a UDP super-server ('''netcat''' in this example).


# kill -1 <pid-of-inetd>
Create the service directory:


On older systems you may have to kill it completely and restart it.
# '''mkdir -p /etc/amanda/supervise/amanda'''


====Configuring xinetd on client====
Create service startup file and make it executable:


If the Amanda client uses xinetd, you have to add the following file to the xinetd-configuration (usually /etc/xinetd.d) and edit it to reflect your settings and paths:
'''/etc/amanda/supervise/amanda/run''':
#!/bin/sh
exec /usr/local/bin/setuidgid amanda \
  /usr/bin/netcat -l -u -p 10080 -q 0 \
  -e /usr/local/libexec/amandad >/dev/null 2>/dev/null


'''/etc/xinetd.d/amanda''':
The '''netcat''' binary used in this runfile might also be called '''/usr/bin/nc''' on your system, depending on the operating system and version.
service amanda
Refer to http://netcat.sourceforge.net for detail on '''netcat'''.
{
      disable          = no
      socket_type      = dgram
      protocol          = udp
      wait              = yes
      user              = $USER
      group            = $GROUP
      groups            = yes
      server            = $LIBEXECDIR/amandad
}


where $LIBEXECDIR is the complete path to where the amandad executables is located, $USER is the Amanda user, and $GROUP is the group name the Amanda user is in.
*NOTE* Use of netcat is no longer supported in the 2.6.x tree (possibly prior as well).  Instead of making 3 separate services monitored by Daemontools, one service named amanda will be created, and provided command line parameters of the services enabled/allowed.  For example, this is the amanda service from a machine that is both an amanda server and client for itself:


Make xinetd reread its configuration file:
'''/etc/amanda/supervise/amanda/run''':
#!/bin/sh
exec /usr/local/bin/setuidgid amandabackup \
/usr/local/bin/tcpserver -DHRl0 0 10080 \
/usr/local/libexec/amandad amindexd amidxtaped noop selfcheck sendsize sendbackup -auth=bsdtcp >/dev/null 2>/dev/null


# kill -HUP <pid-of-xinetd>
Link service directory into your '''svscan''' directory:


====Configuring daemontools on client====
# '''cd /service'''
# '''ln -s /etc/amanda/supervise/amanda'''


If the Amanda client uses Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html) instead of (x)inetd, you have to create the Amanda service by hand. You will need also an UDP super-server (netcat in this example).
'''svscan''' should detect and start the new services automatically.


Create service directory:
===Create the listed_incr_dir for gnutar===


  # mkdir -p /etc/amanda/supervise/amanda
If the dumptypes for this client use [[Gnutar|GNU tar]], then you must create a directory for it. Create the directory and make sure the Amanda user has write permission:


Create service startup file and make it executable:
  # '''mkdir -p /var/lib/amanda/gnutar-lists'''
  # '''chown -R amandabackup:disk /var/lib/amanda'''


'''/etc/amanda/supervise/amanda/run''':
(Change pathnames if Amanda was compiled using other pathnames.)
#!/bin/sh
exec /usr/local/bin/setuidgid amanda \
  /usr/bin/netcat -l -u -p 10080 -q 0 \
  -e /usr/local/libexec/amandad >/dev/null 2>/dev/null


The netcat-binary used in this run-file might also be called /usr/bin/nc on your system, depending on the OS-distribution you use.
===Special requirements===
Refer to http://netcat.sourceforge.net for details of netcat.


Link service directory into your svscan directory:
* If you intend to back up xfs filesystems on hosts running IRIX, you must create the directory /var/xfsdump/inventory, otherwise xfsdump will not work.


# cd /service
==Using the configuration==
# ln -s /etc/amanda/supervise/amanda


svscan should detect and start your new services automatically.
===Label tapes or vtapes ===


===Create the listed_incr_dir for gnutar===
The target for the backup can either be a physical tape or a disk directory defined as a virtual tape (vtape). Before Amanda can access either type of target, the volume must be labeled using the Amanda label ({{man|8|amlabel}}) command.


If the dumptype for this client uses GNU-tar, then you have to create a directory for it.  Find out the compiled-in value, and create the directory, making sure the dumpuser can write into it:
==== Backup to tapes ====


  # amadmin x version | grep listed_incr_dir
Mount the tape with compression turned off and the blocksize set to 0 (variable) before labelling the tape. Use Amanda's {{man|8|amlabel}} command to label the tape. The '''mt''' and '''amlabel''' commands must be executed as the Amanda user (e.g., '''amandabackup''')
  listed_incr_dir=/usr/local/var/amanda/gnutar-lists
  # mkdir -p /usr/local/var/amanda/gnutar-lists
  # chown -R amanda:disk /usr/local/var/amanda


===Special requirements===
$ '''mt -f /dev/nst0 compression 0'''
$ '''mt -f /dev/nst0 setblk 0'''
$ '''amlabel daily Daily-01'''


* If you intend to back up xfs filesystems on hosts running IRIX, you must create the directory /var/xfsdump/inventory, otherwise xfsdump will not work.
Where /dev/nst0 is your "non-rewinding" tape device name.  If you have the symlink /dev/tape for your tape device, then the '-f /dev/nst0' may be omitted.  If you are using an autoloader, ensure a tape is loaded (see the man page for mtx). If you don't see a non-rewinding tape device, use the tape device you do have. e.g. /dev/st0.


==Running the configuration==
The tape label ('''Daily-01''' in the example), must match the '''labelstr''' regular expression specified in the [[amanda.conf]] file, or '''amlabel''' will return an error.


===Label a tape===
==== Backup to disk ====


Take a fresh tape, make sure the tapedrive has the correct settings, like compression off and variable blocksize, and label it using the [[amlabel]] command:
Amanda implements '''vtapes,''' a method of using disk media to emulate tape devices. This is implemented by the VFS device.


# su - amanda
To use a single vtape, add the '''tapedev''' entry to {{man|5|amanda.conf}}:
$ mt -t /dev/nst0 compression 0
$ mt -t /dev/nst0 setblk 0
$ amlabel daily Daily-01


The label you give it, in the example "Daily-01", must match the '''labelstr''' regular expression specified in the [[amanda.conf]] file. Otherwise amlabel will throw an error anyway.
'''amanda.conf''':
'''tapedev "file:/space/amanda-vtapes/tape"'''


While testing a setup, using a "virtual tape" (aka "vtape" = a tape emulated on disk) is very handy. Use this entry in amanda.conf:
Note that this only sets up a single vtape - not a very useful arrangement!  See [[How To:Set Up Virtual Tapes]] for information on setting up multiple vtapes and distributing dumps over them.


'''amanda.conf''':
An Amanda vtape can be any directory that contains a "data" subdirectoryThe following commands create a vtape:
  tapedev "file:/space/amanda-vtapes/tape"


A "vtape" is a directory with a "data" subdirectory inside. Let's create one:
  # '''mkdir /space/amanda-vtapes'''
# '''chown amandabackup:disk /space/amanda-vtapes'''
# '''su - amandabackup'''
$ '''mkdir -p /space/amanda-vtapes/tape/data'''


# mkdir /space/amanda-vtapes
You can use the {{man|8|amlabel}} command to label a vtape:
# chown amanda:disk /space/amanda-vtapes
# su - amanda
$ mkdir -p /space/amanda-vtapes/tape/data


And use [[ammt]] to manipulate the vtape:
$ '''amlabel test Test-01'''


$ ammt -t file:/space/amanda-vtapes/tape rewind
The vtape mechanism is very flexible, allowing the creation of virtual tape libraries including multiple tape volumes. All of these features are described in the [[Test environment with virtual tapes]] page.
$ amlabel test Test-01


You can even emulate a vtape-changer having many tapes, as described in a [[Test environment with virtual tapes]].
===Configuration check ===


===Check the configuration===
Run the '''[[amcheck]]''' command as the Amanda backup user ('''amandabackup''' in the the examples):


Log in on the Amanda server, and run [[amcheck]] as the dumpuser:
  $ '''amcheck daily'''


  # su - amanda
This example verifies the configuration of the Amanda server and its client(s).
  $ amcheck daily


Solve all problems it finds. You don't need to solve the "NOTE" level messages.
Resolve all errors and warnings returned by the '''amcheck''' command. Messages with the prefix ''NOTE:'' are informational messages, and usually require no action.
Error messages are explained in the [[Amcheck issues]] page.


When debugging the setup, the debug files created by the different Amanda programs can be a great help. Find the Amanda debug directory that was compiled in:
===Log files===


  $ amadmin x version | grep DBG
When debugging the setup, the debug log files created by the different Amanda programs can be a great help.  The debug directory is usually '''/tmp/amanda''' (See the [[#Collecting configuration information|Collecting configuration information]] page).
  AMANDA_DBGDIR=/tmp/amanda


The Amanda client programs create a debug file in this directory. The filename starts with the program name, followed by a date-time stamp.
The Amanda client programs create a debug file in this directory. The filename starts with the program name, followed by a date-time stamp.


The Amanda server program writes a log in a file named "amdump" in ''logdir'' specified in [[amanda.conf]].
The Amanda server program writes a log in a file named '''amdump''' in the '''logdir''' specified in {{man|5|amanda.conf}}.
When finished the file is named "amdump.1"; the previous file is then found with name "amdump.2", etc.
When finished, the file is named '''amdump.1'''; the previous file is then found with name '''amdump.2''', etc.


See [[Amanda log files]] for detailed information.
See the [[Amanda log files]] page for detailed information.


Some specific problem you may encounter are explained in the section [[Troubleshooting]].
Some specific problems are explained in the [[Troubleshooting]] page.


===Run a backup===
===Run a backup===


Rerun amcheck several times, until all the errors amcheck finds are solved.
You may have to run '''amcheck''' several times to resolve all errors returned. Continue the cycle until '''amcheck''' runs without returning any errors.


Please note that this process is part of the normal way of setting up AMANDA: AMANDA is a complex combination of multiple parts and therefore the initial setup has to meet several requirements like existing directories, proper permissions and so on. The output of the amcheck-binary should provide you with any needed pointers to what is missing where.
Please note that this process is unavoidable when setting up a product as flexible as Amanda. Amanda is a complex application with several dependencies: its operation requires that particular users and directories exist with correct permissions, etc. The output of '''amcheck''' provides any needed pointers to which parts are missing or misconfigured.


Now it is time to make a real backup with [[amdump]](8):
To start the first production backup, use {{man|8|amdump}}:


  $ amdump daily
  $ '''amdump daily'''


This command takes as long as the backup runs. Do not enter large disks in the disklist at this time.
This command takes as long as the backup runs. Do not enter large disks in the disklist at this time.
Line 507: Line 418:
You might also do:
You might also do:


  $ amdump daily &
  $ '''amdump daily &'''
 
to run that process in the background and log off.


to run that process in the background and log off in the meantime.
For longer runs, particularly on a headless tape server, look into the program '''screen'''.


When finished, you should receive a mail with the backup report.
When finished, you should receive an email message containing the backup report.


When you want to reuse the already labeled tape for another test run, make Amanda forget about it using the [[amrmtape]](8) command, and [[amlabel]] it again with the same label:
To re-use the already-labeled tape for another test run, remove the tape by using the {{man|8|amrmtape}} command, and {{man|8|amlabel}} it again with the same label:


  $ amrmtape daily Daily-01
  $ '''amrmtape daily Daily-01'''
  $ amlabel -f daily Daily-01
  $ '''amlabel -f daily Daily-01'''


===Test a restore===
===Testing recovery===


You really need to test that you can restore a file from the backup. We assume that you have indexing on in the dumptype, and use [[amrecover]], which looks like a ftp client program.  We'll restore into a temporary location (a very good idea in the real, non-testing world also). To run amrecover you need to be root (and have an entry for that host in .amandahosts on the server, see "[[Quick_start#The_File_.amandahosts_on_the_Server|The File .amandahosts on the Server]]" above.
To ensure that your valuable data is protected, you should verify that you can actually restore a file from the backup. Assuming that indexing is enabled in the dumptype, use [[amrecover]], which operates much like an '''ftp''' client program.  This example restores files into a temporary location (which is also, by the way, recommended for restoring files in a real-world situation rather than a test). '''amrecover''' must be run as root; there must also be an entry for the client in '''.amandahosts''' on the server, see "[[Quick start#Create file .amandahosts on the server|Create file .amandahosts on the server]]" above.


  # mkdir /var/tmp/myrestoretest
  # '''mkdir /var/tmp/myrestoretest'''
  # cd /var/tmp/myrestoretest
  # '''cd /var/tmp/myrestoretest'''


Don't forget to rewind the tape!
Don't forget to rewind the tape!


  # ammt -t file:/space/amanda-vtapes/tape rewind
  # '''ammt -t file:/space/amanda-vtapes/tape rewind'''
  # amrecover test
  # '''amrecover test'''
  ...
  ...
  Invalid directory - /var/tmp/myrestoretest
  Invalid directory - /var/tmp/myrestoretest
  amrecover>  
  amrecover>  


Amanda assumes that you are located in the top directory of a entry in the disklist, and complains here the current directory is not a valid disklist entry.  No problem, that's what we intended. We set the disk manually, and explore the index, using ftp-client-like commands.
Amanda assumes that you are located in the top directory of a entry in the disklist, and returns an error because the current directory is not a valid disklist entry.  But this was intended, to demonstrate how you can set the disk from within '''amrecover'''. Its ftp-client-like commands also allow you to explore the index, and then extract the backup file(s).


  amrecover> '''setdisk /var'''
  amrecover> '''setdisk /var'''
Line 556: Line 469:
  amrecover> '''quit'''
  amrecover> '''quit'''


===Frequent errors===
===Common configuration errors===


* Directories/files created during the configuration are not writeable by the dump user.
* Directories/files created during the configuration are not writeable by the backup user (''amandabackup'' in our example)
: Running some programs as root, instead of the dumpuser, creates some files owned by root instead of the dumpuser. When later running as the dumpuser, there could be permission problems with these files. Do not test or run Amanda suite programs as root (except amrecover, which must be run as root).
: Running some programs as root, instead of the Amanda user, creates some files owned by root instead of the Amanda user. When later running as the Amanda user, there could be permission problems with these files. Do not test or run Amanda suite programs as root (except amrecover, which must be run as root).


(TODO: Describe the reason for that somewhere in detail. "principle of least privilege". sgw)
* Specifying the wrong tapedevice: Amanda needs the '''non-rewind''' version of the tape device (if it exists on your system) in your amanda.conf file.
 
* Forgetting to set "disable = no" for amanda services in xinetd configuration files.
 
* Forgetting to have (x)inetd reread the config after adding the entries.  Use ''netstat -a'' command to verify the ports if xinetd/inetd listening on the ports it should be listening on.
 
* Wrong hostname (Use fully qualified domain names) in .amandahosts file. Not specifying IP address and host names in /etc/hosts file 
 
* Firewall between client and server. Firewall should correctly configured to allow amanda traffic between server and client. See [[Firewalls & NAT]] and [[configuration with iptables]] sections.
 
* Sendmail/postfix/... configuration on the mail server refusing mail from your Amanda server. Amanda sends notification emails as the Amanda (non-root) user. Sendmail or Postfix or mail server software should be configured to allow emails from non-root user. Also the SMTP-server of your ISP might block mails from [email protected] if the mailbox does not exist there.
 
* When upgrading a client and changing the user from 'amanda' to 'amandabackup', remember to delete all amandarelated files at /tmp.  They will have wrong permission.  Amanda will create new ones when needed.
 
For more information on resolving other issues, see the [[Troubleshooting]] section.
 
===Add crontab entries===


* Specifying the wrong tapedevice: Amanda needs the '''non-rewind''' version of the tape device in your amanda.conf file.
Once you are comfortable that everything is working correctly, use cron to automate running a quick check of amanda and your backup run. Run '''amcheck''' during the day when operators are present and can attend to any problems. Run '''amdump''' when the system is quiet, typically late at night or early in the morning.


* Forgetting to set "disable = no" in the amanda services of xinetd.
0 16 * * 1-5 /usr/sbin/amcheck -m confname
45 0 * * 2-6 /usr/sbin/amdump confname


* Forgetting to have (x)inetd reread the config after adding the entries. Run "netstat -a" to verify the ports if it listening on the ports it should be listening on.
(Change the pathnames if the programs were installed elsewhere like e.g. /usr/local/sbin)


* Wrong hostname (FQDN or not) in .amandahosts file.
'''Note:''' Some operating systems have a shared '''crontab''' for all users, and may require a userid to be specified for each entry. See the cron(8) man page from the host system for details.


* Firewall issues on/between client and server.
With '''crontab''' entries from the example above, Amanda will check that the correct tape is in the drive every weekday afternoon at 4 PM (if it isn't, all the operators will get mail). At 12:45 AM that night the dumps will be run.


* Sendmail/postfix/... configuration on the mail server refusing mail from your Amanda server. Amanda sends notification emails as non-root user (Amanda user). Sendmail or Postfix or mail server software should be configured to allow emails from non-root user. Also the SMTP-server of your ISP might block mails from amanda@your.domain.tld if the mailbox does not exist there.
Some systems have a directory, /etc/cron.d (or equivalent). Files in that directory are treated as additional '''crontab''' files. Instead of editing '''crontab''', add a custom file with a suitable name and your Amanda crontab entries. You will probably have to specify the user ID to run as, just as you would in '''crontab'''. With this technique, your Amanda entries won't be clobbered by an upgrade. The following example runs on a Debian Linux installation:


See also: [[Troubleshooting]].
0 12    * * 0-4 backup  /usr/sbin/amcheck -m -c -s DailySet1
23 1    * * 1-5 backup  /usr/sbin/amdump DailySet1


===Start production run===
===Start production run===
Line 583: Line 514:
* Add more hosts and disks to the disklist
* Add more hosts and disks to the disklist
: When you add them all at once, be prepared for loud complaints in the report from Amanda about not being able to get all the data on one tape.  But after a few runs, Amanda should settle down.
: When you add them all at once, be prepared for loud complaints in the report from Amanda about not being able to get all the data on one tape.  But after a few runs, Amanda should settle down.
: Alternatively, add hosts and disks a few at a time to avoid an indigestion.
: Better, add hosts and disks a few at a time to avoid indigestion.


* Label more tapes.  Labeling them one each day a new tape is needed is fine too.  After "tapecycle" runs, Amanda will ask for the first, oldest tape again.
* Label more tapes.  Labeling them one each day a new tape is needed is fine too.  After "tapecycle" runs, Amanda will ask for the first, oldest tape again.
Line 593: Line 524:
* Verify the backup report you receive the next day carefully.
* Verify the backup report you receive the next day carefully.


* Study more of the Amanda programs, and tune the amanda.conf to your needs.
* Study more of the Amanda programs, and tune amanda.conf to your needs.


* Subscribe to the [http://forums.zmanda.com/ Amanda forums] and [http://www.amanda.org/support/mailinglists.php Amanda-users mailing list]:  
* Subscribe to the [http://forums.zmanda.com/ Amanda forums] and [http://www.amanda.org/support/mailinglists.php Amanda-users mailing list]:  


* Exercise/practice a recover using [[amrecover]], [[amrestore]] or even a bare metal recovery using dd and gnutar/restore before the real disasters happen.
* Exercise/practice a recover using {{man|8|amrecover}}, {{man|8|amrestore}} or even a bare metal recovery using dd and gnutar/restore before the real disasters happen.

Latest revision as of 23:41, 1 January 2011

Deprecated
This 'Quick Start' is neither quick nor up to date. See Getting Started With Amanda instead.

Installing Amanda

Use any of the following methods to install Amanda:

  • Run one of the installation packages available from Zmanda or elsewhere:
    • The Zmanda downloads site includes installation packages for many platforms. If you are using packages from Zmanda downloads page, go to the Zmanda packages 15 minute example. If you are using Windows client, refer to the Windows client page for installation instructions.
    • Many Linux and BSD distributions include Amanda packages, as does the Sun freeware site. See your distribution's package manager docuumentation for details.

Whether you are installing Amanda packages or compiling from the source, please see the installation page for detailed instructions.

Note: when installing from RPM, debian or other packages, many of the steps below are already done for you. Unfortunately we can't advise you on which steps were done for you. We suggest you follow the instructions below to learn what the package management software did. You can then do the rest manually.

The pre-built Amanda packages make some configuration assumptions regarding the location of log files, .conf files, binaries, etc. Packages from the Zmanda downloads page perform these configuration steps at the end of the installation procedure. Please see Amanda packages from Zmanda downloads page for a list of configuration steps that are performed.

Collecting configuration information

To set up Amanda backups, you will need to know the configuration parameters of the Amanda installation you are setting up. If you built Amanda from the source tree, these are in the form of configure script parameters. If you have installed binary packages from another source, use the amadmin command piped to grep to determine the Amanda parameters. These commands must be run as superuser (root). Note that due to variation in third party packages, the values you find may vary from the defaults noted here.

"CLIENT_LOGIN"
Amanda user. This user id is used by the backup process. Example: amandabackup, amanda
# /usr/sbin/amadmin xx version | grep CLIENT_LOGIN
"CONFIG_DIR"
Amanda configuration directory. All Amanda configurations in the Amanda server are stored here. Default: /etc/amanda (though in some packages you may find /usr/local/etc/amanda).
# /usr/sbin/amadmin xx version | grep CONFIG_DIR

"AMANDA_DBGDIR"
Amanda directory for debug log files. Default: /tmp/amanda
# /usr/sbin/amadmin xx version | grep AMANDA_DBGDIR
"libexecdir"
Amanda directory where executables started by amandad process are installed. Default: /var/lib/amanda
# /usr/sbin/amadmin xx version | grep libexecdir
"listed_incr_dir"
This directory in Amanda client is used by the GNU tar command. This directory only used if GNUTAR is configured as a backup program in the dumptype section of amanda.conf(5). Default: /var/lib/amanda/gnutar-lists
# /usr/sbin/amadmin xx version | grep listed_incr_dir

Configuring the backup server

Create an Amanda user on the server

Amanda runs as a normal user, but must be in the same group that has read access to the raw disk devices. Do not run Amanda as the root user. The Amanda user name is defined by the CLIENT_LOGIN parameter from the Collecting configuration information page.

It is possible to change the name of the user used during Amanda compilation. Amanda packages from different distributions use different user names and home directories for Amanda.

For example: If you install Amanda using pre-built packages from the Zmanda downloads page, a user amandabackup is created, and is added to the group disk with the home directory /var/lib/amanda.

You must assign a password to the amandabackup user in order to unlock the account. E.g. as root:

# passwd amandabackup

Alternatively, if you built Amanda using the source tree, create the user by running the useradd command. For example:

# useradd -u <uid> -g disk -d /var/lib/amanda -s /bin/bash -c ... amandabackup

If you are running Network Information Services (NIS, a.k.a. Yellow Pages or YP), you can add the Amanda user to your NIS database. Consult your NIS documentation for details.

The Amanda user's home directory must be owned by the amanda user. For example, assuming the gnu chown and that the Amanda user's name is backup:

# chown backup:backup $(grep backup /etc/passwd | cut -d: -f6)

The Amanda programs should be accessible to the Amanda user (in other words, add them to that user's PATH). For example, if the programs reside in /usr/local/sbin directory, set the PATH variable in .profile, and/or .bashrc in the Amanda user's home directory. The following script excerpt shows how to set PATH variable in a shell script:

# Prepend these directories to PATH if needed
for d in /usr/local/bin /usr/local/sbin
do
    case :$PATH: in
        *:$d:*) : ;;
        *)  PATH=$d:$PATH ;;
    esac
done

Invent a name for the configuration

You must provide a unique name for each configuration in Amanda. This named configuration acts a backup profile, allowing you to reference a set of configuration files describing the source and target for the type of backup you want executed. Each configuration specifies the source and target of the backup:

  • The backup source defines the disks, partitions, or directories you intend to back up.
  • The target defines the destination of the copied data, such as tapes or disk directories.

You may define multiple configurations. Some commonly used configuration names:

  • daily for normal daily backups
  • archive for offsite stored archive tapes having only full dumps,
  • test for your test environment
  • DailySet1. Some Linux distributions ship Amanda with this default configuration name.

To create a configuration, first create a directory with the chosen configuration name in the Amanda CONFIG_DIR (See the CONFIG_DIR value described in the Collecting configuration information section:

$ mkdir -p /etc/amanda/daily

This directory works as the configuration name (label) for the configuration files. So you have now created a configuration called daily.

Most Amanda commands take the configuration name as the first argument.

Modify amanda.conf

Copy the example amanda.conf into the configuration directory. Under many Linux distributions, this file is located in /etc/amanda/DailySet1. Edit the configuration file as necessary for your site, consulting the amanda.conf(5) man page if necessary.

It is recommended that you set up a quick test environment for disk based backup. See the amanda.conf parameters described in the Test environment with virtual tapes page.

Note the values you choose for the next parameters in amanda.conf:

logdir   "/etc/amanda/daily/logs"           # log directory
infofile "/etc/amanda/daily/curinfo"        # database filename
indexdir "/etc/amanda/daily/index"          # index directory
tapelist "/etc/amanda/daily/tapelist"       # list of used tapes

Then create these directories or files, making sure the directories and files are owned by the amanda user:

# chown -R amandabackup:disk /etc/amanda
# su - amandabackup
$ mkdir -p /etc/amanda/daily
$ touch /etc/amanda/daily/tapelist

The directories curinfo and index are created automatically if amandabackup has write permission in the /etc/amanda directory.

Specify holding disks in the amanda.conf file:

amanda.conf:

holdingdisk hd1 {
    directory "/space/amandahold/daily"
    ...
}

And create them:

# mkdir -p /space/amandahold/daily
# chown -R amandabackup:disk /space/amandahold

Add entries in /etc/services on the server

Add the Amanda services to /etc/services file on the server. Before you do so, examine /etc/services for existing Amanda entries. Most UNIX and Linux distributions already provide the required entries. If you can't find them, add entries such as:

amanda 10080/udp

amandaidx 10082/tcp

amidxtape 10083/tcp

You may specify a different port number if desired, but it must match the port number in the /etc/services file of the Amanda clients that connect to the Amanda server. If you are running NIS (aka YP), you must add the Amanda service to the NIS services database. Consult the NIS documentation for details.

Configuring Internet services on the Amanda server

Determine whether the Amanda server uses inetd(8), xinetd(8), or Dan Bernstein's daemontools.

  • Note that the server configuration of Amanda does not require the amandad entries shown in the examples below. However, because the Amanda server is usually a client for itself (i.e. the Amanda server should be backed up), the amandad entries have been added.

Configuring xinetd and inetd on the server

Note that BSDTCP and SSH are the recommended mechanisms for new installs. See How To:Configure bsdtcp authentication or How To:Set up transport encryption with SSH. Avoid BSD and BSDUDP if at all possible.

Now skip down to Create_the_disklist_file.

Configuring daemontools on the server

If your tape server uses Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html) instead of (x)inetd, you must create amandaidx and amidxtape services manually.

  • NOTE*: In Amanda 2.6.x, you no longer create the amandaidx and amidxtape services separately. Instead, the amanda service is provided command line arguments of the services allowed/used.

mkdir -p $prefix/etc/amanda/supervise/amanda mkdir -p $prefix/etc/amanda/supervise/amandaidx mkdir -p $prefix/etc/amanda/supervise/amidxtape

Create service startup files and make them executable:

/etc/amanda/supervise/amandaidx/run:

#!/bin/sh
exec /usr/local/bin/setuidgid amanda \
/usr/local/bin/tcpserver -DHRl0 0 10082 \
/usr/local/libexec/amindexd >/dev/null 2>/dev/null

/etc/amanda/supervise/amidxtape/run:

#!/bin/sh
exec /usr/local/bin/setuidgid amanda \
/usr/local/bin/tcpserver -DHRl0 0 10083 \
/usr/local/libexec/amidxtaped >/dev/null 2>/dev/null

Link the service directories to the svscan directory:

# cd /service
# ln -s $prefix/etc/amanda/supervise/amandaidx .
# ln -s $prefix/etc/amanda/supervise/amidxtape .

svscan should detect and start the new services automatically.

Create the disklist file

The disklist file is located in the same directory as the amanda.conf(5) file. Start with a small number of entries while you are testing.

disklist:

client1.example.com  /some/dir   comp-user-tar
client2.example.com  /var        comp-user-tar

Note that you might want to temporarily set the option "record no" in all your dumptypes when first installing Amanda if you'd like to run tests of Amanda in parallel with your existing dump scheme. Amanda will still run, but it will not interfere with your current dumpdates. However, you should remove the "record no" option under normal backup operations.

Create file .amandahosts on the server

When compiled with the configure option --without-amandahosts, use the file .rhosts and/or /etc/hosts.equiv instead.

Create a file named .amandahosts in the home directory of the Amanda user. The syntax is similar to that of the .rhosts file. An .amandahosts file is required on each client containing a line to allow the server access to the client (see Backup client configuration). On the server additional entries are needed for each client in the disklist file that wants to use amrecover (amrecover needs to be run as root).

# su - amandabackup
$ cat .amandahosts
amandahost.yourdomain.com  amandabackup
amandahost.yourdomain.com  root
client1.yourdomain.com  root
client2.yourdomain.com  root

The first line in the .amandahosts file above is for the Amanda client running on the server itself. The next lines allow the root user on each client computer to access the Amanda tape and Amanda index servers on this host with the amrecover(8) command.

The .amandahosts file also requires strict permissions. It should be owned by the Amanda user, which should have exclusive read privileges to it; it should not be accessible to any other user. Also, the home directory of the Amanda user (containing the .amandahosts file) should be write-protected from modification by any other user:

# chown amandabackup ~amanda ~/.amandahosts
# chmod 755 ~amanda
# chmod 600 ~amanda/.amandahosts

Backup client configuration

Each client in the disklist file on the Amanda server must be configured as an Amanda client.

Note: Because the server itself is usually also a client, this section applies to the server as well.

Create an Amanda user on the client

The Amanda user on the client does not have to be same user name, uid or gid as the server's Amanda user. It must, however, be included in the group that has read access to the raw disk devices.

If an Amanda user does not exist on the client, create one. For example:

# useradd -u <uid> -g disk -d /var/lib/amanda -s /bin/bash -c ... amandabackup

If you are running NIS (aka YP), you can add the Amanda user to your NIS services database. Consult your NIS documentation for details.

You can use an Amanda client user name different from the Amanda server user name. If a different user is used in the client, you must configure amanda.conf appropriately. See the CLIENT_USER field in the DUMPTYPE section of amanda.conf(5).

Create the .amandahosts file on the client

Create a file named .amandahosts in the home directory of the Amanda user on the client. The syntax is similar to that of a .rhosts file. It should contain an entry with the hostname of the Amanda server and the Amanda user on the server:

amandahost.example.com  amandabackup

This entry allows the user amandabackup on host amandahost.example.com to initiate a backup on this client.

When compiled with the configure option --without-amandahosts, use the .rhosts and/or the /etc/hosts.equiv file instead.

The .rhosts file or, since version 2.5.0, the .amandahosts file also requires strict permissions. These files should be owned by the Amanda user, which should have exclusive read privileges to them; they should not be accessible to any other user. Also, the home directory of the Amanda user (containing the .amandahosts file) should be write-protected from modification by any other user:

# chown amandabackup ~amandabackup ~/.amandahosts
# chmod 755 ~amandabackup
# chmod 600 ~amandabackup/.amandahosts

Create file /var/amanda/amandates and chmod /var/amanda/dumpdates

Create an empty file /var/amanda/amandates and change its ownership to the Amanda user.

# touch /var/amanda/amandates
# chown amandabackup:disk /var/amanda/amandates

Make the file /var/amanda/dumpdates writable by the Amanda user:

# chmod 664 /var/amanda/dumpdates
# chgrp disk_user_group /var/amanda/dumpdates

where disk_user_group is the group that amanda is in (i.e., the group that has read access to the raw disk devices). Use ls -l /dev/hda1 or a similar operating system command to list the raw disk devices and who has access to them.

Add entries in /etc/services on the client

Put the Amanda service into your /etc/services file:

/etc/services: amanda 10080/udp

You may specify a different port number if desired, but the port must match that specified in the /etc/services file on the tape server host.

If you are running NIS (aka YP), you must enter the Amanda service into your NIS services database. Consult your NIS documentation for details.

You may use the `patch-system' script, from client-src, in order to modify this file. Run it with the -h argument to display help.

Configure Internet services on the client

If you are using BSDTCP authentication, determine whether the host uses inetd, xinetd, or Dan Bernstein's daemontools. Skip accordingly to Configuring inetd on the client, Configuring xinetd on the client or Configuring daemontools on the client.

If you are using SSH authentication, you need not worry about any of these configurations.

Configuring inetd on the client

See the How To:Configure bsdtcp authentication page.

Configuring xinetd on the client

See the How To:Configure bsdtcp authentication page.

Configuring daemontools on the client

If the Amanda client uses Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html) instead of (x)inetd, you must manually create the Amanda service. You will also need a UDP super-server (netcat in this example).

Create the service directory:

# mkdir -p /etc/amanda/supervise/amanda

Create service startup file and make it executable:

/etc/amanda/supervise/amanda/run:

#!/bin/sh
exec /usr/local/bin/setuidgid amanda \
 /usr/bin/netcat -l -u -p 10080 -q 0 \
 -e /usr/local/libexec/amandad >/dev/null 2>/dev/null

The netcat binary used in this runfile might also be called /usr/bin/nc on your system, depending on the operating system and version. Refer to http://netcat.sourceforge.net for detail on netcat.

  • NOTE* Use of netcat is no longer supported in the 2.6.x tree (possibly prior as well). Instead of making 3 separate services monitored by Daemontools, one service named amanda will be created, and provided command line parameters of the services enabled/allowed. For example, this is the amanda service from a machine that is both an amanda server and client for itself:

/etc/amanda/supervise/amanda/run:

#!/bin/sh
exec /usr/local/bin/setuidgid amandabackup \
/usr/local/bin/tcpserver -DHRl0 0 10080 \
/usr/local/libexec/amandad amindexd amidxtaped noop selfcheck sendsize sendbackup -auth=bsdtcp >/dev/null 2>/dev/null

Link service directory into your svscan directory:

# cd /service
# ln -s /etc/amanda/supervise/amanda 

svscan should detect and start the new services automatically.

Create the listed_incr_dir for gnutar

If the dumptypes for this client use GNU tar, then you must create a directory for it. Create the directory and make sure the Amanda user has write permission:

 # mkdir -p /var/lib/amanda/gnutar-lists
 # chown -R amandabackup:disk /var/lib/amanda

(Change pathnames if Amanda was compiled using other pathnames.)

Special requirements

  • If you intend to back up xfs filesystems on hosts running IRIX, you must create the directory /var/xfsdump/inventory, otherwise xfsdump will not work.

Using the configuration

Label tapes or vtapes

The target for the backup can either be a physical tape or a disk directory defined as a virtual tape (vtape). Before Amanda can access either type of target, the volume must be labeled using the Amanda label (amlabel(8)) command.

Backup to tapes

Mount the tape with compression turned off and the blocksize set to 0 (variable) before labelling the tape. Use Amanda's amlabel(8) command to label the tape. The mt and amlabel commands must be executed as the Amanda user (e.g., amandabackup)

$ mt -f /dev/nst0 compression 0
$ mt -f /dev/nst0 setblk 0
$ amlabel daily Daily-01

Where /dev/nst0 is your "non-rewinding" tape device name. If you have the symlink /dev/tape for your tape device, then the '-f /dev/nst0' may be omitted. If you are using an autoloader, ensure a tape is loaded (see the man page for mtx). If you don't see a non-rewinding tape device, use the tape device you do have. e.g. /dev/st0.

The tape label (Daily-01 in the example), must match the labelstr regular expression specified in the amanda.conf file, or amlabel will return an error.

Backup to disk

Amanda implements vtapes, a method of using disk media to emulate tape devices. This is implemented by the VFS device.

To use a single vtape, add the tapedev entry to amanda.conf(5):

amanda.conf:

tapedev "file:/space/amanda-vtapes/tape"

Note that this only sets up a single vtape - not a very useful arrangement! See How To:Set Up Virtual Tapes for information on setting up multiple vtapes and distributing dumps over them.

An Amanda vtape can be any directory that contains a "data" subdirectory. The following commands create a vtape:

# mkdir /space/amanda-vtapes
# chown amandabackup:disk /space/amanda-vtapes
# su - amandabackup
$ mkdir -p /space/amanda-vtapes/tape/data

You can use the amlabel(8) command to label a vtape:

$ amlabel test Test-01

The vtape mechanism is very flexible, allowing the creation of virtual tape libraries including multiple tape volumes. All of these features are described in the Test environment with virtual tapes page.

Configuration check

Run the amcheck command as the Amanda backup user (amandabackup in the the examples):

 $ amcheck daily

This example verifies the configuration of the Amanda server and its client(s).

Resolve all errors and warnings returned by the amcheck command. Messages with the prefix NOTE: are informational messages, and usually require no action. Error messages are explained in the Amcheck issues page.

Log files

When debugging the setup, the debug log files created by the different Amanda programs can be a great help. The debug directory is usually /tmp/amanda (See the Collecting configuration information page).

The Amanda client programs create a debug file in this directory. The filename starts with the program name, followed by a date-time stamp.

The Amanda server program writes a log in a file named amdump in the logdir specified in amanda.conf(5). When finished, the file is named amdump.1; the previous file is then found with name amdump.2, etc.

See the Amanda log files page for detailed information.

Some specific problems are explained in the Troubleshooting page.

Run a backup

You may have to run amcheck several times to resolve all errors returned. Continue the cycle until amcheck runs without returning any errors.

Please note that this process is unavoidable when setting up a product as flexible as Amanda. Amanda is a complex application with several dependencies: its operation requires that particular users and directories exist with correct permissions, etc. The output of amcheck provides any needed pointers to which parts are missing or misconfigured.

To start the first production backup, use amdump(8):

$ amdump daily

This command takes as long as the backup runs. Do not enter large disks in the disklist at this time.

You might also do:

$ amdump daily &

to run that process in the background and log off.

For longer runs, particularly on a headless tape server, look into the program screen.

When finished, you should receive an email message containing the backup report.

To re-use the already-labeled tape for another test run, remove the tape by using the amrmtape(8) command, and amlabel(8) it again with the same label:

$ amrmtape daily Daily-01
$ amlabel -f daily Daily-01

Testing recovery

To ensure that your valuable data is protected, you should verify that you can actually restore a file from the backup. Assuming that indexing is enabled in the dumptype, use amrecover, which operates much like an ftp client program. This example restores files into a temporary location (which is also, by the way, recommended for restoring files in a real-world situation rather than a test). amrecover must be run as root; there must also be an entry for the client in .amandahosts on the server, see "Create file .amandahosts on the server" above.

# mkdir /var/tmp/myrestoretest
# cd /var/tmp/myrestoretest

Don't forget to rewind the tape!

# ammt -t file:/space/amanda-vtapes/tape rewind
# amrecover test
...
Invalid directory - /var/tmp/myrestoretest
amrecover> 

Amanda assumes that you are located in the top directory of a entry in the disklist, and returns an error because the current directory is not a valid disklist entry. But this was intended, to demonstrate how you can set the disk from within amrecover. Its ftp-client-like commands also allow you to explore the index, and then extract the backup file(s).

amrecover> setdisk /var
200 Disk set to /var.
amrecover> ls
...
amrecover> cd log
amrecover> add messages.1
Added /log/messages.1
amrecover> extract

Extracting files using tape drive file:/space/amanda-vtapes/tape on host amandahost.
The following tapes are needed: Test-01

Restoring files into directory /var/tmp/myrestoretest
Continue [?/Y/n]? y

Extracting files using tape drive file:/space/amanda-vtapes/tape on host amandahost.
Load tape Test-01 now
Continue [?/Y/n/s/t]? y
./log/messages.1
amrecover> quit

Common configuration errors

  • Directories/files created during the configuration are not writeable by the backup user (amandabackup in our example)
Running some programs as root, instead of the Amanda user, creates some files owned by root instead of the Amanda user. When later running as the Amanda user, there could be permission problems with these files. Do not test or run Amanda suite programs as root (except amrecover, which must be run as root).
  • Specifying the wrong tapedevice: Amanda needs the non-rewind version of the tape device (if it exists on your system) in your amanda.conf file.
  • Forgetting to set "disable = no" for amanda services in xinetd configuration files.
  • Forgetting to have (x)inetd reread the config after adding the entries. Use netstat -a command to verify the ports if xinetd/inetd listening on the ports it should be listening on.
  • Wrong hostname (Use fully qualified domain names) in .amandahosts file. Not specifying IP address and host names in /etc/hosts file
  • Sendmail/postfix/... configuration on the mail server refusing mail from your Amanda server. Amanda sends notification emails as the Amanda (non-root) user. Sendmail or Postfix or mail server software should be configured to allow emails from non-root user. Also the SMTP-server of your ISP might block mails from [email protected] if the mailbox does not exist there.
  • When upgrading a client and changing the user from 'amanda' to 'amandabackup', remember to delete all amandarelated files at /tmp. They will have wrong permission. Amanda will create new ones when needed.

For more information on resolving other issues, see the Troubleshooting section.

Add crontab entries

Once you are comfortable that everything is working correctly, use cron to automate running a quick check of amanda and your backup run. Run amcheck during the day when operators are present and can attend to any problems. Run amdump when the system is quiet, typically late at night or early in the morning.

0 16 * * 1-5 /usr/sbin/amcheck -m confname
45 0 * * 2-6 /usr/sbin/amdump confname

(Change the pathnames if the programs were installed elsewhere like e.g. /usr/local/sbin)

Note: Some operating systems have a shared crontab for all users, and may require a userid to be specified for each entry. See the cron(8) man page from the host system for details.

With crontab entries from the example above, Amanda will check that the correct tape is in the drive every weekday afternoon at 4 PM (if it isn't, all the operators will get mail). At 12:45 AM that night the dumps will be run.

Some systems have a directory, /etc/cron.d (or equivalent). Files in that directory are treated as additional crontab files. Instead of editing crontab, add a custom file with a suitable name and your Amanda crontab entries. You will probably have to specify the user ID to run as, just as you would in crontab. With this technique, your Amanda entries won't be clobbered by an upgrade. The following example runs on a Debian Linux installation:

0 12    * * 0-4 backup   /usr/sbin/amcheck -m -c -s DailySet1
23 1    * * 1-5 backup   /usr/sbin/amdump DailySet1

Start production run

  • Remove the "record no" option from the dumptype, if you added this for testing purposes.
  • Add more hosts and disks to the disklist
When you add them all at once, be prepared for loud complaints in the report from Amanda about not being able to get all the data on one tape. But after a few runs, Amanda should settle down.
Better, add hosts and disks a few at a time to avoid indigestion.
  • Label more tapes. Labeling them one each day a new tape is needed is fine too. After "tapecycle" runs, Amanda will ask for the first, oldest tape again.
  • Verify/activate the crontab entries on the server.
  • Insert the next tape for tonight, and let the amcheck in crontab verify the configuration.
  • Verify the backup report you receive the next day carefully.
  • Study more of the Amanda programs, and tune amanda.conf to your needs.
  • Exercise/practice a recover using amrecover(8), amrestore(8) or even a bare metal recovery using dd and gnutar/restore before the real disasters happen.