Amanda Backup Server Installation

From Scottworld
Jump to navigation Jump to search

A simple backup solution. Nice backup formats (tarballs) and the ability to restore when it all goes wrong.

Amanda is in the standard ubuntu repository.

apt install amanda-server
apt install amanda-client

As part of the install a user is created for the service to run under in Ubuntu's case this is "backup" remember that for later.

Now we need to set up some directories.

mkdir -p /opt/amanda/holding
mkdir -p /opt/amanda/state
mkdir -p /opt/amanda/state/{curinfo,log,index}    <--- creates all the sub directories
mkdir -p /etc/amanda/solaris_bs1    <--- This is the name of the profile we will call.


Create Tape locations

mkdir -p /srv/backup/vtapes/slot1
mkdir -p /srv/backup/vtapes/slot2
mkdir -p /srv/backup/vtapes/slot3
mkdir -p /srv/backup/vtapes/slot4
mkdir -p /srv/backup/vtapes/slot5

Now add an amanda.conf file.

nano /etc/amanda/solaris_bs1/amanda.conf
org "solaris_bs1"
infofile "/opt/amanda/state/curinfo"
logdir "/opt/amanda/state/log"
indexdir "/opt/amanda/state/index"
dumpuser "backup"

mailer "/usr/bin/mail"
mailto "mark@scottworld.net"

tpchanger "chg-disk:/srv/backup/vtapes"
labelstr "MyData[1-5][1-5]"
autolabel "MyData%%" EMPTY VOLUME_ERROR
tapecycle 4
dumpcycle 3 days
amrecover_changer "changer"

tapetype "TEST-TAPE"
define tapetype TEST-TAPE {
  length 100 mbytes
  filemark 4 kbytes
}

define dumptype simple-gnutar-local {
    auth "local"
    compress none
    program "GNUTAR"
}

holdingdisk hd1 {
    directory "/opt/amanda/holding"
    use 50 mbytes
    chunksize 1 mbyte
}

Now lets create a disklist (which is used to define what gets backup up)

nano /etc/amanda/solaris_bs1/disklist

Add the contents of the backup

localhost /path/share/to/backup simple-gnutar-local 

Grant the backup user permissions on these folders / files

chown backup /opt/amanda -R
chown backup /etc/amanda -R
chown backup /srv/backup -R
chmod 755 /opt/amanda -R
chmod 755 /etc/amanda -R
chmod 755 /srv/backup -R

You need to allow tar to run by amanda and set its path for Ubuntu.

Edit

nano /etc/amanda-security.conf

Uncomment and fix

runtar:gnutar_path=/usr/bin/tar



Do some checks...after becoming backup


sudo -s -u backup
amcheck solaris_bs1

You should get a nice readout of any errors...


Amanda Tape Server Host Check
-----------------------------
NOTE: tapelist file does not exists
      it will be created on the next run
NOTE: Holding disk '/opt/amanda/holding': 442355712 KB disk space available, using 51200 KB as requested
slot 1: contains an empty volume
Will write label 'MyData01' to new volume in slot 1.
NOTE: skipping tape-writable test
NOTE: host info dir '/opt/amanda/state/curinfo/localhost' does not exist
      It will be created on the next run
NOTE: index dir '/opt/amanda/state/index/localhost' does not exist
      it will be created on the next run
Server check took 0.168 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 2.342 seconds.  0 problems found.
(brought to you by Amanda 3.5.1)

Try a backup

amdump solaris_bs1

Check it...

echo $?

If you have a 0 then there is no issue.

0

You can get a nice report..

amreport solaris_bs1

You can then cron these,

nano /etc/cron.d/amanda
0 18 * * * backup /usr/sbin/amcheck -m solaris_bs1
15 3 * * * backup /usr/sbin/amdump solaris_bs1

We can now add more locations to backup Add the backup user to the sambausers group.

usermod -a -G sambausers backup

Now edit disklist and update the file with more shares add to the backup job (remember the "backup" user must have READ access to back up the target files.)

 nano /etc/amanda/solaris_bs1/disklist
localhost /etc simple-gnutar-local
localhost /opt simple-gnutar-local
localhost /srv/media/music simple-gnutar-local
localhost /srv/media/photos simple-gnutar-local
localhost /srv/data/documents simple-gnutar-local
localhost /srv/data/www simple-gnutar-local
localhost /srv/data/scottcloud simple-gnutar-local
localhost /srv/data/mysql simple-gnutar-local