How to Use Bacula for Enterprise Backup on RHEL 7
Bacula is a mature, open-source enterprise backup solution that supports tape libraries, disk-based storage pools, network backup of multiple clients, and flexible scheduling of full, differential, and incremental jobs. Unlike simpler backup tools, Bacula operates as a distributed system with distinct daemons: the Director orchestrates all operations, the Storage Daemon manages media (tape or disk), and the File Daemon runs on each client being backed up. A catalog database (MySQL or PostgreSQL) tracks every file, volume, and job, enabling precise file-level restores. This tutorial covers the complete setup of Bacula on RHEL 7 including package installation, catalog database creation, configuration of all components, scheduling backup jobs, and performing interactive restores with bconsole.
Prerequisites
- RHEL 7 server with a valid subscription and root or sudo access
- MySQL (MariaDB) or PostgreSQL installed and running — this tutorial uses MariaDB
- Sufficient disk space for the backup storage directory
- EPEL repository enabled (
yum install -y epel-release) - All Bacula components in this tutorial run on a single server; for multi-server environments, install only the relevant packages on each machine
Step 1: Install Bacula Packages
Install all Bacula components and MariaDB in one command:
sudo yum install -y bacula-director bacula-storage bacula-console bacula-client mariadb-server
Start and enable MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Follow the prompts to set a root password and remove anonymous users.
Step 2: Create the Bacula Catalog Database
Bacula ships with scripts to create the catalog database and tables. Run them in sequence:
sudo /usr/libexec/bacula/create_mysql_database
sudo /usr/libexec/bacula/make_mysql_tables
sudo /usr/libexec/bacula/grant_mysql_privileges
Each script may prompt for the MariaDB root password. Verify the database was created:
mysql -u root -p -e "SHOW DATABASES;"
You should see bacula in the list. The default Bacula database user is bacula with password bacula — change this in production:
mysql -u root -p -e "ALTER USER 'bacula'@'localhost' IDENTIFIED BY 'StrongBaculaPass1!';"
mysql -u root -p -e "FLUSH PRIVILEGES;"
Step 3: Configure the Bacula Director
The Director configuration file controls all backup jobs, schedules, clients, and storage pools. Edit /etc/bacula/bacula-dir.conf:
sudo vi /etc/bacula/bacula-dir.conf
Key sections to configure (a minimal but functional example):
Director {
Name = bacula-dir
DIRport = 9101
QueryFile = "/etc/bacula/query.sql"
WorkingDirectory = "/var/spool/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 5
Password = "DirectorPassword"
Messages = Daemon
}
JobDefs {
Name = "DefaultJob"
Type = Backup
Level = Incremental
FileSet = "Full Set"
Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = File
Priority = 10
Write Bootstrap = "/var/spool/bacula/%c.bsr"
}
Job {
Name = "BackupLocalhost"
JobDefs = "DefaultJob"
Client = bacula-fd
FileSet = "Full Set"
}
Job {
Name = "RestoreLocalhost"
Type = Restore
Client = bacula-fd
Storage = File
FileSet = "Full Set"
Pool = File
Messages = Standard
Where = /tmp/bacula-restores
}
FileSet {
Name = "Full Set"
Include {
Options { signature = MD5 }
File = /etc
File = /home
File = /var/www
}
Exclude {
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
Schedule {
Name = "WeeklyCycle"
Run = Full 1st sun at 23:05
Run = Differential 2nd-5th sun at 23:05
Run = Incremental mon-sat at 23:05
}
Client {
Name = bacula-fd
Address = localhost
FDPort = 9102
Catalog = MyCatalog
Password = "FDPassword"
File Retention = 60 days
Job Retention = 6 months
AutoPrune = yes
}
Storage {
Name = File
Address = localhost
SDPort = 9103
Password = "SDPassword"
Device = FileChgr1
Media Type = File
Maximum Concurrent Jobs = 10
}
Catalog {
Name = MyCatalog
dbname = "bacula"
dbuser = "bacula"
dbpassword = "StrongBaculaPass1!"
}
Pool {
Name = File
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 365 days
Maximum Volume Bytes = 50G
Maximum Volumes = 100
Label Format = "Vol-"
}
Messages {
Name = Standard
mailcommand = "/usr/sbin/bsmtp -h localhost -f "(Bacula) " -s "Bacula: %t %e of %c %l" %r"
operatorcommand = "/usr/sbin/bsmtp -h localhost -f "(Bacula) " -s "Bacula: Intervention needed for %j" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
mailcommand = "/usr/sbin/bsmtp -h localhost -f "(Bacula) " -s "Bacula daemon message" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
}
Step 4: Configure the Storage Daemon
Edit /etc/bacula/bacula-sd.conf to define the storage device (a directory on disk in this example):
sudo vi /etc/bacula/bacula-sd.conf
Storage {
Name = bacula-sd
SDPort = 9103
WorkingDirectory = "/var/spool/bacula"
Pid Directory = "/var/run"
Maximum Concurrent Jobs = 20
SDAddress = localhost
}
Director {
Name = bacula-dir
Password = "SDPassword"
}
Device {
Name = FileChgr1
Media Type = File
Archive Device = /bacula/backup
LabelMedia = yes
Random Access = Yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
Messages {
Name = Standard
director = bacula-dir = all
}
Create the backup directory and set ownership:
sudo mkdir -p /bacula/backup
sudo chown -R bacula:bacula /bacula
sudo chmod 700 /bacula/backup
Step 5: Configure the File Daemon
Edit /etc/bacula/bacula-fd.conf:
sudo vi /etc/bacula/bacula-fd.conf
FileDaemon {
Name = bacula-fd
FDport = 9102
WorkingDirectory = /var/spool/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
Director {
Name = bacula-dir
Password = "FDPassword"
}
Messages {
Name = Standard
director = bacula-dir = all, !skipped, !restored
}
Step 6: Start Bacula Services
sudo systemctl start bacula-dir
sudo systemctl start bacula-sd
sudo systemctl start bacula-fd
sudo systemctl enable bacula-dir
sudo systemctl enable bacula-sd
sudo systemctl enable bacula-fd
Check the status of each daemon:
sudo systemctl status bacula-dir bacula-sd bacula-fd
If a daemon fails to start, check the log:
sudo tail -50 /var/log/bacula/bacula.log
Step 7: Validate Configuration
Test the Director configuration for syntax errors before running a job:
sudo bacula-dir -t -c /etc/bacula/bacula-dir.conf
A clean configuration produces no output. Any errors will be displayed with line numbers.
Step 8: Label a Volume and Run a Backup with bconsole
Open the interactive Bacula console:
sudo bconsole
Label a storage volume (required before the first backup):
*label
Automatically selected Catalog: MyCatalog
Automatically selected Storage: File
Enter new Volume name: Vol-0001
Defined Pools:
1: File
2: Default
Select the Pool (1-2): 1
Run a backup job:
*run
Automatically selected Job: BackupLocalhost
Run Backup job
JobName: BackupLocalhost
Level: Incremental
Storage: File
...
OK to run? (yes/mod/no): yes
Monitor job status:
*status dir
*messages
List completed jobs:
*list jobs
Step 9: Restore Files with bconsole
To restore files interactively:
*restore all
Automatically selected Catalog: MyCatalog
...
Select the most recent backup for client (1):
1
Navigate the backup tree and mark files to restore:
$ ls
$ mark *
$ done
Then confirm and run the restore:
OK to run? (yes/mod/no): yes
Restored files are placed in /tmp/bacula-restores as configured in the Restore Job definition.
Step 10: Open Firewall Ports
sudo firewall-cmd --permanent --add-port=9101/tcp
sudo firewall-cmd --permanent --add-port=9102/tcp
sudo firewall-cmd --permanent --add-port=9103/tcp
sudo firewall-cmd --reload
Conclusion
Bacula on RHEL 7 provides a comprehensive enterprise backup system with a rich feature set that includes multi-client support, catalog-driven file-level restores, flexible scheduling of full, differential, and incremental backups, and support for both tape and disk storage. You have walked through every layer of the stack: catalog database creation with MariaDB, Director configuration with jobs and schedules, Storage Daemon configuration with a disk-based device, File Daemon setup, and interactive backup and restore operations using bconsole. With this foundation in place, you can extend the setup to additional clients by installing bacula-client on each machine, adding Client and Job stanzas to the Director configuration, and opening the required firewall ports between the Director and each client.