CentOS 7 Compiling Bacula Backup (Part 1)

Domain name: example.com     Realm name: EXAMPLE.COM

Workgroup: EXAMPLE     Server IP address: xx.xx.xx.xx

Server name: linuxsvr01     Client name: linuxclnt01

Root password: ?Pa55w0rd!

This compilation will install all daemons (bacula-dir, bacula-sd and bacula-fd) onto the same host.

This presumes a minimal install of CentOS 7 on host (hostname=linuxsvr02.example.com) (Installing CentOS 7 Server) and that the Post Installation Tasks have been completed.

As Bacula is written to be used with many different Linux distros some of which do not have SELinux on by default I am going to disable it in this installation with the following commands then reboot machine

# setenforce 0
# sed -i --follow-symlinks 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux && cat /etc/sysconfig/selinux
# sed -i --follow-symlinks 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config && cat /etc/selinux/config

We will now install the apps and libraries for Bacula

# yum -y install epel-release
# yum -y install lshw htop nano wget mlocate
# yum -y groupinstall "Development Tools"
# yum -y install ncurses-devel readline-devel qt qt-devel lzo-devel dejavu-* libacl-devel
# export PATH=/usr/lib64/qt4/bin/:$PATH
# yum -y install mariadb-server mariadb-devel

Time to do an update

# yum -y update

We can now start MariaDB, create mysql password and bacula group and users

# systemctl enable mariadb.service
# systemctl start mariadb.service
# /usr/bin/mysqladmin -u root password ?Pa55w0rd!
# /usr/bin/mysqladmin -u root -h linuxsvr02.example.com password ?Pa55w0rd!
# groupadd -g 1999 bacula
# useradd -c "Bacula Director" -u 2000 -g 1999 -M -N -s /sbin/nologin bacula-dir
# useradd -c "Bacula Storage Daemon" -u 2001 -g 1999 -M -N -s /sbin/nologin bacula-sd

Download latest version of Bacula (9.0.4) then detar

# wget https://sourceforge.net/projects/bacula/files/bacula/9.0.4/bacula-9.0.4.tar.gz
# tar -xzvf bacula-9.0.4.tar.gz -C /usr/src

Change to the Bacula folder

# cd /usr/src/bacula-9.0.4

Run configure

# CFLAGS="-g -Wall" ./configure --sbindir=/opt/bacula/bin --sysconfdir=/opt/bacula/etc --enable-smartalloc --with-mysql --with-working-dir=/opt/bacula/working --with-pid-dir=/opt/bacula/working --with-subsys-dir=/opt/bacula/working --with-systemd --enable-readline

Compile Bacula

# make

And install

# make install

Change group rights, create database and database tables, grant privileges

# chgrp -R bacula /opt/bacula
# /opt/bacula/etc/create_bacula_database -u root -p
Creating mysql database
Enter password:
Creation of bacula database succeeded.
# /opt/bacula/etc/make_bacula_tables -u root -p
Making mysql tables
Enter password:
Creation of Bacula MySQL tables succeeded.
# /opt/bacula/etc/grant_bacula_privileges -u root -p
Granting mysql privileges
Enter password:
Created MySQL database user: bacula
Enter password:
Privileges for user bacula granted on database bacula.

Open firewall ports

# firewall-cmd --add-port=9101-9103/tcp --permanent --zone=public
# firewall-cmd --reload

Autostart the daemons

# make install-autostart
(cd platforms && make DESTDIR= install-autostart || exit 1)
make[1]: Entering directory `/usr/src/bacula-9.0.4/platforms'
make[2]: Entering directory `/usr/src/bacula-9.0.4/platforms/redhat'
# set symlinks for script at startup and shutdown
# set symlinks for script at startup and shutdown
# set symlinks for script at startup and shutdown
make[2]: Leaving directory `/usr/src/bacula-9.0.4/platforms/redhat'
make[1]: Leaving directory `/usr/src/bacula-9.0.4/platforms'