Quick start (old): Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
(Reworked the "backup server" part)
Line 15: Line 15:
===Invent a name for the configuration===
===Invent a name for the configuration===


A configuration in amanda has a name. Most commands need that configuration name as first argument.
A configuration in Amanda has a name. Most Amanda commands need that configuration name as first argument.
You may have many configurations. Frequent names are: "daily" for daily backups, "archive" for offsite stored achive tapes, "test" for your test environment.
You may have many configurations.
Frequent names are: "daily" for daily backups, "archive" for offsite stored achive tapes, "test" for your test environment.
Some distributions ship amanda with a configuration named "DailySet1".
Some distributions ship amanda with a configuration named "DailySet1".



Revision as of 20:43, 4 December 2005

Installation

Amanda source tree has to be downloaded and built using the procedure described in first 3 sections of installation chapter.

Backup server configuration

Create a backup user

Amanda runs as a normal user, but must be in the same group that has read access to the raw disk devices. Frequent choises are: amanda, backup, operator. Do not use root to run the amanda suite. If the user does not exist, create one:

# useradd -u amanda -g disk -d /home/amanda -s /bin/bash -c ...

Invent a name for the configuration

A configuration in Amanda has a name. Most Amanda commands need that configuration name as first argument. You may have many configurations. Frequent names are: "daily" for daily backups, "archive" for offsite stored achive tapes, "test" for your test environment. Some distributions ship amanda with a configuration named "DailySet1".

Find out where the CONFIG_DIR is:

 $ amadmin x version | grep CONFIG_DIR
 CONFIG_DIR=/usr/local/etc/amanda

and create a directory with the choosen configuration name inside it:

 $ cd /usr/local/etc/amanda
 $ mkdir daily

Modify amanda.conf

Copy the example amanda.conf into that directory. Edit these files to be correct for your site, consulting the amanda.conf(5) man page if necessary. Note the values you choose for the next parameters in amanda.conf:

amanda.conf:

logdir   "/usr/local/var/amanda/confname/log"            # 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:

# su - amanda
$ mkdir -p /usr/local/var/amanda/confname/log
$ mkdir -p /usr/local/var/amanda/confname/curinfo
$ mkdir -p /usr/local/var/amanda/confname/index
$ touch /usr/local/var/amanda/confname/tapelist

Note the holdingdisk(s) you specified in the amanda.conf file:

amanda.conf:

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

And create them:

# mkdir -p /space/amandahold/confname
# chown -R amanda:disk /space/amandahold

Note that you might want to temporarily set the option "no-record" 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 "no-record" under normal operations.

Entries in /etc/services

Put the Amanda services into your /etc/services file. Add entries like:

/etc/services:

amanda		10080/udp
amandaidx	10082/tcp
amidxtape	10083/tcp

You may choose a different port number if you like, but it must match that in the services file on the client hosts too. 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. You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.

Configure (x)inetd

Find out if you server uses inetd, xinetd, or Dan Bernstein's daemontools. 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.

inetd

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

/etc/inetd.conf:

amanda dgram udp wait $USER $AMANDAD_PATH amandad
amandaidx stream tcp nowait $USER $AMINDEXD_PATH amindexd
amidxtape stream tcp nowait $USER $AMIDXTAPED_PATH amidxtaped

where $AMINDEXD_PATH and $AMIDXTAPED_PATH are the complete paths to where the amindexd and amidxtaped executables (usually :libexec_dir/amindexd and libexec_dir/amidxtaped), and USER is the AMANDA user. The first entry is not strictly needed when the server itself is not configured as a client.

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

xinetd

If your tape server uses xinetd, then you have to add the following file to your xinetd-configuration (usually :/etc/xinetd.d) and edit the paths:

/etc/xinetd.d/amanda:

service amanda
{
    socket_type      = dgram
    protocol         = udp
    wait             = yes
    user             = $USER
    group            = $GROUP
    groups           = yes
    server           = $AMANDAD_PATH/amandad 
}

service amandaidx
{
    socket_type      = stream
    protocol         = tcp
    wait             = no
    user             = $USER
    group            = $GROUP
    groups           = yes
    server           = $AMINDEXD_PATH/amindexd 
} 

service amidxtape
{
    socket_type      = stream
    protocol         = tcp
    wait             = no
    user             = $USER
    group            = $GROUP
    groups           = yes
    server           = $AMIDXTAPED_PATH/amidxtaped
} 

Some administrators like to split up the above entries in 3 files instead of one.

daemontools

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.

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 service directories into your svscan directory:

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

If the tape server host is itself going to be backed up (as is usually the case), you must also follow the client-side install instructions below on the server host, INCLUDING setting up the file .amandahosts so that the server host lets itself in. This is a frequently encountered problem for new sites.

Create a disklist

In the same directory as the amanda.conf file is the disklist file. Begin with a few entries while you are testing.

disklist:

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

Crontab entries

Put AMANDA into your crontab, with "crontab -e". Here is a sample:

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

Note: some crontab 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.

Frequent errors

  • Directories/files created above are not writeable by the dump user.
  • Specifying the wrong tapedevice: you need the no-rewind version of the tape device in your amanda.conf file.
  • Forgetting to restart (x)inetd.

Backup Client configuration

  • When using BSD-style security (enabled by default), set up your ~dumpuser/.amandahosts (or ~dumpuser/.rhosts and/or /etc/hosts.equiv, if you have configured --without-amandahosts) so that the dumpuser is allowed in from the server host. Only canonical host names will be accepted in .amandahosts, and usernames must be present in every line, because this is safer.
  • Set up your raw disk devices so that the dumpuser can read them, and /etc/dumpdates so that the dumpuser can write to it. Normally this is done by making the disk devices readable by (and dumpdates read/writable by) group `operator', and putting the dumpuser into that group.
  • Put the AMANDA service into your /etc/services file. Add entry like:
/etc/services
amanda		10080/udp
amandaidx	10082/tcp
amidxtape	10083/tcp
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.
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.
You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
  • Follow one of the following steps to set up the AMANDA client service:
    • If your 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. Here is an example from our site, again from SunOS 4.x:
/etc/inetd.conf
amanda dgram udp wait USER AMANDAD_PATH amandad
You may use the `patch-system' script, from client-src, in order to modify this file. Run it with a `-h' argument for usage.
  • If your AMANDA client uses xinetd, you have to add the following file to your xinetd-configuration (usually /etc/xinetd.d) and edit it to reflect your settings and paths:
/etc/xinetd.d/amanda
service amanda
{
     socket_type		= dgram
     protocol		        = udp
     wait			= yes
     user			= $USER
     group			= $GROUP
     groups 			= yes
     server			= $AMANDAD_PATH/amandad 
}
  • If your 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).
    • Create 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 run-file might also be called /usr/bin/nc on your system, depending on the OS-distribution you use.
Refer to http://netcat.sourceforge.net for details of netcat.
    • Link service directory into your svscan directory:
cd /service
ln -s /etc/amanda/supervise/amanda 
  • If you are using (x)inetd, kick inetd/xinetd to make it read its config file. On most systems you can just execute kill -HUP inetd (or xinetd). On older systems you may have to kill it completely and restart it. Note that killing/restarting (x)inetd is not safe to do unless you are sure that no (x)inetd services (like rlogin) are currently in use, otherwise (x)inetd will not be able to bind that port and that service will be unavailable.
  • If you are using the daemontools, svscan should detect and start your new services automatically.
  • 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.