Friday, August 27, 2010

Installing Bacula 5.0.2 on Centos 5.4 using VMWARE with MySQL support and WebMin Gui

SkyHi @ Friday, August 27, 2010
Configure the Virtual Environment
1) – Create a Virtual Machine as Red Hat Linux 5
2) – Remove the Default Ethernet Adapter
3) – Add a new adapter as VMXNET3 (feel free to use a dedicated adapter for the LAN Backup function and an other one for the remote connectivity to the Virtual Machine)
Note : You may prefer to create a Virtual Machine with 2 ethernet adapter : The first one for the Remote Access (aka SSH) and the other one on a dedicate VLAN for the LAN BACKUP FUNCTION.
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 AND CONFIGURE VMWARE TOOL
– Start the VMWare Tool Install
– Mount the Virtual CDROM
– Copy the .tar.gz file in /tmp
– Umount the CDROM
– Extract the tarball (tar -zxf) and execute it (./vmware-install.pl)
At the end of the installation, run the following command :
kudzu
service network restart

– Adjust the network ettings using /etc/sysconfig/network-scripts/ifcfg-eth0 as you prefer
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/5.0.2/bacula-5.0.2.tar.gz/download
tar -zxf bacula-5.0.2.tar.gz
cd bacula-5.0.2

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(/etc/init.d/bacula) , 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

DOWNLOAD AND START WEBMIN
Download the webmin software :
cd /tmp
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin-1.510.tar.gz?use_mirror=heanet

Install Perl-Net-SSL if you plan to use SSL for connecting to webmin :
yum install perl-Net-SSLeay.i386
Extract WebMin from the tarball and install it :
tar -zxf webmin-1.510.tar.gz
cd webmin-1.510

Run setup script :
./setup.sh
NOTE : The default settings must be fine, simply specify you login password.
CONFIGURE THE FIREWALL
Configure the firewall to permit access to webmin server (suppose the default config with https port on 10000) by editing /etc/sysconfig/iptables config file. Add a line like this before the REJECT line :
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9101 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9103 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

Restart the firewall
service iptables restart
CONFIGURE WEBMIN
Login to your WebMin Server , and fill the search box with the word “bacula”
Click the first result, and change go to change the module config.
- Change Database type to MySql
- Change config dir to /usr/share/bacula/etc

Congratulation …. you have succesfully installed bacula with mysql support and WebMin access

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