Introduction
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.
In this tutorial, we will show you how to install and configure the server components of Bacula on an Ubuntu 14.04 server. We will configure Bacula to perform a weekly job that creates a local backup (i.e. a backup of its own host). This, by itself, is not a particularly compelling use of Bacula, but it will provide you with a good starting point for creating backups of your other servers, i.e. the backup clients. The next tutorial in this series will cover creating backups of your other, remote, servers by installing and configuring the Bacula client, and configuring the Bacula server.
If you’d rather use CentOS 7 instead, follow this link: How To Install Bacula Server on CentOS 7.
Prerequisites
You must have superuser (sudo) access on an Ubuntu 14.04 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 by looking at an overview of Bacula’s components.
Bacula Component Overview
Although Bacula is composed of several software components, it follows the server-client backup model; to simplify the discussion, we will focus more on the backup server and the backup clients than the individual Bacula components. Still, it is important to have cursory knowledge of the various Bacula components, so we will go over them now.
A Bacula server, which we will also refer to 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
- Storage Daemon (SD): Software that performs reads and writes on the storage devices used for backups
- 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
- Bacula Console: A command-line interface that allows the backup administrator to interact with, and control, Bacula Director
Note: The Bacula server
components don't need to run on the same server, but they all work
together to provide the backup server functionality.
A Bacula client, i.e. a server that will be backed up, runs the File Daemon (FD) component. The File Daemon is software that provides the Bacula server (the Director, specifically) access to the data that will be backed up. We will also refer to these servers as “backup clients” or “clients”.
As we noted in the introduction, we will configure the backup server to create a backup of its own filesystem. This means that the backup server will also be a backup client, and will run the File Daemon component.
Let’s get started with the installation.
Install MySQL
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:
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 Bacula
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. Continue reading Install Bacula Server on Ubuntu 14.04 →