Menu

Installing Bareos on Centos 7

June 4, 2017 - Guides, Linux
Installing Bareos on Centos 7

 

 

On this guide I’ll show you how to install Bareos on Centos7, together with the webui and make a test backup with deduplication

 

What is Bareos?

Bareos is powerfull opensource backup solution, it’s a fork of Bacula and has many enterprise level features like deduplication and synthetic Full jobs.

 

Let’s start with the Installation, first make sure you have a fully updated system:

yum update

 

You’ll need mysql/mariadb, so run the following command:

yum install mysql

In my case, i’m using mysql, instead of Mariadb, that comes by default on Centos7, but this is irrelevant for Bareos Configuration, i’ll show how to change mysql package on Centos7 on another guide soon.

 

Download Bareos repo config like this:

wget -O /etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo

 

Now that we have Bareos Repository configured, we can install Bareos packages, in this case, Bareos with Mysql support:

yum install bareos bareos-database-mysql

 

 

Now that we have Bareos installed, we’ll use some Bareos scripts to create the database and necessary tables:

Create the Bareos database running this:

/usr/lib/bareos/scripts/create_bareos_database -u root -p

(It will ask for the mysql root password)

 

Create Tables on the database running this:

/usr/lib/bareos/scripts/make_bareos_tables -u root -p

 

Create the user to work with the database:

/usr/lib/bareos/scripts/grant_bareos_privileges -u root -p

This will create the user “bareos” to work with the database, this user has no password, so i’ll setup a password for this users:

mysql -u root -p

grant all privileges on bareos.* to bareos@localhost identified by ‘mypassword’;

flush privileges;

 

Bareos is installed!

Let’s install webgui, for this we need some packages installed.

Necessary packages:

yum install httpd php php-cli php-common

 

Bareos webui package:

yum install bareos-webui

 

Now that Webui is installed, you must take care of all the configurations.

Bareos has a different config scheme, spreading configuration files through several folders and files, instead of the basic DIR, FD and SD files on Bacula, but you’ll get used to it, basic configuration options are pretty much the same.

 

Let’s just check a couple of configuration files so that Bareos Dir can connect with the Database and the Webui can connect to the Bareos Dir

 

Check the following file: /etc/bareos-webui/directors.ini, make sure the configuration is correct.

 

Now before we start Bareos services, let’s adjust the database configuration, since we set a password for the user accessing the database, we need to set this on Bareos configuration:

vi /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf

And set the “dbpasssword” field to the password you set for the Bareos user.

 

Now let’s start services:

systemctl start bareos-dir

systemctl start bareos-sd

systemctl start bareos-fd

 

To create a user for the webui, open bconsole and type the following command:

configure add console name=admin password=superpassword profile=webui-admin

 

Now you can point your web browser to your server and access the webui, the old BAT software is now deprecated in favor of the webui.

This should get you started, look around all configuration files under /etc/bareos/** to configure Bareos.

 

*Side notes:

Always make sure the configuration files owner is the user Bareos.

If you fail to start services, run the following command to try to identify the cause:  journalctl -xe

 

One of the great features about Bareos is Data Deduplication.

What is this and how it works?

Deduplication will divide information in blocks, each file has it’s unique block IDs, when a full backup is done after the base deduplication job, it will compare information to backup with the information stored from the Base Job.

 

What will happen is that if information to backup already exists on the Base Job, it won’t be copied, instead, a pointer will be placed, pointing to the corresponding identical information on the storage.

A test base job would look like this:

 

Under Job configuration:

Job {
Name = “test-base”
JobDefs = “test-base”
Level = Base
Client = “monitor”
}

Under Jobdef configuration:

JobDefs {
Name = “test-base”
Type = Backup
Level = Base
Client = monitor
FileSet = “SelfTest” # selftest fileset (#13)
Schedule = “WeeklyCycle”
Storage = VLS
Messages = Standard
Pool = Incremental
Priority = 10
Write Bootstrap = “/var/lib/bareos/%c.bsr”
Full Backup Pool = Full # write Full Backups into “Full” Pool (#05)
Differential Backup Pool = Diferencial # write Diff Backups into “Differential” Pool (#08)
Incremental Backup Pool = Incremental # write Incr Backups into “Incremental” Pool (#11)
Accurate = yes
Spool Attributes = yes
}

 

And the posterior job that will compare information with the base Job:

 

Under Job configuration:

Job {
Name = “test-dedup”
JobDefs = “test-dedup”
Base = test-base
Client = “monitor”
}

 

Under JobDefs configuration:

JobDefs {
Name = “test-dedup”
Type = Backup
Level = Full
Client = monitor
FileSet = “SelfTest” # selftest fileset (#13)
Schedule = “WeeklyCycle”
Storage = VLS
Messages = Standard
Pool = Incremental
Priority = 10
Write Bootstrap = “/var/lib/bareos/%c.bsr”
Full Backup Pool = Full # write Full Backups into “Full” Pool (#05)
Differential Backup Pool = Diferencial # write Diff Backups into “Differential” Pool (#08)
Incremental Backup Pool = Incremental # write Incr Backups into “Incremental” Pool (#11)
Accurate = yes
Spool Attributes = yes
}

 

You can see that the test base job copied over 1GB of information:

The Full backup after, with deduplication, copied only 97MB, saving a lot of space on the storage:

 

Please follow and like me at:

Leave a Reply

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