How to Backup Ubuntu Server 20.04 with Bacula

Bacula is a powerful backup tool. It is highly scalable, works over the network, allows you to check and encrypt data, and has many other advantages.
In this tutorial, we will walk through the steps to configure a file backup on a local computer.

First, let’s take a look at the Bacula components:

Step 1 – Installing Bacula and database

Bacula uses the Postfix server to send email notifications when a task is completed. You need to install and configure it if you want to receive emails. The setup process is described here: How to install and configure Postfix as a send-only SMTP server

Let’s install Bacula

apt install bacula

Enter the Postfix configuration data when prompted, or select «no connection» if you don’t need emails.

In the next step, select «Yes “to configure the PostgreSQL database server and” localhost» for its hostname. You can leave the password field empty.

Screenshot 1. PostgreSQL database configuration

Step 2 – Configuring Bacula

First, set up a backup storage device. Create a folder for recording backups and make bacula its owner.

mkdir /opt/backup
chown bacula:bacula /opt/backup

Add the following configuration to the file /etc/bacula/bacula-sd.conf:

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

To apply the changes, restart the service.

sudo systemctl restart bacula-sd.service

Now you need to add storage information to /etc/bacula/bacula-dir.conf. Note that the password must match the password string in bacula-sd.conf

Storage {
Name = LocalSD # Must be equal to the "Name" parameter of the "Storage" section in the /etc/bacula/bacula-sd.conf file
Address =
Password = "Password"
Device = LocalSD
Media Type = File

Also, add information about the new FileSet that specifies the directories to back up.

FileSet {
Name = "LocalFS"
Include {
Options {
signature = MD5
File = /home

In this example, the /home folder is selected for backup. You can also add other goals in the same way. Keep in mind that the folder where backups located should not be backed up.

Also, add a Schedule:

Schedule {
Name = "LocalDaily"
Run = Full daily at 03:00

The last one is the Job configuration:

Job {
Name = "LocalBackup"
JobDefs = "DefaultJob"
Enabled = yes
Level = Full
FileSet = "LocalFS"
Schedule = "LocalDaily"
Storage = LocalSD
Write Bootstrap = "/var/lib/bacula/LocalhostBackup.bsr"

Save the file and close it, restart the service.

systemctl restart bacula-dir

Bacula will now run a full backup of the specified folders daily at 03:00. If you want to do this immediately, log in to the bconsole, type “run” select «LocalBackup», and confirm it. To check the job status, enter «status» and select «1».

To restore files, use the “restore” command in the bconsole and follow the instructions.