Files
calypso/docs/alpha/components/bacula/Bacula-Installation-Guide.md
2026-01-09 16:54:39 +00:00

4.4 KiB

Bacula Installation and Configuration Guide for Ubuntu 24.04

1. Introduction

This guide provides step-by-step instructions for installing and configuring Bacula on Ubuntu 24.04. The configuration files will be moved to a custom directory: /opt/calypso/conf/bacula.

2. Installation

First, update the package lists and install the Bacula components and a PostgreSQL database backend.

sudo apt-get update
sudo apt-get install -y bacula-director bacula-sd bacula-fd postgresql

During the installation, you may be prompted to configure a mail server. You can choose "No configuration" for now.

2.1. Install Bacula Console

Install the Bacula console, which provides the bconsole command-line utility for interacting with the Bacula Director.

sudo apt-get install -y bacula-console

3. Database Configuration

Create the Bacula database and user.

sudo -u postgres createuser -P bacula
sudo -u postgres createdb -O bacula bacula

When prompted, enter a password for the bacula user. You will need this password later.

Now, grant privileges to the bacula user on the bacula database.

sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE bacula TO bacula;"

Bacula provides scripts to create the necessary tables in the database.

sudo /usr/share/bacula-director/make_postgresql_tables.sql | sudo -u postgres psql bacula

4. Configuration File Migration

Create the new configuration directory and copy the default configuration files.

sudo mkdir -p /opt/calypso/conf/bacula
sudo cp /etc/bacula/* /opt/calypso/conf/bacula/
sudo chown -R bacula:bacula /opt/calypso/conf/bacula

5. Systemd Service Configuration

Create override files for the bacula-director and bacula-sd services to point to the new configuration file locations.

5.1. Bacula Director

sudo mkdir -p /etc/systemd/system/bacula-director.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-director.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-dir -f -c /opt/calypso/conf/bacula/bacula-dir.conf
EOF'

5.2. Bacula Storage Daemon

sudo mkdir -p /etc/systemd/system/bacula-sd.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-sd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-sd -f -c /opt/calypso/conf/bacula/bacula-sd.conf
EOF'

5.3. Bacula File Daemon

sudo mkdir -p /etc/systemd/system/bacula-fd.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-fd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-fd -f -c /opt/calypso/conf/bacula/bacula-fd.conf
EOF'

Reload the systemd daemon to apply the changes.

sudo systemctl daemon-reload

6. Bacula Configuration

Update the bacula-dir.conf and bacula-sd.conf files to use the new paths and settings.

6.1. Bacula Director Configuration

Edit /opt/calypso/conf/bacula/bacula-dir.conf and make the following changes:

  • In the Storage resource, update the address to point to the correct IP address or hostname.
  • In the Catalog resource, update the dbuser and dbpassword with the values you set in step 3.
  • Update any other paths as necessary.

6.2. Bacula Storage Daemon Configuration

Edit /opt/calypso/conf/bacula/bacula-sd.conf and make the following changes:

  • In the Storage resource, update the SDAddress to point to the correct IP address or hostname.

  • Create a directory for the storage device and set the correct permissions.

    sudo mkdir -p /var/lib/bacula/storage
    sudo chown -R bacula:tape /var/lib/bacula/storage
    
  • In the Device resource, update the Archive Device to point to the storage directory you just created. For example:

    Device {
      Name = FileStorage
      Media Type = File
      Archive Device = /var/lib/bacula/storage
      LabelMedia = yes;
      Random Access = Yes;
      AutomaticMount = yes;
      RemovableMedia = no;
      AlwaysOpen = no;
    }
    

7. Starting and Verifying Services

Start the Bacula services and check their status.

sudo systemctl start bacula-director bacula-sd bacula-fd
sudo systemctl status bacula-director bacula-sd bacula-fd

8. SELinux/AppArmor

If you are using SELinux or AppArmor, you may need to adjust the security policies to allow Bacula to access the new configuration directory and storage directory. The specific steps will depend on your security policy.