Installing Bacula on a Raspberry Pi running Ubuntu is relatively simple since it's available in the default repositories already compiled for the arm64 CPU architecture too. A couple of apt install command and you're ready to test and configure.

Pre-requisites

Before we can install Bacula there are some preparation steps required

  1. Build your Raspberry Pi : I'm using a Raspberry Pi 5 for this project together with an NVMe SSD which is supplied as a kit and needs some assembly
  2. Install Ubuntu : Raspberry Pi and Canonical provide an Ubuntu 24.04 LTS image for the Pi. This needs to be installed and configured and a database such as PostgreSQL too.

Once both of these are done Bacula itself can be installed.

I will also be migrating the configuration over from an older Raspberry Pi 2B. To make this a little easier I want to use the same UID and GID for the Bacula user as I had before so I need to create the bacula user and bacula group. For a new installation you can let Bacula create the users itself.

#> groupadd -r -g 120 -r bacula
#> useradd -r -u 113 -g bacula -G tape -m -d /var/lib/bacula -s /bin/false bacula

At least the tape group has the same GID on both old and new.

Bacula Installation

Bacula 13 is available in the Ubuntu 20.04 LTS repositories and a quick check with apt info bacula will confirm the currently available version.

#> apt info bacula
Package: bacula
Version: 13.0.4-1build3
Priority: optional
Section: universe/admin
Origin: Ubuntu

The bacula package is a meta-package that points two to more meta-packages bacula-client and bacula-server. These in turn point to the actual Bacula installation packages which is quite a long list as you can see below as additional packages. What this means is with a single install command all the required packages and their dependencies can be installed on the server in one go, plus the ability for it to back itself up too.

#> sudo apt install bacula

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  bacula-bscan bacula-client bacula-common bacula-common-pgsql bacula-console bacula-director bacula-director-pgsql bacula-fd bacula-sd
  bacula-server bsd-mailx dbconfig-common dbconfig-pgsql liblockfile-bin liblockfile1 libnsl2 mt-st mtx postfix
Suggested packages:
  gdb bacula-doc postfix-cdb postfix-doc postfix-ldap postfix-lmdb postfix-mta-sts-resolver postfix-mysql postfix-pcre postfix-pgsql
  postfix-sqlite procmail sasl2-bin | dovecot-common
The following NEW packages will be installed:
  bacula bacula-bscan bacula-client bacula-common bacula-common-pgsql bacula-console bacula-director bacula-director-pgsql bacula-fd bacula-sd
  bacula-server bsd-mailx dbconfig-common dbconfig-pgsql liblockfile-bin liblockfile1 libnsl2 mt-st mtx postfix
0 upgraded, 20 newly installed, 0 to remove and 1 not upgraded.
Need to get 3667 kB of archives.
After this operation, 14.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

 

Postfix configuration (optional)

Bacula uses email for notifications and alerts and the installer adds Postfix to the installation packages for you. With my current configuration the Bacula Director connects to an internal mail server directly so I'm chose No Configuration to retain the same configuration.

I'm now thinking that perhaps it will be more advantageous to have a Bacula connect to a local Postfix installation which then sends messages to my real mail server. While this is a bit of extra complexity, it means if something interesting happens to the mail server the Bacula messages will be queued and delivered once it's working again. But that is a change for another day and a future article.

Select OK once you've made your choice.

Configure PostgreSQL

Choose yes to have Bacula configure the Catalog database in PostgreSQL for you

Use local PostgreSQL database

Choose localhost since we have PostgreSQL already installed on the Pi.

While you can use a separate host for the database, this means you would then have two hosts that you're dependent on for backups, and should the worst happen, restores too.  And since a Pi 2B could handle the catalog, even if it was a little slow, there'll be no problems having this on a Pi 5.

Set database password

...
Done

Chose a suitably long and complex password and make a secure note of it as per best practice. The password is also saved into bacula-dir.conf and /etc/dbconfig-common/bacula-director-pgsql.conf should you lose track, which is a good reason to make sure those files are only readable by root.

You'll be prompted to enter the password a second time just to be sure you typed it correctly.

An initial configuration for Bacula Director, Storage and File Daemons is also created so that Bacula is usable and ready for testing.

Check services

All three Bacula services should be started with a default configuration. Confirm they're running with systemctl status for each of bacula-fd, bacula-director and bacula-sd.

#> systemctl status bacula-fd
● bacula-fd.service - Bacula File Daemon service
     Loaded: loaded (/usr/lib/systemd/system/bacula-fd.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-07-25 19:33:59 UTC; 7min ago
       Docs: man:bacula-fd(8)
   Main PID: 2736 (bacula-fd)
      Tasks: 3 (limit: 4335)
     Memory: 1.4M (peak: 2.0M)
        CPU: 29ms
     CGroup: /system.slice/bacula-fd.service
             └─2736 /usr/sbin/bacula-fd -fP -c /etc/bacula/bacula-fd.conf


#> systemctl status bacula-director
● bacula-director.service - Bacula Director Daemon service
     Loaded: loaded (/usr/lib/systemd/system/bacula-director.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-07-25 19:40:14 UTC; 1min 34s ago
       Docs: man:bacula-dir(8)
    Process: 4197 ExecStartPre=/usr/sbin/bacula-dir -t -c $CONFIG (code=exited, status=0/SUCCESS)
   Main PID: 4201 (bacula-dir)
      Tasks: 5 (limit: 4335)
     Memory: 2.5M (peak: 2.7M)
        CPU: 69ms
     CGroup: /system.slice/bacula-director.service
             └─4201 /usr/sbin/bacula-dir -fP -c /etc/bacula/bacula-dir.conf


#> systemctl status bacula-sd
● bacula-sd.service - Bacula Storage Daemon service
     Loaded: loaded (/usr/lib/systemd/system/bacula-sd.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-07-25 19:33:55 UTC; 8min ago
       Docs: man:bacula-sd(8)
   Main PID: 2233 (bacula-sd)
      Tasks: 3 (limit: 4335)
     Memory: 1.5M (peak: 2.3M)
        CPU: 32ms
     CGroup: /system.slice/bacula-sd.service
             └─2233 /usr/sbin/bacula-sd -fP -c /etc/bacula/bacula-sd.conf

Since we're not using Postfix for handling the alert emails then it's safer to disable it for now with systemctl mask postfix so nothing untoward can happen.

DB Scripts

Bacula provide 6 scripts to manage the catalog database. The Ubuntu install places them in /usr/share/bacula-director. These are used during the initial installation to create the database and may be used to drop and recreate it at the end of installation testing when you're ready for live running.

  • create_postgresql_database
  • drop_postgresql_database
  • drop_postgresql_tables
  • grant_postgresql_privileges
  • make_postgresql_tables
  • update_postgresql_tables

We will need to use the update script during cutover to upgrade the existing database once it's been restored and again in future after an upgrade if Bacula makes significant changes to the structure of the catalog database.

Note: the update_postgresql_tables script as supplied in this Ubuntu build of Bacula contains an error so the script will need to be modified before use. I'll cover that in the migration article.

Install BAT console

The default text-based bconsole is installed by default and is perfectly functional. The BAT console is a graphical console based on the QT framework and is an optional install but makes using Bacula a lot easier. This can be used quite happily over an SSH connection if you enable X11 forwarding with the -X option, or you can install it separately on your own PC.

This brings in a whole host of dependencies, but then we are installing a GUI on an Ubuntu server without a desktop.

#> sudo apt install bacula-console-qt
[sudo] password for localadmin: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  adwaita-icon-theme at-spi2-common at-spi2-core dconf-gsettings-backend dconf-service fontconfig fontconfig-config fonts-dejavu-core
  fonts-dejavu-mono gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme libatk-bridge2.0-0t64 libatk1.0-0t64
  libatspi2.0-0t64 libavahi-client3 libavahi-common-data libavahi-common3 libcairo-gobject2 libcairo2 libcolord2 libcups2t64 libdatrie1
  libdconf1 libdeflate0 libdouble-conversion3 libdrm-amdgpu1 libdrm-nouveau2 libdrm-radeon1 libegl-mesa0 libegl1 libepoxy0 libfontconfig1
  libfreetype6 libgbm1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgl1 libgl1-amber-dri libgl1-mesa-dri libglapi-mesa
  libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgtk-3-0t64 libgtk-3-bin libgtk-3-common libharfbuzz0b libice6 libinput-bin libinput10
  libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 liblerc4 libmd4c0 libmtdev1t64 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpcre2-16-0
  libpixman-1-0 libqt5core5t64 libqt5dbus5t64 libqt5gui5t64 libqt5network5t64 libqt5qml5 libqt5qmlmodels5 libqt5quick5 libqt5svg5
  libqt5waylandclient5 libqt5waylandcompositor5 libqt5widgets5t64 librsvg2-2 librsvg2-common libsharpyuv0 libsm6 libthai-data libthai0 libtiff6
  libvulkan1 libwacom-common libwacom9 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libwebp7 libx11-xcb1
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0 libxcb-randr0 libxcb-render-util0
  libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcomposite1
  libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1 libxkbcommon-x11-0 libxrandr2 libxrender1 libxshmfence1 libxtst6 libxxf86vm1
  mesa-vulkan-drivers qt5-gtk-platformtheme qttranslations5-l10n qtwayland5 session-migration ubuntu-mono x11-common
Suggested packages:
  colord cups-common gvfs liblcms2-utils qgnomeplatform-qt5 qt5-image-formats-plugins qt5-qmltooling-plugins librsvg2-bin libwacom-bin
...
0 upgraded, 131 newly installed, 0 to remove and 1 not upgraded.
Need to get 50.4 MB of archives.
After this operation, 235 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Done

Installation takes a few minutes to complete.

Bat configuration

To use Bat from the Bacula server you will need a user on the server which also needs to be added to the bacula group (e.g. on the Bacual server as root do usermod -a -G bacula [your_username])

Bat is useful for routine operations such as checking what's actually configured, confirming that jobs have run, running manual backup jobs and of course if something interesting happens it's the easiest tool to use to trigger a restore. You can of also use the text console bconsole if you prefer.

To launch bat you need to enable X11 forwarding either on the command line (-X) or in client config. From my Mint desktop I can simply run ssh from a terminal window since I have already configured SSH public key authentication to the Bacula server in a previous step and tell it to execute bat immediately with the -C option. If you're using a Windows desktop you'll need an SSH client that can also handle X11.

#> ssh -X mavis -C bat

 

Bacula BAT console

And this shows we now have a Bacula installation on a Raspberry Pi 5 that is now ready for testing.

Next Steps

While Bacula is now installed and ready for use we still need to complete some configuration and then test thoroughly before we can go live.

Complete configuration

There's some remaining work to do to finish off the host

  1. Install a virtual autochanger : Backing up to disks and tapes is supported out of the box and works well providing you ensure the disks are consistently mounted, which is not always the case with removable drives. Bacula also supports autochangers, and the vChanger extension lets Bacula see the disk as virtual magazine of backup media and handles the mounting of the drive in a consistent way regardless of what device gets assigned to drive when you connect it.
  2. Configure a firewall : This may be paranoia but given this is my backup server and a last line of defence should something bad happen I want to be extra careful with this one. I will configure a firewall, probably UFW for extra protection of Ubuntu to only allow connections from Bacula clients and SSH from listed admin hosts and nothing else.
  3. Configure Postfix : While I disabled this during the installation, as I noted at the time this is something to revisit so needs to remain on a ToDo list for now.

Test Bacula

This is a newer release of Bacula on a newer release of Ubuntu so before this can be considered live I need to run some tests.

  1. Simple backup of itself : Just to prove basic functionality
  2. Simple backup of a test host : Confirm it can backup an existing server
  3. Restore a test host : Prove that backed up files can actually be restored
  4. Backup using vChanger : Configure vChanger with a test disk and prove it mounts correctly and can be used for backup
  5. Restore using vChanger : Prove a restore of files backed up to the virtual autochanger

Migrate Configuration

Once I'm happy that Bacula works as a new installation it's time to prepare for the takeover of the current Bacula server. And this is where it could get a little fiddly.

And this will all be covered in the next few articles. Stay tuned...