Bacula is an open source network backup solution that allows you create backups and perform data recovery of your computer systems. It is very flexible and robust, which makes it, while slightly cumbersome to configure, suitable for backups in many situations. A backup system is an important component in most server infrastructures, as recovering from data loss is often a critical part of disaster recovery plans.
You must have superuser (sudo) access on an Ubuntu server. Also, the server will require adequate disk space for all of the backups that you plan on retaining at any given time.
If you are using DigitalOcean, you should enable Private Networking on your Bacula server, and all of your client servers that are in the same datacenter region. This will allow your servers to use private networking when performing backups, reducing network overhead.
We will configure Bacula to use the private FQDN of our servers, e.g.
bacula.private.example.com. If you don’t have a DNS setup, use the appropriate IP addresses instead. If you don’t have private networking enabled, replace all network connection information in this tutorial with network addresses that are reachable by servers in question (e.g. public IP addresses or VPN tunnels).
Let’s get started with the installation.
Bacula uses an SQL database, such as MySQL or PostreSQL, to manage its backups catalog. We will use MySQL in this tutorial.
First, update apt-get:
- sudo apt-get update
Now install MySQL Server with apt-get:
- sudo apt-get install mysql-server
You will be prompted for a password for the MySQL database administrative user, root. Enter a password, then confirm it.
Remember this password, as it will be used in the Bacula installation process.
Install the Bacula server and client components, using apt-get:
- sudo apt-get install bacula-server bacula-client
You will be prompted for some information that will be used to configure Postfix, which Bacula uses:
- General Type of Mail Configuration: Choose “Internet Site”
- System Mail Name: Enter your server’s FQDN or hostname
Next, you will be prompted for information that will be used to set up the Bacula database:
- Configure database for bacula-director-mysql with dbconfig-common?: Select “Yes”
- Password of the database’s administrative user: Enter your MySQL root password (set during MySQL installation)
- MySQL application password for bacula-director-mysql: Enter a new password and confirm it, or leave the prompt blank to generate a random password
The last step in the installation is to update the permissions of a script that Bacula uses during its catalog backup job:
- sudo chmod 755 /etc/bacula/scripts/delete_catalog_backup
The Bacula server (and client) components are now installed. Let’s 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. If your system has multiple partitions, make sure to create the directories on one that has sufficient space.
Let’s create new directories for both of these purposes:
- sudo mkdir -p /bacula/backup /bacula/restore
We need to change the file permissions so that only the bacula process (and a superuser) can access these locations:
- sudo chown -R bacula:bacula /bacula
- sudo chmod -R 700 /bacula
Now we’re ready to configure the Bacula Director.
Configure Bacula Director
Bacula has several components that must be configured independently in order to function correctly. The configuration files can all be found in the
We’ll start with the Bacula Director.
Open the Bacula Director configuration file in your favorite text editor. We’ll use vi:
- sudo vi /etc/bacula/bacula-dir.conf