Creating an Ubuntu backup server with Bareos

After my struggle trying to install and use AMANDA, I was left defeated with my ego bruised. I could either admit defeat and just go with Acronis without any additional research or I could try again. I went with the latter and set about choosing another option to test.
A quick google had Bacula coming up trumps with Bareos (a fork of Bacula) being a close second. Delving in a little deeper, it would appear that the development on the open source part of Bacula had all but ceased a few years back whereas Bareos was picking up the slack and continuing active development. They had a good spiel about cleaner configs and all that jazz so I decided to give it a go. (The docs also were 10000x better than AMANDA).

Installing the Bareos Server

There are a variety of backend databases you can use for Bareos:

  • MySQL
  • PostgreSQL
  • SQLite

I decided to go with MySQL because it was the db package I was most familiar and comfortable with. The install process was then as simple as:

DIST=xUbuntu_14.04
DATABASE=mysql
URL=http://download.bareos.org/bareos/release/latest/$DIST/
# add the Bareos repository
printf "deb $URL /\n" > /etc/apt/sources.list.d/bareos.list
# add package key
wget -q $URL/Release.key -O- | apt-key add -
# install Bareos packages
apt-get update
apt-get install bareos bareos-database-$DATABASE

Replacing the DIST key with your appropriate distribution as per the docs.
During the install, you will be asked if you want to set up the database to use. I decided against this (read: I hit the wrong key) so I had to perform an additional setup step.
Create the mysql config file at ~/.my.cnf with the following content:

[client]
host=localhost
user=root
password=YourPasswordForAccessingMysqlAsRoot

Then run the following commands after choosing a suitable password to protect the database:

export db_password=YourSecretPassword
/usr/lib/bareos/scripts/create_bareos_database
/usr/lib/bareos/scripts/make_bareos_tables
/usr/lib/bareos/scripts/grant_bareos_privileges

Update the file /etc/bareos/bareosdir.conf to include your chosen password and you’re good to go!

...
#
# Generic catalog service
#
Catalog {
 Name = MyCatalog
 # Uncomment the following lines if you want the dbi driver
 # dbdriver = "dbi:postgresql"; dbaddress = 127.0.0.1; dbport =
 dbdriver = "mysql"
 dbname = "bareos"
 dbuser = "bareos"
 dbpassword = "YourSecretPassword"
}
...

Double check that you can access the new db with:

mysql u bareos pYourSecretPassword bareos 

before starting the daemons and you have Bareos installed!

service bareos-dir start
service bareos-sd start
service bareos-fd start

You can look at the docs if you want to know more about it but the basics are that Bareos consists of a few programs that are run on both client and server machines to coordinate file system backups:

Bareos Director

The Bareos Director service is the program that supervises all the backup, restore, verify and archive operations. The system administrator uses the Bareos Director to schedule backups and to recover files…

Bareos Console

The Bareos Console service is the program that allows the administrator or user to communicate with the Bareos Director….

Bareos File Daemon

The Bareos File service (also known as the Client program) is the software program that is installed on the machine to be backed up. It is specific to the operating system on which it runs and is responsible for providing the file attributes and data when requested by the Director. The File services are also responsible for the file system dependent part of restoring the file attributes and data during a recovery operation. This program runs as a daemon on the machine to be backed up.

Bareos Storage Daemon

The Bareos Storage services consist of the software programs that perform the storage and recovery of the file attributes and data to the physical backup media or volumes. In other words, the Storage daemon is responsible for reading and writing your tapes (or other storage media, e.g. files). The Storage services runs as a daemon on the machine that has the backup device (such as a tape drive).

Catalog

The Catalog services are comprised of the software programs responsible for maintaining the file indexes and volume databases for all files backed up. The Catalog services permit the system administrator or user to quickly locate and restore any desired file. The Catalog services sets Bareos apart from simple backup programs like tar and bru, because the catalog maintains a record of all Volumes used, all Jobs run, and all Files saved, permitting efficient restoration and Volume management…

Installing the Bareos WebGUI

Now although the Bareos console gets installed in the previous step, it may be useful to have a webgui that everyone can access to see that status of the backup operation if they don’t have SSH access to the main Bareos server (which I’ll call the director from now on).
It’s a pretty simple process of running:

apt-get install bareos-webui
echo "@/etc/bareos/bareos-dir.d/webui-consoles.conf" >> /etc/bareos/bareos-dir.conf
echo "@/etc/bareos/bareos-dir.d/webui-profiles.conf" >> /etc/bareos/bareos-dir.conf

The install process will have copied a config file to your apache config directory so restart the apache and director services

service apache2 restart
service bareos-dir restart

and access the webgui at http://<YOUR DIRECTOR IP HERE>/bareos-webui and try to login with the details you have in

/etc/bareos/bareos-dir.d/webui-profiles.conf

 

Leave a Comment

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