|
Installation
Bacula
Package
Download bacula package
bacula-bat-5.0.3-2.x86_64.rpm bacula-client-5.0.3-1.x86_64.rpm bacula-docs-5.0.3-1.noarch.rpm bacula-libs-5.0.3-1.x86_64.rpm bacula-mtx-5.0.3-1.x86_64.rpm bacula-mysql-5.0.3-1.x86_64.rpm bacula-updatedb-5.0.3-1.x86_64.rpm
Install all package using yum
yum localinstall --nogpgcheck bacula-*.rpm
Configuration
You should config Bacula at Server and Client
Server
At server side, we need configure several files, include one file we need to create,
bacula-dir
In bacula-dir we should define Director, Jobs, File Sets need to backup, client, storage and console.
Director
Director { # define myself
Name = bacula.server-dir # will be read at bconsole.conf ( Director ),bacula-fd.conf (Director) and bacula-sd.conf (Director)
DIRport = 9101 # where we listen for UA connections
QueryFile = "/usr/lib64/bacula/query.sql"
WorkingDirectory = "/var/lib/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "director-pass" # bconsole.conf will using this password
Messages = Daemon
}
Jobs Definition and Job
JobDefs {
Name = "DefaultJob"
Type = Backup
Level = Incremental
Client = package.asik.com-fd
FileSet = "Full Set"
Schedule = "WeeklyCycle"
Storage = package-storage
Messages = Standard
Pool = Default
Priority = 10
}
#
# Define the main nightly save backup job
# By default, this job will back up to disk in /tmp
Job {
Name = "BackupClient1"
JobDefs = "DefaultJob"
Write Bootstrap = "/var/lib/bacula/Client1.bsr"
}
Another Job Backup example
# Backup the catalog database (after the nightly save)
Job {
Name = "BackupCatalog"
JobDefs = "DefaultJob"
Level = Full
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"
# This creates an ASCII copy of the catalog
# WARNING!!! Passing the password via the command line is insecure.
# see comments in make_catalog_backup for details.
# Arguments to make_catalog_backup are:
# make_catalog_backup <database-name> <user-name> <password> <host>
RunBeforeJob = "/usr/lib64/bacula/make_catalog_backup bacula bacula"
# This deletes the copy of the catalog
RunAfterJob = "/usr/lib64/bacula/delete_catalog_backup"
Write Bootstrap = "/var/lib/bacula/BackupCatalog.bsr"
Priority = 11 # run after main backup
}
#
# Standard Restore template, to be changed by Console program
# Only one such job is needed for all Jobs/Clients/Storage ...
#
Job {
Name = "RestoreFiles"
Type = Restore
Client=package.asik.com-fd
FileSet="Full Set"
Storage = package-storage
Pool = Default
Messages = Standard
Where = /tmp/bacula-restores
}
File Set, you can define which file need to be backup
# List of files to be backed up
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
}
#
# Put your list of files here, preceded by 'File =', one per line
# or include an external list with:
#
# File = <file-name
#
# Note: / backs up everything on the root partition.
# if you have other partitions such as /usr or /home
# you will probably want to add them too.
#
# By default this is defined to point to the Bacula binary
# directory to give a reasonable FileSet to backup to
# disk storage during initial testing.
#
File = /usr/sbin
}
#
# If you backup the root directory, the following two excluded
# files can be useful
#
Exclude {
File = /var/lib/bacula
File = /tmp
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
Client
# Client (File Services) to backup
Client {
Name = package.asik.com-fd
Address = localhost
FDPort = 9102
Catalog = MyCatalog
Password = "package-pass" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Storage
# Definition of file storage device
Storage {
Name = package-storage
# Do not use "localhost" here
Address = localhost # N.B. Use a fully qualified name here
SDPort = 9103
Password = "storage-pass" # Will be used at bacula-sd.conf as (Director) password
Device = FileStorage #will be read at bacula-sd.conf
Media Type = File #will be read at bacula-sd.conf
}
Catalog
# Generic catalog service
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:mysql"; dbaddress = 127.0.0.1; dbport =
dbname = "bacula"; dbuser = "bacula"; dbpassword = "baculapass"
}
Message
# Reasonable message delivery -- send most everything to email address
# and to the console
Messages {
Name = Standard
#
# NOTE! If you send to two email or more email addresses, you will need
# to replace the %r in the from field (-f part) with a single valid
# email address in both the mailcommand and the operatorcommand.
# What this does is, it sets the email address that emails would display
# in the FROM field, which is by default the same email as they're being
# sent to. However, if you send email to more than one address, then
# you'll have to set the FROM address manually, to a single address.
# for example, a 'no-reply@mydomain.com', is better since that tends to
# tell (most) people that its coming from an automated source.
#
mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/sbin/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
#
# WARNING! the following will create a file that you must cycle from
# time to time as it will grow indefinitely. However, it will
# also keep all your messages if they scroll off the console.
#
append = "/var/lib/bacula/log" = all, !skipped
catalog = all , !skipped, !saved
}
# Message delivery for daemon messages (no job).
Messages {
Name = Daemon
mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/var/lib/bacula/log" = all, !skipped
}
Pool
# Default pool definition
Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
}
# Scratch pool definition
Pool {
Name = Scratch
Pool Type = Backup
}
Console, bacula can access via bconsole
#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
Name = package.asik.com-mon
Password = "fazrie"
CommandACL = status, .status
}
Add this line at the end of config file, this command will tell bacula server to read all client config at file read-client.conf
@/etc/bacula/read-client.conf
bacula-sd
Define the storage
Storage { # definition of myself
Name = package.asik.com-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/var/lib/bacula"
Pid Directory = "/var/run"
Maximum Concurrent Jobs = 20
}
Define the director to be used based on Director at bacula-dir.conf
#
# List Directors who are permitted to contact Storage daemon
#
Director {
Name = bacula.server-dir
Password = "storage-pass"
}
#
# Restricted Director, used by tray-monitor to get the
# status of the storage daemon
#
Director {
Name = package.asik.com-mon
Password = "director-pass"
Monitor = yes
}
Define Device should be used, based on Device config at bacula-dir.conf
#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
# same Name and MediaType.
#
Device {
Name = FileStorage # read from bacula-dir.conf at Storage section
Media Type = File # read from bacula-dir.conf at Storage section
Archive Device = /home/bacula
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
Message
Messages {
Name = Standard
director = package.asik.com-dir = all
}
bacula-fd
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = bacula.server-dir
Password = "package-pass"
}
#
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
#
Director {
Name = package.asik.com-mon
Password = "fazrie"
Monitor = yes
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = package.asik.com-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = package.asik.com-dir = all, !skipped, !restored
}
bconsole.conf
#
# Bacula User Agent (or Console) Configuration File
#
Director {
Name = bacula.server-dir # director name at bacula-dir.conf
DIRport = 9101 # director port
address = localhost # director address
Password = "director-pass" # director password
}
read-client.conf
Make a Client Directory at /etc/bacula/, we will put all client configuration at that directory, so the read-client.conf will read all config file.
mkdir -p /etc/bacula/client
#
# Include subfiles associated with configuration of clients.
# They define the bulk of the Clients, Jobs, and FileSets.
# Remember to "reload" the Director after adding a client file.
#
@|"sh -c 'for f in /etc/bacula/client/*.conf ; do echo @${f} ; done'"
Client
Edit bacula config file at /etc/bacula/bacula-fd.conf
bacula-fd.conf
Password should be macth with the server
Director {
Name = bacula.server-dir
Password = Agw6a4ckidwQ493JwAVl9oTPu3R8PaJGtv3PptWb9Yh2HyryaO1kOm9KiCVLOmaB51FIk8ReEapvrg9reON7k7nDutbadcj4wA5L5ajyuyusVSwovt5Gy4EBZMFd9BxPDYm3W23LK6mtiaJiCZUufiwEq8C9lDDmE4wt3w66tP8EK7ACaFmiMsv9aOjTeSETep7NeaOrPQqhfeR8TDkqO4eBADWYTPjwE1QugpHgWNsta3i91UvVkAOJjztzBKSn
}
FileDaemon {
Name = messaging
FDport = 9102
WorkingDirectory = /var/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
Messages {
Name = Standard
director = bacula.server-dir = all, !skipped, !restored
}
At the server make a client config file at /etc/bacula/client/me_the_client.conf and put this line
#/etc/bacula/cilentdef/<hostname>.conf
Client {
Name = messaging # client name
Address = messaging.asik.com # fqdn address
FDPort = 9102
Catalog = MyCatalog #DefaultCatalog <= ASYX server using this
Password = Agw6a4ckidwQ493JwAVl9oTPu3R8PaJGtv3PptWb9Yh2HyryaO1kOm9KiCVLOmaB51FIk8ReEapvrg9reON7k7nDutbadcj4wA5L5ajyuyusVSwovt5Gy4EBZMFd9BxPDYm3W23LK6mtiaJiCZUufiwEq8C9lDDmE4wt3w66tP8EK7ACaFmiMsv9aOjTeSETep7NeaOrPQqhfeR8TDkqO4eBADWYTPjwE1QugpHgWNsta3i91UvVkAOJjztzBKSn # director password
File Retention = 30 days
Job Retention = 6 months
AutoPrune = yes
}
Test Run
Start the bacula server daemon
# service bacula-dir start # service bacula-sd start
open bacula manager using bconsole,just type bconsole on the terminal
# bconsole
Webacula
To use Webcaula we need the latest PHP , ZendFramework and MySQL, download this packages
webacula-5.0.3-1.el5.noarch.rpm
json-c-0.9-1.el5.x86_64.rpm libedit-20090923-3.0_1.el5.rf.x86_64.rpm php-5.3.5-1.el5.remi.1.x86_64.rpm php-cli-5.3.5-1.el5.remi.1.x86_64.rpm php-common-5.3.5-1.el5.remi.1.x86_64.rpm php-devel-5.3.5-1.el5.remi.1.x86_64.rpm php-gd-5.3.5-1.el5.remi.1.x86_64.rpm php-pdo-5.3.5-1.el5.remi.1.x86_64.rpm php-pear-1.9.1-6.el5.remi.noarch.rpm php-process-5.3.5-1.el5.remi.x86_64.rpm php-xml-5.3.5-1.el5.remi.1.x86_64.rpm php-ZendFramework-1.11.0-1.el5.remi.noarch.rpm t1lib-5.1.2-1.el5.rf.x86_64.rpm ZendFramework-1.11.3-minimal.tar.gz
Install all using yum
yum localinstall --nogpgcheck *.rpm
Firewall
Bacula need several port to be open
daemon | port bacula-dir 9101 bacula-fd 9102 bacula-sd 9103
in iptables
# iptables -I INPUT -p tcp -m multiport --dport 9101,9102,9103 -j ACCEPT
Very straight forward. Finally an easy to follow guide with pictures. Took a bit of googling to find this page but I am glad I did. Very helpful in understanding this mishmosh setup.
ReplyDelete