Install And Configure Bacula In Ubuntu 15.04

About Bacula

Bacula is an open source network backup solution that permits you to backup and restore the data from a local or a group of remote networked computers and vice versa. Bacula is very easy in terms of installation and configuration with many advanced storage management features.

In this tutorial, let us see how to install and configure Bacula on Ubuntu 15.04 server. Also, this will work on old Ubuntu versions, such as Ubuntu 14.10 and Ubuntu 14.04 etc.

My test box IP address is 192.168.1.102/24, and hostname is server.unixmen.local. Well, now let me get us into the tutorial.

Install Bacula

Bacula uses an SQL database to manage its information. We can use either MySQL or PostgreSQL database. In this tutorial, I use MySQL server.

First of all, update your Ubuntu server with command:

sudo apt-get update && sudo apt-get upgrade

Enter the following command to install MySQL server.

sudo apt-get install mysql-server

During MySQL installation, you’ll be asked to set the database administrator password. Enter the password and click Ok.

sk@server: ~_001

Re-enter the password:

sk@server: ~_002

Now, let us install bacula using the following command:

sudo apt-get install bacula-server bacula-client

By default, Bacula uses Postfix MTA. During installation, you’ll be asked to configure Postfix.

Click OK to continue.

sk@server: ~_003

Select ‘Internet Site’ and click Ok.

sk@server: ~_004

Enter server fully qualified name(FQDN):

sk@server: ~_005

Now, select Yes to configure database for Bacula with dbconfig-common.

sk@server: ~_006

Enter the MySQL database administrator password:

sk@server: ~_007

Set password for bacula-director-mysql to register with the database server.  If left blank, a random password will be generated.

sk@server: ~_008

Re-enter the password:

sk@server: ~_009

Done! We have successfully installed Bacula. It is time to create directories for backup and restore.

Create Backup and Restore Directories

Now, let us backup and restore directories.

sudo mkdir -p /mybackup/backup /mybackup/restore

Set permissions and ownership to the above directories:

sudo chown -R bacula:bacula /mybackup/
sudo chmod -R 700 /mybackup/

Configure Bacula

Bacula has many configuration files which we have to configure.

Update Bacula Director configuration:

sudo vi /etc/bacula/bacula-dir.conf

Find the following section, and update the restore path.

In our case, /mybackup/restore is the restore location.

[...]
Job {
  Name = "RestoreFiles"
  Type = Restore
  Client=server-fd
  FileSet="Full Set"
  Storage = File
  Pool = Default
  Messages = Standard
  Where = /mybackup/restore
}
[...]

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

For example, I want to backup the “/home/sk” directory. So, I included this directory path in the “File” parameter.

[...]

#  By default this is defined to point to the Bacula binary
#    directory to give a reasonable FileSet to backup to
#    disk storage during initial testing.
#
    File = /home/sk
  }
[...]

Scroll down further, fins the section Exclude section. Set the list of directories to be excluded from the backup.

Here, I excluded the backup folder /mybackup directory from being backed up.

[...]

# If you backup the root directory, the following two excluded
#   files can be useful
#
  Exclude {
    File = /var/lib/bacula
    File = /nonexistant/path/to/file/archive/dir
    File = /proc
    File = /tmp
    File = /.journal
    File = /.fsck
    File = /mybackup
  }
}
[...]

Save and close file.

Update Bacula Storage Daemon settings:

Edit /etc/bacula/bacula-sd.conf file,

sudo vi /etc/bacula/bacula-sd.conf

Set the backup folder location. i.e /mybackup/backup in our case.

[...]

Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /mybackup/backup
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}
[...]

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

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

sudo bacula-dir -tc /etc/bacula/bacula-dir.conf
sudo bacula-sd -tc /etc/bacula/bacula-sd.conf

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

On Ubuntu 15.04:

sudo systemctl restart bacula-director
sudo systemctl restart bacula-fd
sudo systemctl restart bacula-sd

On Ubuntu 14.10 and previous versions:

sudo service bacula-director restart
sudo service bacula-fd restart
sudo service bacula-sd restart

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

Manage Bacula Using Webmin

Managing and working with Bacula via command line might be bit difficult for some administrators. Thankfully, a web based Linux system administration tool called “Webmin” is available to get things much easier and faster.

Webmin is an open source, web based system administration tool for Unix/Linux. Using Webmin, you can setup and configure all services such as DNS, DHCP, Apache, NFS, and Samba etc via any modern web browsers. So, you don’t have to remember all commands or edit any configuration files manually.

Install Webmin On Ubuntu 15.04 using official repository

Add the webmin official repository:

Edit file /etc/apt/sources.list,

sudo vi /etc/apt/sources.list

Add the following lines:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Add the GPG key:

sudo wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

Update the sources list:

sudo apt-get update

Install webmin using the following command:

sudo apt-get install webmin

Allow the webmin default port “10000” via firewall, if you want to access the webmin console from a remote system.

sudo ufw allow 10000

Access Webmin console

Open up your browser and navigate to the URL https://ip-address:10000/. The following screen should appear. Enter the user name and password to log in to webmin console.

Login to Webmin - Chromium_011

This is how my Webmin Dashboard looked.

Webmin 1.760 on server.unixmen.local (Ubuntu Linux 15.04) - Chromium_012

That’s it. Now you’ll be able to manage and configure your Ubuntu server graphically. Cheers!

Manage Bacula using Webmin

From the Bacula Dashboard, Go to the System tab on the left pane and click on the Module configuration link.

If it not found under System tab, search it from the unused modules section.

Webmin 1.760 on server.unixmen.local (Ubuntu Linux 15.04) - Chromium_013

The following screen should appear. Click “Module Configuration” tab.

Webmin 1.760 on server.unixmen.local (Ubuntu Linux 15.04) - Chromium_014

Select MySQL in the database section. Enter the MySQL database administrator password, and click Save button.

Webmin 1.760 on server.unixmen.local (Ubuntu Linux 15.04) - Chromium_015

That’s it. Now, you’ll be able to configure Bacula from webmin easily. Start adding backup clients, volumes and schedule the jobs.

Webmin 1.760 on server.unixmen.local (Ubuntu Linux 15.04) - Chromium_016

For more about Bacula installation and configuration, refer the Official documentation page.

Cheers!

Reference links: