Bacula Backup Server – Part 1


Bacula is an Open Source, computer programs that permit system administrator to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bacula is relatively easy to use and very efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. In technical terms, it is an Open Source, network based backup program.

Director & Storage server:
Hostname: mgmtsrv.lguru.local
IPAddress: 192.168.1.173
OS: CentOS 6.9

Step 1: Install Bacula director and storage daemon packages

[root@mgmtsrv ~]# yum -y install bacula-director-mysql bacula-storage-mysql bacula-console mysql-server mysql-devel

Step 2: Configure Bacula MySQL database

Set the mysql root password

[root@mgmtsrv ~]# mysqladmin -u root password password

Enter the mysql root password for below database configuration

[root@mgmtsrv ~]# /usr/libexec/bacula/grant_mysql_privileges -p
Enter password:
Privileges for user bacula granted on database bacula.

[root@mgmtsrv ~]# /usr/libexec/bacula/create_mysql_database -p
Enter password:
Creation of bacula database succeeded.

[root@mgmtsrv ~]# /usr/libexec/bacula/make_mysql_tables -p
Enter password:
Creation of Bacula MySQL tables succeeded.

Set the password for bacula database.

[root@mgmtsrv ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password for bacula=password('password');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for bacula@localhost=password('password');
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Step 3: Configure Bacula director

[root@mgmtsrv ~]# vi /etc/bacula/bacula-dir.conf

[........]

Director {
Name = bacula-dir
DIRport = 9101
QueryFile = "/usr/libexec/bacula/query.sql"
WorkingDirectory = "/var/spool/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "password" # Password to connect Director Daemon Line 22
Messages = Daemon
}

FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
Compression = GZIP # Backup Compression method Line 91
}
File = /opt # Backup target on Client Line 110
}

Client {
Name = bacula-fd
Address = client.lguru.local # Client Hostname Line 158
FDPort = 9102
Catalog = MyCatalog
Password = "password" # Password to connect Client Line 161
File Retention = 30 days
Job Retention = 6 months
AutoPrune = yes
}

Storage {
Name = File
Address = mgmtsrv.lguru.local # Storage Daemon hostname Line 187
SDPort = 9103
Password = "password" # Storage Daemon password
Device = FileStorage
Media Type = File
}

Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:sqlite3"; dbaddress = 127.0.0.1; dbport =
dbname = "bacula"; dbuser = "bacula"; dbpassword = "password" # Bacula MySQL password Line 236
}

# line 312-316: make them comments
#Console {
# Name = bacula-mon
# Password = "@@MON_DIR_PASSWORD@@"
# CommandACL = status, .status
#}

[root@mgmtsrv ~]# vi /usr/libexec/bacula/make_catalog_backup.pl
# Add below line in line no 108
exec("HOME='$wd' mysqldump -f -u$args{db_user} -p$args{db_password} --opt $args{db_name} > '$wd/$args{db_name}.sql'");

Step 4: Bacula Storage Daemon configuration

[root@mgmtsrv ~]# vi /etc/bacula/bacula-sd.conf
Director {
Name = bacula-dir
Password = "password" # Storage Daemon password Line 26
}


# line 33-37: make them comments
#Director {
# Name = bacula-mon
# Password = "@@MON_SD_PASSWORD@@"
# Monitor = yes
#}

Step 5: Bacula console configuration

[root@mgmtsrv ~]# vi /etc/bacula/bconsole.conf
Director {
Name = bacula-dir
DIRport = 9101
address = mgmtsrv.lguru.local # Director Daemon hostname
Password = "password" # Director Daemon password
}

Step 6: Start and test the connectivity

[root@mgmtsrv ~]# /etc/init.d/bacula-dir start
Starting bacula-dir: [ OK ]

[root@mgmtsrv ~]# /etc/init.d/bacula-sd start
Starting bacula-sd: [ OK ]

[root@mgmtsrv ~]# chkconfig bacula-dir on
[root@mgmtsrv ~]# chkconfig bacula-sd on

[root@mgmtsrv ~]# netstat -anp | grep 9101
tcp 0 0 0.0.0.0:9101 0.0.0.0:* LISTEN 8414/bacula-dir

[root@mgmtsrv ~]# netstat -anp | grep 9103
tcp 0 0 0.0.0.0:9103 0.0.0.0:* LISTEN 8388/bacula-sd