Friday, August 27, 2010

Bacula Automatic Installation Perl Script Centos5

SkyHi @ Friday, August 27, 2010
#!/usr/bin/perl -w

#

# Install Bacula Automatically

# Tested With Centos 5

# By Yohanes Patra

# Current version is bacula 3.0.2

#
use strict;

use Cwd;

use File::Copy;
###### Bacula Preparation ##########
my $current_path = getcwd;

chdir “/root” unless $current_path =~ ! /\/root$/;

system “yum -y update”;

system “yum -y install mysql-server mysql-devel gcc gcc-c++ mtx openssl 
openssl-devel httpd mod_ssl ncurses ncurses-devel libtermcap-devel”;

system “wget https://sourceforge.net/projects/bacula/files/bacula/3.0.2/bacula-3.0.2.tar.gz/download”;

system “wget https://sourceforge.net/projects/bacula/files/bacula/3.0.2/bacula-gui-3.0.2.tar.gz/download”;

system “wget https://sourceforge.net/projects/bacula/files/bacula/3.0.2/bacula-rescue-3.0.2.tar.gz/download”;

system “wget https://sourceforge.net/projects/bacula/files/depkgs/18Feb09/depkgs-18Feb09.tar.gz/download”;

system “wget https://sourceforge.net/projects/bacula/files/depkgs-qt/28Jul09/depkgs-qt-28Jul09.tar.gz/download”;

system “tar -zxvf bacula-3.0.2.tar.gz”;

system “tar -zxvf depkgs-18Feb09.tar.gz”;

system “tar -zxvf depkgs-qt-28Jul09.tar.gz”;

move “/root/depkgs” , “/root/bacula-3.0.2/depkgs”;

move “/root/depkgs-qt” , “/root/bacula-3.0.2/depkgs-qt”;

rename “/root/bacula-3.0.2″ , “/root/bacula”;
#### Configure QT ########

chdir “/root/bacula/depkgs-qt” or die “cant chdir to depkgs-qt”;

system “make”;

system “export PATH=/root/bacula/depkqs-qt/qt4/bin:\$PATH”;

chdir “/root/bacula/depkgs/qwt-5.0.2″ or die “cant chdir to depkgs-qt”;

system “make”;
#### Configure Bacula ######
chdir “/root/bacula” or die “cant chdir to bacula”;

system “export PATH=\$PATH:/usr/include”;

system “./configure –prefix=/usr –sbindir=/usr/sbin 
–sysconfdir=/etc/bacula –with-scriptdir=/etc/bacula –enable-smartalloc 
–enable-bat –with-qwt=\$HOME/bacula/depkgs/qwt –with-mysql 
–with-working-dir=/var/bacula –with-pid-dir=/var/run –enable-conio 
–with-openssl”;

system “make”;

system “make install”;
#### Configure MYSQL ########

chdir “/etc/bacula” or die “cant chdir to bacula”;
print “\n############ Enter Root mysql password if prompted ###########\n”;

system “./grant_mysql_privileges -u root -p”;

system “./create_mysql_database -u root -p”;

system “./make_mysql_tables -u root -p”;

symlink “/usr/sbin/bacula”, “/etc/init.d/bacula”;

system “/etc/init.d/bacula start”;
or download it from http://www.4shared.com/file/132127536/32402ef8/bacula.html





REFERENCES
http://yohanespatra.wordpress.com/2009/09/12/bacula-automatic-installation-perl-script-centos5/