Bacula
"It comes by night and sucks the vital essence from your computers." -Bacula Project
How perfect for Transylvania... muhahahaha!
Bacula is an enterprise-class, open source, network backup solution. While its configuration and use may seem daunting to understand at first, its structure is very logical and easy to use and maintain once you understand the basics. Bacula is supported by a team of developers that also offer commercial support for the product which is in its third version.
Basics
Bacula consists of 3 basic daemons and thus 3 config files:
- bacula-dir.conf - The director config.. the BIG config.. jobs, clients, schedules, etc (server only)
- bacula-sd.conf - The storage daemon config.. tape and/or disk drive config (server only)
- bacula-fd.conf - The file daemon config.. allows the director to backup the system (server + clients)
TBC..
Server Installation
- This documentation is from the install of version 3.0.2 from sourcecode onto Kay on Aug 21, 2009 by Chris Moore.
mkdir /usr/local/bacula-src # Where we will keep and build the source
mkdir /usr/local/bacula # The installation directory (binaries, configs, etc)
cd /usr/local/bacula-src
wget http://downloads.sourceforge.net/project/bacula/bacula/3.0.2/bacula-3.0.2.tar.bz2
wget http://downloads.sourceforge.net/project/bacula/bacula/3.0.2/bacula-gui-3.0.2.tar.bz2
wget http://downloads.sourceforge.net/project/bacula/bacula/3.0.2/bacula-docs-3.0.2.tar.bz2
wget http://downloads.sourceforge.net/project/bacula/bacula/3.0.2/bacula-rescue-3.0.2.tar.bz2
tar -xvzf bacula-3.0.2.tar.bz2
tar -xvzf bacula-gui-3.0.2.tar.bz2
tar -xvjf bacula-docs-3.0.2.tar.bz2
tar -xvzf bacula-rescue-3.0.2.tar.bz2
cd ./bacula-3.0.2
yum install php httpd phpmyadmin php-mcrypt php-mbstring mysql mysql-devel mysql-server \
qwtplot3d qwtplot3d-devel zlib-devel gccc gcc-c++ python-devel readline-devel
groupadd bacula -g 811
useradd bacula -u 811 -g 811 -d /usr/local/bacula -s /sbin/nologin
./configure --sbindir=/usr/local/bacula/bin \
--sysconfdir=/usr/local/bacula \
--enable-smartalloc \
--with-qwt=/usr/lib/libqwt.so \
--enable-batch-insert \
--enable-tray-monitor \
--enable-largefile \
--enable-readline \
--with-mysql \
--with-openssl \
--with-python \
--with-working-dir=/usr/local/bacula \
--with-dir-user=bacula \
--with-dir-group=bacula \
--with-sd-user=bacula \
--with-sd-group=bacula \
--with-fd-user=root \
--with-fd-group=root
Output:
Configuration on Sat Aug 22 04:38:27 EDT 2009:
Host: x86_64-unknown-linux-gnu -- redhat
Bacula version: Bacula 3.0.2 (18 July 2009)
Source code location: .
Install binaries: /usr/local/bacula/bin
Install libraries: /usr/lib
Install config files: /usr/local/bacula
Scripts directory: /usr/local/bacula
Archive directory: /tmp
Working directory: /usr/local/bacula
PID directory: /var/run
Subsys directory: /var/lock/subsys
Man directory: ${datarootdir}/man
Data directory: /usr/share
Plugin directory: /usr/lib
C Compiler: gcc 4.1.2
C++ Compiler: /usr/bin/g++ 4.1.2
Compiler flags: -g -O2 -Wall -fno-strict-aliasing -fno-exceptions -fno-rtti
Linker flags:
Libraries: -lpthread -ldl
Statically Linked Tools: no
Statically Linked FD: no
Statically Linked SD: no
Statically Linked DIR: no
Statically Linked CONS: no
Database type: MySQL
Database port:
Database lib: -L/usr/lib64/mysql -lmysqlclient_r -lz
Database name: bacula
Database user: bacula
Job Output Email: root@localhost
Traceback Email: root@localhost
SMTP Host Address: localhost
Director Port: 9101
File daemon Port: 9102
Storage daemon Port: 9103
Director User: bacula
Director Group: bacula
Storage Daemon User: bacula
Storage DaemonGroup: bacula
File Daemon User: root
File Daemon Group: root
SQL binaries Directory /usr/bin
Large file support: yes
Bacula conio support: yes -ltermcap
readline support: no
TCP Wrappers support: no
TLS support: yes
Encryption support: yes
ZLIB support: yes
enable-smartalloc: yes
enable-lockmgr: no
bat support: no
enable-gnome: no
enable-bwx-console: no
enable-tray-monitor: yes
client-only: no
build-dird: yes
build-stored: yes
ACL support: no
XATTR support: yes
Python support: yes -L/usr/lib64/python2.4/config -lpython2.4 -lutil -lrt
Batch insert enabled: yes
make all
make install
chown -R bacula.bacula /usr/local/bacula
Install Init Scripts and Set PATH
cd /usr/local/bacula-src/bacula-3.0.2/platforms/redhat
chmod +x bacula-dir
chmod +x bacula-sd
chmod +x bacula-fd
cp bacula-dir /etc/init.d
cp bacula-sd /etc/init.d
cp bacula-fd /etc/init.d
chkconfig --add bacula-dir
chkconfig --add bacula-sd
chkconfig --add bacula-fd
chkconfig mysqld on
- Edit /etc/profile
- Add "pathmunge /usr/local/bacula/bin/" under UID 0's (root's) path changes
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
pathmunge /usr/local/bacula/bin
Configure Firewall, Apache, phpmyadmin
- Firewall
- Run system-config-securitylevel-tui
- Select "Customize" button
- Enable "WWW (HTTP)" and "Secure WWW (HTTPS)"
- Add "tcp:9101,udp:9101" to "Other ports"
- Select "OK" twice to exit
- Apache
- edit /etc/httpd/conf/httpd.conf
- set "ServerName kay.cs.transy.edu"
- edit /etc/httpd/conf/httpd.conf
- phpmyadmin
- edit /usr/share/phpmyadmin/config.inc.php
- Fill in random characters for 'blowfish_secret'
- edit /etc/httpd/conf.d/phpmyadmin.conf
- add "Allow from 10." below "Allow from 127.0.0.1"
- edit /usr/share/phpmyadmin/config.inc.php
- Restart Apache
- /etc/init.d/httpd restart
Configuring MySQL Database
- /etc/init.d/mysqld start
- Follow on-screen instructions to set root password for MySQL
- Test logging into database: mysql -u root --password (quit to exit)
- Browse to kay.cs.transy.edu/phpmyadmin
- Login as 'root'
- Click 'Priviledges'
- Click 'Add new user'
- Username: bacula
- Host: localhost
- Password: bacula
- Select "Create database with same name and grant all privileges"
- Click 'Go'
- cd /usr/local/bacula
- Edit 'make_mysql_tables'
- Add "-u bacula --password" to allow login to mysql
- 8th line should read: "if $bindir/mysql -u bacula --password $* -f <<END-OF-DATA"
- Add "-u bacula --password" to allow login to mysql
- Run ./make_mysql_tables
- Edit 'bacula-dir.conf'
- Under "Catalog {" set dbpassword = "bacula"
Basic Bacula Configuration
- cd /usr/local/bacula
- mkdir orginal_confs
- cp *.conf original_confs/
- Replace bacula-dir.conf with:
### B A C U L A at KAY.CS.TRANSY.EDU ################################################################################
# For Bacula release 3.0.2 (18 July 2009) -- redhat
# Bacula Director Config File
# ____________________________________________________________________________________________________________________
# ###<<<<< EDIT HISTORY >>>>>###
# 08/22/09 - CLM - Stripped unecessary defaults and reorganized
#
#
### DIRECTOR/CATALOG/CONSOLE ##########################################################################################
Director { # define myself
Name = kay.cs.transy.edu-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/usr/local/bacula/query.sql"
WorkingDirectory = "/usr/local/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "h1MOeZFbaD5Yf++iWp0WjtZ2SDr2X3aSoHENNM2V8oe5" # Console password
Messages = Daemon
}
Catalog {
Name = MyCatalog
dbname = "bacula"; dbuser = "bacula"; dbpassword = "bacula"
}
Console {
Name = kay.cs.transy.edu-mon
Password = "eGlf6NJdgKyJiZdUWVAEbdtEEyVJ3vKUVsRKYBsZIgn1"
CommandACL = status, .status
}
### STORAGE ##########################################################################################################
Storage {
Name = File
Address = kay # N.B. Use a fully qualified name here
SDPort = 9103
Password = "li1Mzezq64b7Ece79JTrEJFVKYuvm1yKr8WDx70sjc7k"
Device = FileStorage
Media Type = File
}
### /STORAGE #########################################################################################################
### MESSAGING ########################################################################################################
Messages {
Name = Standard
mailcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/usr/local/bacula/log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
mailcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/usr/local/bacula/log" = all, !skipped
}
### /MESSAGING ######################################################################################################
#####################################################################################################################
#####################################################################################################################
#####################################################################################################################
### CLIENTS #########################################################################################################
Client {
Name = kay.cs.transy.edu-fd
Address = kay
FDPort = 9102
Catalog = MyCatalog
Password = "9xNhJRzsiqGJeE5J2jd9xFNKk0TkZBEt7l9b1loMHlFr" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
### /CLIENTS ########################################################################################################
### SCHEDULES #######################################################################################################
Schedule {
Name = "WeeklyCycleAfterBackup"
Run = Full sun-sat at 23:10
}
### /SCHEDULES ######################################################################################################
### FILESETS ########################################################################################################
FileSet {
Name = "Catalog"
Include {
Options {
signature = MD5
}
File = /usr/local/bacula/bacula.sql
}
}
### /FILESETS ######################################################################################################
### POOLS ##########################################################################################################
Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
}
### /POOLS #########################################################################################################
### JOBS ###########################################################################################################
JobDefs {
Name = "DefaultJob"
Type = Backup
Level = Incremental
Client = kay.cs.transy.edu-fd
FileSet = "Catalog"
Schedule = "WeeklyCycleAfterBackup"
Storage = File
Messages = Standard
Pool = Default
Priority = 10
}
Job {
Name = "BackupClient1"
JobDefs = "DefaultJob"
Write Bootstrap = "/usr/local/bacula/Client1.bsr"
}
### /JOBS ##########################################################################################################
- Replace bacula-sd.conf with:
### B A C U L A at KAY.CS.TRANSY.EDU ################################################################################
# For Bacula release 3.0.2 (18 July 2009) -- redhat
# Bacula Storage Daemon Config File
# ____________________________________________________________________________________________________________________
# ###<<<<< EDIT HISTORY >>>>>###
# 08/22/09 - CLM - Stripped unecessary defaults and reorganized
#
#
Storage { # definition of myself
Name = kay.cs.transy.edu-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/usr/local/bacula"
Pid Directory = "/var/run"
Maximum Concurrent Jobs = 20
}
Director {
Name = kay.cs.transy.edu-dir
Password = "li1Mzezq64b7Ece79JTrEJFVKYuvm1yKr8WDx70sjc7k"
}
Director {
Name = kay.cs.transy.edu-mon
Password = "WksLFW7L2zpv4A+FFAwI3bQujzKKy2WpEcpParM0vdQw"
Monitor = yes
}
Device {
Name = FileStorage
Media Type = File
Archive Device = /tmp
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
Messages {
Name = Standard
director = kay.cs.transy.edu-dir = all
}
- Replace bacula-fd.conf with:
### B A C U L A at KAY.CS.TRANSY.EDU ################################################################################
# For Bacula release 3.0.2 (18 July 2009) -- redhat
# Bacula File Daemon Config File
# ____________________________________________________________________________________________________________________
# ###<<<<< EDIT HISTORY >>>>>###
# 08/22/09 - CLM - Stripped unecessary defaults and reorganized
#
#
Director {
Name = kay.cs.transy.edu-dir
Password = "9xNhJRzsiqGJeE5J2jd9xFNKk0TkZBEt7l9b1loMHlFr"
}
Director {
Name = kay.cs.transy.edu-mon
Password = "Isi5abNFrjx4LNFvt23R/Z0N2ojcwTfeeWG62e+7O4ZC"
Monitor = yes
}
FileDaemon { # this is me
Name = kay.cs.transy.edu-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /usr/local/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
Messages {
Name = Standard
director = kay.cs.transy.edu-dir = all, !skipped, !restored
}
Web GUI Install (bweb)
- Bweb is a Perl based web front-end to Bacula. Great for reporting and checking logs, though I wouldn't recommend using it to interface with the Bacula directore - use bconsole.
yum install perl-Date-Calc perl-Expect perl-HTML-Template perl-GD perl-GD-Graph perl-Time-ParseDate
*NOTE*: Perl's Time::ParseDate module is required but isn't available via 'yum' at this time. Might have to use cpan.
cd /usr/local/bacula-src/bacula-gui-3.0.2/bweb
- Edit 'install_bweb'
- Set CONF_DIR=/usr/local/bacula
- Set WEB_DIR=/var/www/html
- Set CGI_BIN=/var/www/cgi-bin
- Set HTTP_USER=apache
- Set HTTP_GROUP=apache
- Set DB_PW="bacula"
- Run ./bweb_install
- Run "mysql bacula -u bacula --password < script/bweb-mysql.sql"
- Ensure complete installation by browsing to http://kay.cs.transy.edu/bweb. No data should be present
as the daemons aren't running, but the page should render without data.
First Run
- As root, run "bacula start", you shouldn't get any errors.
- Now launch the console interface to Bacula by running "bconsole"
- Type "quit" to exit