Bacula Backup Solution

Aus wiki.frank-wulf.de
Zur Navigation springen Zur Suche springen

Install Bacula on Linux

This article describes how to install the latest Bacula version on Linux.

Download current version:

wget -qO- https://sourceforge.net/projects/bacula/files/latest/download | tar -xzvf - -C /usr/src

Goto the source directory:

cd /usr/src/bacula*

Configure the code, changing the last options below accordingly (normally the last three):

./configure --with-readline=/usr/include/readline --disable-conio --bindir=/usr/bin --sbindir=/usr/sbin --with-scriptdir=/etc/bacula/scripts --with-working-dir=/var/lib/bacula --with-logdir=/var/log --enable-smartalloc --with-mysql --with-archivedir=<pathname of backup disk> --with-job-email=<mail address> --with-hostname=192.168.x.x

Build, install and enable the Bacula daemons start at boot time:

make -j8 && make install && make install-autostart

Goto the scripts directory:

cd /etc/bacula/scripts

Create the database:

./create_bacula_database -u root -p

Create the database tables:

./make_bacula_tables -u root -p

Create the database user:

./grant_bacula_privileges -u root -p

Start the Bacula daemons:

service bacula-dir start
service bacula-fd start
service bacula-sd start

Remark: The steps are orginally taken from http://bacula.us/compilation/ and slightly adjusted for personal use.

Content of this site from 25th of Sep 2017: Bacula.us-Bacula 903 Compilation and Installation Commands.pdf

Reset Bacula after testing phase

Benefits:

  • Database Catalog will be initialized.
  • Executed Jobs will disappear.
  • JobIDs and Volume numbering will be resetted.
  • We keep the configuration of the Bacula Director, the Client and the Storage Daemon as well as File Sets, Backup Schedules, Backup Job definitions, Volume Pools and Storage Devices.


How-To:


1. Stop Bacula daemons

sudo bacula stop

2. Drop database tables (system will ask for password of database user „root@localhost“)

sudo sh -c "cd /etc/bacula/scripts; ./drop_bacula_tables -u root -p"

3. Create new database tables (system will ask for password of database user „root@localhost“)

sudo sh -c "cd /etc/bacula/scripts; ./make_bacula_tables -u root -p"

4. Delete all files in /var/lib/bacula (File ".my.cnf" is important and will not be deleted)

sudo sh -c "cd /var/lib/bacula; rm *"

5. Start Bacula daemons

sudo bacula start

Note: Existing backup files must be removed from backup directory.

Install Baculum API and Web GUI Tools

Add key for Baculum

wget -qO - http://bacula.org/downloads/baculum/baculum.pub | apt-key add -

Add source for Baculum

echo -e "deb [ arch=amd64 ] http://bacula.org/downloads/baculum/stable/ubuntu bionic main\ndeb-src http://bacula.org/downloads/baculum/stable/ubuntu bionic main" >/etc/apt/sources.list.d/baculum.list

Install Baculum

apt-get update && apt-get install baculum-api baculum-api-apache2 baculum-common baculum-web baculum-web-apache2

Add sudo access for Baculum

echo -e "Defaults:apache "'!'"requiretty\nwww-data ALL=NOPASSWD: /usr/sbin/bconsole\nwww-data ALL=NOPASSWD: /usr/sbin/bdirjson\nwww-data ALL=NOPASSWD: /usr/sbin/bsdjson\nwww-data ALL=NOPASSWD: /usr/sbin/bfdjson\nwww-data ALL=NOPASSWD: /usr/sbin/bbconsjson" > /etc/sudoers.d/baculum

Enable rewrite module

a2enmod rewrite

Enable Baculum API and web site

a2ensite baculum-web baculum-api

Restart Apache

systemctl reload apache2

Backup of Windows-Clients

Under construction

Backup process implementation

Requirement

  • Regular backups of the server and other computers (eg PC, Notebook) should be carried out.
  • No manual steps should be necessary.
  • The backups should be stored on the server.

Implementation

  • The Bacula Director on the server manages the progress of all backups.
  • All computers to be backed up have a Bacula Filedaemon installed.
  • A computer can be backed up if one of the following conditions is true:
    • The computer is running and accessible via the network.
    • The computer is turned off and can be automatically turned on via a server-initiated "wake on LAN" signal.