Friday, August 27, 2010

Installing Bacula on Centos 5.4 with MySQL support

SkyHi @ Friday, August 27, 2010
Updated 03-01-2010
Create the BASE SYSTEM
Install Centos 5.4. During the installation, please DESELECT :
– Desktop : gnome
Flag the checkbox to “customize now” , and then select Under DEVELOPMENT :
– Development Library
– Development Tool
– Legacy Software Develpment
Select Under BASE SYSTEM
– Legacy Software Support
INSTALL THE DATABASE SERVER
To install the database , you need to :
yum install mysql-server
yum install mysql-devel.i386

NOTE : You can install mysql during the installation of the OS, in this case simply install mysql-devel.i386
DOWNLOAD AND INSTALL BACULA
Download bacula and extract it :
wget http://sourceforge.net/projects/bacula/files/bacula/3.0.3/bacula-3.0.3.tar.gz/download
tar -zxf bacula-3.0.3.tar.gz
cd bacula-3.0.3

Configura Bacula for compiling (please note that u have to change the email settings) :
CFLAGS="-g -Wall" \
./configure \
--sbindir=$HOME/bacula/bin \
--sysconfdir=$HOME/bacula/bin \
--with-pid-dir=$HOME/bacula/bin/working \
--with-subsys-dir=$HOME/bacula/bin/working \
--with-mysql \
--with-working-dir=$HOME/bacula/bin/working \
--with-dump-email=your@address.com \
--with-job-email=your@address.com \
--with-smtp-host=localhost

NOTE : My default installation setup is the following :
CFLAGS="-g -Wall" \
./configure \
--sbindir=/usr/share/bacula/bin \
--sysconfdir=/usr/share/bacula/etc \
--with-pid-dir=/usr/share/bacula/bin/working \
--with-subsys-dir=/usr/share/bacula/bin/working \
--with-mysql \
--with-working-dir=/usr/share/bacula/bin/working \
--with-dump-email=x@y.it \
--with-job-email=x@y.it \
--with-smtp-host=XXX.XXX.XXX.XXX

Compile and install bacula :
make
make install

CREATE DEFAULT DATABASE FOR BACULA
service mysqld start
Go in /usr/share/bacula/etc and execute the following script
./grant_mysql_privileges
./create_mysql_database
./make_mysql_tables

CONFIGURE SYSTEM FOR AUTOMATIC STARTUP
Copy the start-stop script from /usr/share/bacula/bin to /etc/init.d
cp /usr/share/bacula/bin/bacula /etc/init.d
cp /usr/share/bacula/bin/bacula-sd /etc/init.d
cp /usr/share/bacula/bin/bacula-fd /etc/init.d
cp /usr/share/bacula/bin/bacula-dir /etc/init.d

Modify the bacula startup script , adding this line at the top (so the bacula init script is chkconfig compatible) :
# chkconfig: - 87 26
NOTE : The script modified need to be something like this
#! /bin/sh
# chkconfig: - 87 26
#
# bacula This shell script takes care of starting and stopping
# the bacula daemons.
#
# This is pretty much watered down version of the RedHat script
# that works on Solaris as well as Linux, but it won't work everywhere.
#
# description: It comes by night and sucks the vital essence from your computers.
Run the following command :
chkconfig mysqld on
chkconfig bacula on
service bacula start

Congratulation …. you have succesfully installed bacula with mysql support
Please go here for WebMin configuration.

REFERENCES
http://www.crippaandrea.it/?p=256