Bacula provides a highly flexible and scalable data backup solution that is suitable for small businesses as well as large enterprises with complex IT infrastructures. This short tutorial will teach you the basics of how you can use it to backup your data.
Bacula is an open source, enterprise-level backup and recovery software designed to manage backup, recovery, and verification of data across a network of computers, regardless of their operating systems. This powerful backup and recovery software can be deployed on a variety of operating systems, including Windows, Linux, and UNIX-based platforms.
Bacula ensures data integrity and availability by providing reliable backup and recovery options, safeguarding against data loss caused by hardware failures, human errors, or cyberattacks. Being an open source solution, it reduces licensing costs while delivering enterprise-grade features. It is highly scalable and comes with features for compliance and auditing.
Installation
To install Bacula, you need a system running a supported operating system like Linux, Windows, macOS, or UNIX, with Linux being the most used platform. Hardware requirements depend on the scale of the backup environment, but typically include sufficient CPU power, adequate RAM, and ample storage space to accommodate backup data and the Bacula catalogue database. A stable network connection is essential for seamless communication between Bacula components.
On the software side, a supported database system like MySQL, PostgreSQL, or SQLite is required for catalogue management, along with the necessary dependency libraries such as OpenSSL for encryption and zlib for compression. Backup media options include disks, tapes, or cloud storage, depending on the specific needs of your organisation.
For the setup we will be using any RPM-based Linux distribution with MySQL installed on it.
To install the Bacula software suite, an open source enterprise-level backup solution, use the command given below:
[root] dnf -y install bacula-director bacula-storage bacula-console bacula-client
Preparing and setting up MySQL for Bacula
To set Bacula to use the MySQL library, you can run the command:
[root] alternatives --config libbaccats.so
Let’s create the Bacula database user and tables with the following scripts, or you can do it manually:
/usr/libexec/bacula/grant_mysql_privileges /usr/libexec/bacula/create_mysql_database -u root /usr/libexec/bacula/make_mysql_tables -u OSFY
Use the following command to go to the mysql prompt and then create a database for OSFY with the permissions mentioned below:
[root]mysql [mysql]create database OSFY [mysql] grant all privileges on OSFY.* to OSFY@’127.0.0.1’ identified by ‘OSFY’; [mysql] grant all privileges on OSFY.* to OSFY@’%’ identified by ‘OSFY’; [mysql] flush privileges;
Next, you can create the table for the OSFY database:
[root]/usr/libexec/OSFY/make_mysql_tables
Now we need to configure Bacula. To set the Bacula directory, use the following command:
[root] vi /etc/bacula/bacula-dir.conf # line 25 : set password for Director Password = “OSFY” # line 110 : add (enable RAR or ZIP compress) Compression = RAR # line 126 : specify backup target directory File = /home # line 178 : password for File daemon Password = “OSFY” # line 204 : change to FQDN of your host according to the note Address = opensourceforu.com # line 206 : password for Storage daemon Password = “OSFY” # line 243 : password of Mysql bacula user dbname = “OSFY”; dbuser = “OSFY”; dbpassword = “OSFY” # line 304 : volume retention term Volume Retention = 300 days # max volume size Maximum Volume Bytes = 75GB # max volume number Maximum Volumes = 150 # prefix for volume files Label Format = “OSFY-” # line 322 : tray-monitor password Password = “OSFY”
The following command is for the Bacula console:
[root] vi /etc/bacula/bconsole.conf # password for Director Password = “OSFY” [root] systemctl enable --now bacula-dir
Configuring Bacula storage
Use the following command to configure Bacula storage:
[root]vi /etc/bacula/bacula-sd.conf
The file /etc/bacula/bacula-sd.conf is the main configuration file for the storage daemon. The two specified changes in the file are:
# line 31 : set password for Storage daemon Password = “OSFY” # line 40 : tray-monitor password Password = “OSFY” [root] systemctl enable --now bacula-sd
Use the following command to configure the Bacula file:
[root] vi /etc/bacula/bacula-fd.conf # line 19 : set password for File daemon Password = “OSFY” [root] systemctl enable --now bacula-fd
Running Bacula backup
To create and manage backups in Bacula, first define and configure resources in Bacula’s configuration files, and then execute backup jobs. To access the Bacula console, use the following command:
[root] bconsole $list jobs //list available jobs $run //Run the backup job
Bacula will prompt you to confirm the job.
Automatically selected Catalog: OSFY Using Catalog “OSFY” A job name must be specified. Enter job name: OSFY-1
Select the job and run the command:
[root] 25 /tmp
Follow the prompts to select the job, client, and other options.
Once the backup has started, you can monitor the backup process in the bconsole:
[root] status director

Restoring files in Bacula
Restoring files in Bacula involves several steps, including identifying the backup job, selecting the files to restore, and executing the restore operation. But before you do that:
- Ensure that the director, storage daemon, and file daemon services are operational.
- Verify that you have access to the Bacula console (bconsole).
- Ensure that the secondary storage device is accessible.
You can choose from different options when restoring your files.
Option 1: Restore your most recent backup.
Option 2: Restore a backup before a certain date and time.
Option 3: View and choose from a list of available backups.
Option 4: Restore particular files.
[root] bconsole # start restore task (Job) *restore $ ls $ mark home $ lsmark $ done # run restore job OK to run? (yes/mod/no): yes [root] l5 /tmp/bacula-restores/home # backup data restored
Adopting Bacula as an open source backup solution reflects a commitment to protecting your most valuable asset — your data. Bacula’s proven reliability, cost-effectiveness, and scalability put us in a good position to reduce risk, improve productivity, and maintain business continuity in an increasingly data-driven world.