How to Configure Bacula Server on Ubuntu 16.04

Hello and welcome, our today's article s on installation and configuration of Bacula (an open source network backup solution) on Ubuntu 15.10 /16.04. You can use it to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bacula is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. Due to its modular design, Bacula is scalable from small single computer systems to systems consisting of hundreds of computers located over a large network.

Bacula is composed of several software components including backup server and the backup clients.
A Bacula server, which we will refer as the "backup server", has these components:

Bacula Director (DIR): Software that controls the backup and restore operations that are performed by the File and Storage daemons

Catalog: Services that maintain a database of files that are backed up. The database is stored in an SQL database such as MySQL or PostgreSQL

Storage Daemon (SD): Software that performs reads and writes on the storage devices used for backups

Bacula Console: A command-line interface that allows the backup administrator to interact with, and control, Bacula Director

A Bacula client (backup clients) is a server that will be backed up and runs the File Daemon (FD) component. The File Daemon is software that provides the Bacula server access to the data that will be backed up.


We are going to install and configure Bacula on Ubuntu 15.10 server but you can follow the same instructions on the previous, such as Ubuntu 15.04 but you might get compatibility issues in Ubuntu 16.04.

Let's login to your Ubuntu server using your root credentials, give it an IP address and configure its FQDN. Make sure you have an Internet connection to update your system with below commands.

# apt-get update && apt-get upgrade
system update

Once your system is back with latest updates and security patches then proceed to the next step.

Installing MySQL

Bacula uses an SQL database to manage its information. You can use either MySQL or PostgreSQL database but in this article we will are going to use MySQL. To install MySQL on your Ubuntu server just run the below command in your command line terminal.

# apt-get install mysql-server
MySQL Installation

During MySQL installation, you’ll be asked to set the database administrator password. Enter the password and click Ok. While not mandatory, but it is highly recommended that you set a password for the MySQL administrative "root" user and then repeat the same password that you have setup.

Mysql Passowrd

Installing Bacula Component

Now, let us install Bacula server and client components using the following command.

# apt-get install bacula-server bacula-client
Bacula installation

Once you proceed the installation, You will be prompted for some information that will be used to configure Postfix MTA which Bacula uses by default. Let's choose "Internet Site" as the general Type of Mail Configuration and click on 'OK' . You are also free to select the other mail server configuration type that best meets your needs.

Postfix Configuration

Next you will be asked to setup your system mail name, that will be your fully qualified domain name.

system mail name

Select 'Yes' to configure database for Bacula with dbconfig-common as shown.

bacula director mysql

Then Enter the MySQL database administrator password and click on 'OK' key.

Bacula Password

Once again set the MySQL application password for bacula-director-mysql to register with the database server. If left blank, a random password will be generated.

Mysql app password

Reconfirm the same password.

reconfirm password

We have done with the installation of Bacula and its components, now we will create the backup and restore directories.

Create Backup and Restore Directories:

Bacula needs a backup directory for storing backup archives and restore directory where restored files will be placed. So, if your system has multiple partitions then make sure to create the directories on one of large partition.

Run the commands below to create new directories for both backup and restore points.

# mkdir -p /b_backup/backup /b_backup/restore

Set the ownership and then permissions to the above directories using below commands.

# chown -R bacula:bacula /b_backup/
# chmod -R 700 /b_backup/

Configuring Bacula

All the configuration files of Bacula can be found in the '/etc/bacula' directory. Bacula has several components that must be configured independently in order to function correctly.

First open the below file to Update Bacula Director configuration.

# vim /etc/bacula/bacula-dir.conf

Update the restore path by finding the below path in your configuration file. In our case, /b_backup/restore is the restore location.

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

Now scroll down to “list of files to be backed up” section, and set the path of the directory to backup.

File = /home/
configure bacula

Scroll down further and you will finds the Exclude section where you set the list of directories to be excluded from the backup.

Exclude {
File = /var/lib/bacula
File = /nonexistant/path/to/file/archive/dir
File = /proc
File = /tmp
File = /.journal
File = /.fsck
File = /b_backup

Save and close the file after making above changes and move to the next step.

Update Bacula Storage Daemon settings

Edit /etc/bacula/bacula-sd.conf file using your editor with below configurations to set the backup folder location, which is /mybackup/backup in our case.

# vim /etc/bacula/bacula-sd.conf
bacula storage daemon

Now, check if all the configurations are valid as shown below.

If the commands displays nothing, the configuration changes are valid.

# bacula-dir -tc /etc/bacula/bacula-dir.conf
# bacula-sd -tc /etc/bacula/bacula-sd.conf
check configurations

Once you done all the changes, restart all bacula services.

# systemctl restart bacula-director
# systemctl restart bacula-fd
# systemctl restart bacula-sd

That’s it. Now, bacula has been installed and configured successfully.

Testing Backup Job

After restarting services, let's test that it works by running a backup job.

We will use the Bacula Console to run our first backup job. If it runs without any issues, we will know that Bacula is configured properly. Enter the Console with below command.

# bconsole

This will take you to the Bacula Console prompt, denoted by a * prompt. Create a Label by issuing a label command. Then you will be prompted to enter a volume name and select the pool that the backup should use. We'll use the "File" pool that we configured earlier, by entering "2".

At this point Bacula now knows how we want to write the data for our backup. We can now run our backup to test that it works correctly using 'run' command then you will be prompted to select which job to run. We want to run the "BackupLocalFiles" job, so enter "1" at the prompt. At the "Run Backup job" confirmation prompt, review the details, then enter "yes" to run the job as you will see a new message as shown below.

test backup job

After running a job, Bacula will tell you that you have messages. The messages are output generated by running jobs. Check the messages by typing 'message'.

test backup message

Another way to see the status of the job is to check the status of the Director. To do this, enter this command at the console prompt.

*status director
status director

The "OK" status indicates that the backup job ran without any problems. Congratulations! You have a backup of the "Full Set" of your Bacula server.

Testing Restore Job

Now that a backup has been created, it is important to check that it can be restored properly. The restore command will allow us restore files that were backed up. To demonstrate, we'll restore all of the files in our last backup.

* restore all

A selection menu will appear with many different options, which are used to identify which backup set to restore from. Since we only have a single backup, let's "Select the most recent backup"—select option 5. When you are finished making your restore selection, proceed by typing 'done' as shown below.

testing restore

As with backup jobs, you should check the messages and Director status after running a restore job. Let's heck the messages by typing 'message'.

restore message

Again, checking the Director status is a great way to see the state of a restore job.

*status director
status director

Managing and working with Bacula via command line might be bit difficult for some administrators but in that case you have the option to use Webmin. So, you don’t have to remember all commands or edit any configuration files manually.


In this article, you have learned the basic Bacula setup and how it can backup and restore your local file system. You can also add your other servers as backup clients so you can recover them, in case of data loss. Do share your comments and suggestions. Thank you for reading this article.

1 thought on “How to Configure Bacula Server on Ubuntu 16.04”... add one

  1. During step 2, the install of the server and client, I was prompted to configure a sqlite3 database, not a mysql database. This is under Ubuntu 16.04. Is there a component that is missing?



Leave a Comment