Bacula Web Centos 7 – Installation Guide


Bacula Web Centos 7 – Installation Guide- Bacula backup method is the ideal backup solution for many circumstances due to its versatility and richness. This tutorial will show you how to set up a Bacula Web Centos 7 server.

An overview of the Bacula components

  • Catalog – these are backup database file maintenance services. SQL databases such as PostgreSQL and MySQL are used to store the database.
  • Bacula Director (DIR) — This software manages file and storage daemon backup and restore procedures.
  • Storage daemons (SD) — this programme is in charge of the read and write operations on backup storage devices.
  • Bacula Console — This is a command line interface that allows the backup administrator to communicate with the control and DIR.

How to install Bacula and MySQL

MariaDB can be used as a drop-in replacement for MySQL in this tutorial. Yum may be used to install MariaDB and Bacula. sudo yum install bacula-director bacula-storage bacula-director bacula-storage bacula-console mariadb-server bacula-client

Once the installation is complete, use the following command to start MySQL: sudo systemctl mariadb start

Then, using these scripts, create a Bacula database user and tables:

  • /usr/libexec/bacula/grant mysql privileges
  • /usr/libexec/bacula/create mysql database -u root
  • /usr/libexec/bacula/make mysql tables -u bacula

To get rid of harmful defaults and lock off access to your database system, run a simple security script. Run sudo mysql secure installation to begin the interactive script.

Because your MySQL installation is new, you can skip the root password prompt. Accept the default values by continuing through the rest of the dialogue.

Type the MySQL console as the root user and set the password for the user database: mysql -u root –p, then enter the root password you set when requested. Set the database user’s password: MAKE A MODIFICATION TO MYSQL.USER PASSWORD(‘bacula db password’) SET Password=PASSWORD(‘bacula db password’) WHERE User=’bacula’; FLUSH PRIVILEGES; replace the ‘Baculadbpassoword’ with a secure password.

Exit the MySQL prompt and use the command sudo systemctl enable mariadb to enable MariaDB to boot.

Setting Bacula to use the MySQL library

Set Bacula to use the MySQL Library. You can do this by running command: sudo alternatives –config

On the prompt:


There are 3 programs which provide ‘’.

*+ 3/usr/lib64/

Enter selection 1, which is MySQL to install the Bacula server/client components.

Creating backup and restoring directories

For Bacula to work on Centos 7, it needs a backup directory for backup archives and a restore directory for storing restored files. To create a new directory: sudo mkdir -p /bacula/backup /bacula/restore Change the file permissions to ensure only Bacula can access these location. To do this:

sudo chown -R bacula:bacula /bacula
sudo chmod -R 700 /bacula

Configuring Bacula Director

Access the configurations files in the /etc/bacula directory.

Open DIR configurations file in a text editor such as sudo vi /etc/bacula/bacula-dir.conf

Locate the DIR resource and configure to listen to local host by adding the DirAddress line:

Director {                            # define myself
Name = bacula-dir
DIRport = 9101                # where we listen for UA connections
QueryFile = "/etc/bacula/query.sql"
WorkingDirectory = "/var/spool/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "@@DIR_PASSWORD@@"         # Console password
Messages = Daemon
DirAddress =

Configuring local jobs

Find the job resource named ‘NackupClient1’ and change the name to ‘BackupLocalFiles.

Job {
Name = "BackupLocalFiles"
JobDefs = "DefaultJob"

Change ‘RestoreFiles’ to ‘RestoreLocalFiles’ and the value of ‘where’ to /bacula/restore

Job {
Name = "RestoreLocalFiles"
Type = Restore
FileSet="Full Set"
Storage = File
Pool = Default
Messages = Standard
Where = /bacula/restore

Configuring file set

FileSet {
Name = "Full Set"
Include {
    Options {
    signature = MD5
    compression = GZIP
File = /
Exclude {
    File = /var/lib/bacula
    File = /proc
    File = /tmp
    File = /.journal
    File = /.fsck
    File = /bacula

Configure storage daemon connection

Storage {
Name = File
# Do not use "localhost" here
Address = backup_server_private_FQDN                # N.B. Use a fully qualified name here
SDPort = 9103
Password = "@@SD_PASSWORD@@"
Device = FileStorage
Media Type = File

Configure catalog connection

# Generic catalog service

Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:postgresql"; dbaddress =; dbport =
dbname = "bacula"; dbuser = "bacula"; dbpassword = "bacula_db_password"

Configure pool

# File Pool definition

Pool {
Name = File
Pool Type = Backup
Label Format = Local-
Recycle = yes                       # Bacula can automatically recycle Volumes
AutoPrune = yes                     # Prune expired volumes
Volume Retention = 365 days         # one year
Maximum Volume Bytes = 50G          # Limit Volume size to something reasonable
Maximum Volumes = 100               # Limit number of Volumes in Pool

Check DIR configuration

sudo bacula-dir -tc /etc/bacula/bacula-dir.conf – if it shows no error messages, you can move to configuring the storage daemon.

Configure Storage Daemon

Open SD configuration in a text editor: sudo vi /etc/bacula/bacula-sd.conf

Configure the storage resource:

Storage {                             # definition of myself
Name = BackupServer-sd
SDPort = 9103                  # Director's port
WorkingDirectory = "/var/lib/bacula"
Pid Directory = "/var/run/bacula"
Maximum Concurrent Jobs = 20
SDAddress = backup_server_private_FQDN

Configure storage device

Device {
Name = FileStorage
Media Type = File
Archive Device = /bacula/backup
LabelMedia = yes;                   # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes;               # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;

Verify storage daemon configuration: sudo bacula-sd -tc /etc/bacula/bacula-sd.conf

This completes the Bacula configuration. You can restart the Bacula server components.

Setting Bacula Component Passwords

DIR password command:

DIR_PASSWORD=`date +%s | sha256sum | base64 | head -c 33`
sudo sed -i "s/@@DIR_PASSWORD@@/${DIR_PASSWORD}/" /etc/bacula/bacula-dir.conf
sudo sed -i "s/@@DIR_PASSWORD@@/${DIR_PASSWORD}/" /etc/bacula/bconsole.conf

Storage daemon password command:

SD_PASSWORD=`date +%s | sha256sum | base64 | head -c 33`
sudo sed -i "s/@@SD_PASSWORD@@/${SD_PASSWORD}/" /etc/bacula/bacula-sd.conf
sudo sed -i "s/@@SD_PASSWORD@@/${SD_PASSWORD}/" /etc/bacula/bacula-dir.conf

Local file daemon password command:

FD_PASSWORD=`date +%s | sha256sum | base64 | head -c 33`
sudo sed -i "s/@@FD_PASSWORD@@/${FD_PASSWORD}/" /etc/bacula/bacula-dir.conf
sudo sed -i "s/@@FD_PASSWORD@@/${FD_PASSWORD}/" /etc/bacula/bacula-fd.conf

You can now start your Bacula components and test the backup job.

Jennifer Thomas
Jennifer Thomas is the Co-founder and Chief Business Development Officer at Cybers Guards. Prior to that, She was responsible for leading its Cyber Security Practice and Cyber Security Operations Center, which provided managed security services.