7/21/2019 Bacula en Centos6
1/21
Bacula.Manual para la instalacin en CentOS v6.x.
(Documento sujeto a cambios)
Ing. Luis Gonzlez Fraga
31/03/2013
Bacula, instalacin en CentOS v.6.x by Luis Gonzlez Fraga is licensed under a Creative
Commons Attribution-NonCommercial-NoDerivs 3.0 Spain License. Based on work at
www.samvar.es
7/21/2019 Bacula en Centos6
2/21
7/21/2019 Bacula en Centos6
3/21
Nota del autor:
Usted encontrar algunos errores de redaccin en este documento, puesto que el mismo est
confeccionado en casi toda su totalidad con el uso de un software de transcripcin de voz.
Disculpe las molestias que esto pueda ocasionar.
Instalacin de Bacula:
Abriremos la terminal de consola para realizar algunos pasos previos a la instalacin.
Una vez abierta, realizaremos la instalacin de algunas dependencias necesarias las cuales
pueden que ya se encuentren instaladas o actualizadas en nuestro sistema en cuyo caso no se
realizar absolutamente nada. Escribimos o copiamos el siguiente mandato de instalacin en
dicha terminal de consola para instalar las dependencias necesarias:
yum -y install gcc gcc-c++ mysql mysql-devel mysql-server autoconf automake m4 make qwt
qwt-devel wxGTK
Concluida la instalacin de los paquetes iniciamos el servicio de base de datos escribiendo el
siguiente mandato:
service mysqld start
Como tercer paso, le indicamos al servicio MySQL quin es el usuario administrador de la base
de datos as como su respectiva contrasea (Usted puede elegir la que desee).
mysqladmin -u root password 123456
Luego indicar que el servicio siempre se inicie al arrancar el sistema en los niveles de ejecucin
2,3,4 y 5 escribiendo el siguiente comando:
chkconfig --level 2345 mysqld on
Crear la carpeta llamada Bacula dentro del directorio /opt escribiendo el siguiente comando:
mkdir /opt/bacula
Y acceder a la misma:
cd /opt/bacula
Descargar ahora el paquete de instalacin para la ltima versin de Bacula por ejemplo, la
versin 5.2.13. Escribir en consola el siguiente mandato:
wget http://downloads.sourceforge.net/project/bacula/bacula/5.2.13/bacula-5.2.13.tar.gz
Una vez concluida la descarga, descomprimir el paquete:
tar xzf /opt/bacula/bacula-5.2.13.tar.gz
Y acceder al directorio de instalacin:
7/21/2019 Bacula en Centos6
4/21
cd /opt/bacula/bacula-5.2.13
Y ejecutar la siguiente lnea de comando:
./configure --with-mysql
La cual ejecuta un script que permite acondicionar algunos ficheros necesarios para la
instalacin. Tambin se le pasa el un parmetro que define que se har uso de una base de
datos MySQL.
Finalizado el script, ahora se puede compilar los archivos de instalacin ejecutando el
comando:
make
Y proseguir con la instalacin de Bacula:
make install
Concluida la instalacin de Bacula, copiar el script de ejecucin del servicio al directorio donde
se localizan el resto de los servicios en CentOS.
cp -av /etc/bacula/bacula /etc/rc.d/init.d/bacula
Tambin es necesario editarlo:
vi /etc/rc.d/init.d/bacula
para aadir bajo la lnea del inicio del script las siguientes lneas:
# chkconfig: 345 99 10
# description: bacula
Guardar los cambios, y entrar va consola al directorio de instalacin de Bacula para ejecutar
unos scripts que permitirn crear la base de datos de Bacula, escribir las tablas necesarias en la
misma y asignar privilegios de acceso.
cd /etc/bacula/
Ejecutar siguiendo este orden: "Primero el script de acceso y privilegios de Bacula en la base de
datos"
./grant_bacula_privileges -u root -p
Aqu se solicita contrasea de acceso del usuario administrador de MySQL.
Ejecutar el script de creacin de la base de datos que utilizar Bacula.
./create_bacula_database -u root -p
Se vuelve a solicitar la contrasea de acceso del usuario administrador de MySQL
7/21/2019 Bacula en Centos6
5/21
Y por ltimo se crean las diferentes tablas que utilizar Bacula en su base de datos:
./make_bacula_tables -u root -p
Aqu tambin se solicita la contrasea de acceso del usuario administrador de MySQL.
Antes de iniciar los servicios de Bacula es necesario editar los ficheros de configuracin en la
carpeta de instalacin llamada Bacula dentro del directorio /etc.
-"Importante."-
En la configuracin de los ficheros, prestar especial atencin al escribir la ruta verdadera de
instalacin de Bacula as como la de trabajo marcadas en rojo como se muestra en el siguiente
ejemplo:
Director { # define myself
Name = servercentos03-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/etc/bacula/query.sql"
WorkingDirectory = "/opt/bacula/working"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 20
Password = "989669" # Console password
Messages = Daemon
}
Otro aspecto muy pero muy importante es indicar el usuario y la contrasea para conectar a la
base de datos. En esta gua dicho usuario es root y emplear la contrasea del administrador
de la base de datos.
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 = "root"; dbpassword = "12345"
}
7/21/2019 Bacula en Centos6
6/21
A continuacin se muestra un ejemplo de cada uno de estos ficheros que son validos para una
instalacin de Bacula en CentOS v.6.x:
Fichero: bacula-dir.conf
############################################################## Director Definitions ###
###########################################################
Director { # define myself
Name = servercentos03-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/etc/bacula/query.sql"
WorkingDirectory = "/opt/bacula/working"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 20
Password = "989669" # Console password
Messages = Daemon
}
###########################################################
### Backup JobsDef##
###########################################################
JobDefs {
Name = "DefaultJob"Type = Backup
Level = Full
# Client = servercentos03-fd
# FileSet = "Full Set"
# Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = FullFile
# Priority = 1
# Write Bootstrap = "/opt/bacula/working/%c.bsr"
}
###########################################################
### Backup Job's Definitions ###
###########################################################
Job {
Name = "Backupservercentos03"
JobDefs = "DefaultJob"
7/21/2019 Bacula en Centos6
7/21
Write Bootstrap = "/opt/bacula/working/servercentos03.bsr"
Client = servercentos03-fd
FileSet = "servercentos03-FS"
Schedule = "servercentos03-SCH"
Maximum Concurrent Jobs = 20
Priority = 11
}
Job {
Name = "Backupnarzil"
JobDefs = "DefaultJob"
Write Bootstrap = "/opt/bacula/working/narzil.bsr"
Client = narzil-fd
FileSet = "narzil-FS"
Schedule = "narzil-SCH"Maximum Concurrent Jobs = 20
Priority = 12
}
# Backup the catalog database (after the nightly save)
Job {
Name = "BackupCatalog"
JobDefs = "DefaultJob"
Write Bootstrap = "/opt/bacula/working/catalog.bsr"
Client = CATALOG-FD
FileSet="CATALOG-FS"
Schedule = "CATALOG-SCH"
# This creates an ASCII copy of the catalog
# Arguments to make_catalog_backup.pl are:
# make_catalog_backup.pl
#RunBeforeJob = "/usr/lib/bacula/make_catalog_backup.pl MyCatalog"
# This deletes the copy of the catalog
#RunAfterJob = "/usr/lib/bacula/delete_catalog_backup"
Maximum Concurrent Jobs = 20
Priority = 13
}
###########################################################
### Restore Jobs ###
###########################################################
### Template ###JobDefs {
7/21/2019 Bacula en Centos6
8/21
Name = "RestoreFiles"
Type = Restore
Storage = File
Pool = FullFile
Messages = Standard
}
Job {
Name = "Restoreservercentos03"
JobDefs = "RestoreFiles"
Client = servercentos03-fd
FileSet = "servercentos03-FS"
Where = "/opt/restaurar/servercentos03/"
}
Job {
Name = "Restorenarzil"
JobDefs = "RestoreFiles"
Client = narzil-fd
FileSet = "narzil-FS"
Where = "J:/RestaurarDatos/"
}
Job {
Name = "RestoreCATALOG"
JobDefs = "RestoreFiles"
Client = CATALOG-FD
FileSet = "CATALOG-FS"
Where = "/opt/restaurar/CATALOG/"
}
###########################################################
### File Set Definitions ###
###########################################################
FileSet {
Name = "servercentos03-FS"
Enable VSS = No
Include {
Options {
signature = MD5
compression = GZIP
}#File = "/bin"
7/21/2019 Bacula en Centos6
9/21
#File = "/boot"
#File = "/dev"
File = "/etc"
File = "/home"
File = "/lib"
#File = "/mnt"
File = "/root"
File = "/sbin"
#File = "/selinux"
#File = "/srv"
File = "/tmp"
File = "/usr"
File = "/var/account"
File = "/var/cache"
File = "/var/db"File = "/var/empty"
#File = "/var/games"
File = "/var/gdm"
File = "/var/lib"
File = "/var/local"
File = "/var/lock"
File = "/var/log"
File = "/var/mail"
File = "/var/named"
File = "/var/nis"
File = "/var/opt"
File = "/var/preserve"
File = "/var/racoon"
File = "/var/run"
File = "/var/spool"
File = "/var/tmp"
File = "/var/www/"
}
}
FileSet {
Name = "narzil-FS"
Enable VSS = Yes
Include {
Options {
signature = MD5
compression = GZIP
}File = "D:/TRABAJO/videos tutoriales/Documentos/"
7/21/2019 Bacula en Centos6
10/21
File = "D:/TRABAJO/compartida/Trabajos con Centos/"
}
}
FileSet {
Name = "CATALOG-FS"
Enable VSS = No
Include {
Options {
signature = MD5
compression = GZIP
}
File = "/etc"
File = "/opt/bacula/working"
File = "/var/log"}
}
###########################################################
### Schedule Definitions ###
###########################################################
Schedule {
Name = "servercentos03-SCH"
Run = mon at 00:00
Run = Level = Differential Storage = File Pool = DiffFile tue-sun at 02:00
}
Schedule {
Name = "narzil-SCH"
Run = mon at 04:00
Run = Level = Differential Storage = File Pool = DiffFile tue-sun at 06:30
}
Schedule {
Name = "CATALOG-SCH"
Run = mon at 03:00
Run = Differential Pool = DiffFile tue-sat at 03:30
}
###########################################################
### Clients Definitions ###
###########################################################
7/21/2019 Bacula en Centos6
11/21
Client {
Name = servercentos03-fd
Address = 192.168.1.15
FDPort = 9102
Catalog = MyCatalog
Password = "989669" # password for FileDaemon
File Retention = 15 days # 30 days
Job Retention = 1 months # six months
AutoPrune = yes # Prune expired Jobs/Files
Maximum Concurrent Jobs = 20
}
Client {
Name = CATALOG-FD
Address = 192.168.1.15FDPort = 9102
Catalog = MyCatalog
Password = "989669" # password for FileDaemon
File Retention = 15 days # 30 days
Job Retention = 1 months # six months
AutoPrune = yes # Prune expired Jobs/Files
Maximum Concurrent Jobs = 20
}
Client {
Name = narzil-fd
Address = 192.168.1.6
FDPort = 9102
Catalog = MyCatalog
Password = "989669" # password for FileDaemon
File Retention = 15 days # 30 days
Job Retention = 1 months # six months
AutoPrune = yes # Prune expired Jobs/Files
Maximum Concurrent Jobs = 20
}
###########################################################
### Storage Definitions ###
###########################################################
Storage {
Name = File
Address = 192.168.1.15 # N.B. Use a fully qualified name here
SDPort = 9103Password = "989669"
7/21/2019 Bacula en Centos6
12/21
Device = FileStorage
Media Type = File
Maximum Concurrent Jobs = 20
}
###########################################################
### Catalog ###
###########################################################
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 = "root"; dbpassword = "123456"
}###########################################################
### Message Definitions ###
###########################################################
Messages {
Name = Standard
mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \\" -s \"Bacula: %t %e of %c
%l\" %r"
operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \\" -s \"Bacula:
Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/root/bacula/bin/working/log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
mailcommand = "/etc/bacula/bsmtp -h 192.168.1.2 -f \"\(Bacula\) \\" -s \"Bacula: %t
%e of %c %l\" %r"
mail [email protected]= all, !skipped
console = all, !skipped, !saved
append = "/opt/bacula/working/log" = all, !skipped
}
###########################################################
### Pools ##############################################################
mailto:[email protected]:[email protected]:[email protected]:[email protected]7/21/2019 Bacula en Centos6
13/21
### Full Files ###
Pool {
Name = FullFile
Maximum Volumes = 0
Pool Type = Backup
Use Volume Once = no
Maximum Volume Jobs = 8
Maximum Volume Files = 0
Maximum Volume Bytes = 0
Volume Use Duration = 0
Catalog Files = yes
AutoPrune = yes
Volume Retention = 45 days
Recycle Current Volume = noRecycle = yes
Label Format = FullFile-
}
Pool {
Name = DiffFile
Pool Type = Backup
Use Volume Once = no
Maximum Volume Jobs = 24
Maximum Volume Files = 0
Maximum Volume Bytes = 0
Volume Use Duration = 0
Catalog Files = yes
Recycle = yes
AutoPrune = yes
Volume Retention = 45 days
Label Format = FileDiff-
}
# Scratch pool definition
Pool {
Name = Scratch
Pool Type = Backup
}
#
# Restricted console used by tray-monitor to get the status of the director
#
Console {Name = servercentos03-mon
7/21/2019 Bacula en Centos6
14/21
Password = "989669"
CommandACL = status, .status
}
Fichero: bacula-fd.conf
#
# Default Bacula File Daemon Configuration file
#
# For Bacula release 5.2.13 (19 February 2013) -- redhat (Final)
#
# There is not much to change here except perhaps the
# File daemon Name to
#
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = servercentos03-dir
Password = "989669"
}
#
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
#
Director {
Name = servercentos03-mon
Password = "989669"
Monitor = yes
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = servercentos03-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /opt/bacula/working
Pid Directory = /var/run
Maximum Concurrent Jobs = 20}
7/21/2019 Bacula en Centos6
15/21
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = servercentos03-dir = all, !skipped, !restored
}
Fichero: Bacula-sd.conf
#
# Default Bacula Storage Daemon Configuration file
#
# For Bacula release 5.2.13 (19 February 2013) -- redhat (Final)
## You may need to change the name of your tape drive
# on the "Archive Device" directive in the Device
# resource. If you change the Name and/or the
# "Media Type" in the Device resource, please ensure
# that dird.conf has corresponding changes.
#
Storage { # definition of myself
Name = servercentos03-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/opt/bacula/working"
Pid Directory = "/var/run"
Maximum Concurrent Jobs = 20
}
#
# List Directors who are permitted to contact Storage daemon
#
Director {
Name = servercentos03-dir
Password = "989669"
}
#
# Restricted Director, used by tray-monitor to get the
# status of the storage daemon
#
Director {
Name = servercentos03-monPassword = "989669"
7/21/2019 Bacula en Centos6
16/21
Monitor = yes
}
#
# Note, for a list of additional Device templates please
# see the directory /examples/devices
# Or follow the following link:
# http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/
#
#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
# same Name and MediaType.
#
Device {
Name = FileStorage
Media Type = File
Archive Device = /opt/backups
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
#
# An autochanger device with two drives
#
#Autochanger {
# Name = Autochanger
# Device = Drive-1
# Device = Drive-2
# Changer Command = "/usr/lib/bacula/mtx-changer %c %o %S %a %d"
# Changer Device = /dev/sg0
#}
#Device {
# Name = Drive-1 #
# Drive Index = 0
# Media Type = DLT-8000
# Archive Device = /dev/nst0
# AutomaticMount = yes; # when device opened, read it# AlwaysOpen = yes;
http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/7/21/2019 Bacula en Centos6
17/21
# RemovableMedia = yes;
# RandomAccess = no;
# AutoChanger = yes
# #
# # Enable the Alert command only if you have the mtx package loaded
# # Note, apparently on some systems, tapeinfo resets the SCSI controller
# # thus if you turn this on, make sure it does not reset your SCSI
# # controller. I have never had any problems, and smartctl does
# # not seem to cause such problems.
# #
# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
# If you have smartctl, enable this, it has more info than tapeinfo
# Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#Device {
# Name = Drive-2 #
# Drive Index = 1
# Media Type = DLT-8000
# Archive Device = /dev/nst1
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# AutoChanger = yes
# # Enable the Alert command only if you have the mtx package loaded
# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
# If you have smartctl, enable this, it has more info than tapeinfo
# Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#
# A Linux or Solaris LTO-2 tape drive
#
#Device {
# Name = LTO-2
# Media Type = LTO-2
# Archive Device = /dev/nst0
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# Maximum File Size = 3GB
## Changer Command = "/usr/lib/bacula/mtx-changer %c %o %S %a %d"## Changer Device = /dev/sg0
7/21/2019 Bacula en Centos6
18/21
## AutoChanger = yes
# # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#
# A Linux or Solaris LTO-3 tape drive
#
#Device {
# Name = LTO-3
# Media Type = LTO-3
# Archive Device = /dev/nst0
# AutomaticMount = yes; # when device opened, read it# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# Maximum File Size = 4GB
## Changer Command = "/usr/lib/bacula/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
# # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#
# A Linux or Solaris LTO-4 tape drive
#
#Device {
# Name = LTO-4
# Media Type = LTO-4
# Archive Device = /dev/nst0
# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes;
# RemovableMedia = yes;
# RandomAccess = no;
# Maximum File Size = 5GB
## Changer Command = "/usr/lib/bacula/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
# # Enable the Alert command only if you have the mtx package loaded## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
7/21/2019 Bacula en Centos6
19/21
## If you have smartctl, enable this, it has more info than tapeinfo
## Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#
# A FreeBSD tape drive
#
#Device {
# Name = DDS-4
# Description = "DDS-4 for FreeBSD"
# Media Type = DDS-4
# Archive Device = /dev/nsa1# AutomaticMount = yes; # when device opened, read it
# AlwaysOpen = yes
# Offline On Unmount = no
# Hardware End of Medium = no
# BSF at EOM = yes
# Backward Space Record = no
# Fast Forward Space File = no
# TWO EOF = yes
# If you have smartctl, enable this, it has more info than tapeinfo
# Alert Command = "sh -c 'smartctl -H -l error %c'"
#}
#
# Send all messages to the Director,
# mount messages also are sent to the email address
#
Messages {
Name = Standard
director = servercentos03-dir = all
}
7/21/2019 Bacula en Centos6
20/21
Fichero: bconsole.conf
#
# Bacula User Agent (or Console) Configuration File
#
Director {
Name = servercentos03-dir
DIRport = 9101
address = 192.168.1.15
Password = "989669"
}
Fichero: bat.conf
#
# Bacula Administration Tool (bat) configuration file
#
Director {
Name = servercentos03-dir
DIRport = 9101
address = 192.168.1.15
Password = "989669"
}
7/21/2019 Bacula en Centos6
21/21
Tambin es muy importante crear si es que no existen, los distintos directorios que
especificamos dichos ficheros de configuracin.
mkdir /opt/backups
mkdir /opt/restaurar
mkdir /opt/restaurar/servercentos03
mkdir /opt/restaurar/CATALOG
Para iniciar por primera vez el servicio de Bacula, ejecute el siguiente comando:
service bacula start
Para reiniciar el servicio, ejecute:
service bacula restart
Para detener el servicio ejecute:
service bacula stop
Para iniciarlo nuevamente volvemos a escribir:
service bacula start
Para agregar el servicio al arranque del sistema ejecute:
chkconfig --level 345 bacula on
Para instalar la herramienta de administracin de Bacula (bat) ejecute el siguiente mandato de
instalacin:
yum install bacula-console-bat
Para poder utilizarla, tenis que iniciar una seccin grfica en CentOS v6.x, y haga clic en el
botn: "Aplicaciones" y seleccione el men: "Herramientas del sistema" para hacer clic en la
opcin: "Bacula Bat Console". Entonces se inicia la herramienta de administracin grfica de
Bacula.
Para gestionar Bacula va consola, solo basta escribir el comando:
bconsole