In
this how-to i am using MySQL for database, you can use either
PostgreSQL or MySQL. My Backup server hostname and IP Address are
“backup.unixmen.local” and “192.168.1.200/24″
respectively.
[root@server
~]# yum install bacula-director-mysql bacula-console bacula-client
bacula-storage-mysql mysql-server mysql-devel -y
Start
MySQL service and create root password for mysql.
Note:
In this tutorial, i am using password as “centos” wherever
i need to setup password . Define your own.
[root@server
~]# /etc/init.d/mysqld start
[root@server
~]# chkconfig mysqld on
[root@server
~]# mysqladmin -u root password centos
Next
run the following commands one by one to create necessary tables for
bacula. Here “-u root” means that login with root account
and “-p” means prompt for mysql password i.e “centos”
in this case.
[root@server
~]# /usr/libexec/bacula/grant_mysql_privileges -u root -p
[root@server
~]# /usr/libexec/bacula/create_mysql_database -u root -p
[root@server
~]# /usr/libexec/bacula/make_mysql_tables -u root -p
[root@server
~]# /usr/libexec/bacula/grant_bacula_privileges -u root -p
Now
change the bacula user password.
[root@server
~]# mysql -u root -p
Enter
password:
Welcome
to the MySQL monitor. Commands end with ; or \g.
Your
MySQL connection id is 7
Server
version: 5.1.67 Source distribution
Copyright
(c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle
is a registered trademark of Oracle Corporation and/or its
affiliates.
Other names may be trademarks of their respective
owners.
Type
'help;' or '\h' for help. Type '\c' to clear the current input
statement.
mysql>
UPDATE mysql.user SET password=PASSWORD("centos") WHERE
user='bacula';
Query
OK, 2 rows affected (0.01 sec)
Rows
matched: 2 Changed: 2 Warnings: 0
mysql>
FLUSH PRIVILEGES;
Query
OK, 0 rows affected (0.00 sec)
mysql>
quit
Now
update all the configuration files with new password and addresses as
shown below.
Update
Bacula director
[root@server
~]# vi /etc/bacula/bacula-dir.conf
Director
{
# define myself
Name
= bacula-dir
DIRport
= 9101
# where we listen for UA connections
QueryFile
= "/usr/libexec/bacula/query.sql"
WorkingDirectory
= "/var/spool/bacula"
PidDirectory
= "/var/run"
Maximum
Concurrent Jobs = 1
Password
= "centos"
# Console password
Messages
= Daemon
#
Client (File Services) to backup
Client
{
Name
= bacula-fd
Address
= backup.unixmen.local
FDPort
= 9102
Catalog
= MyCatalog
Password
= "centos"
# password for FileDaemon
File
Retention = 30 days
# 30 days
Job
Retention = 6 months
# six months
AutoPrune
= yes
# Prune expired Jobs/Files
}
#
Definition of file storage device
Storage
{
Name
= File
#
Do not use "localhost" here
Address
= backup.unixmen.local
# N.B. Use a fully qualified name here
SDPort
= 9103
Password
= "centos"
Device
= FileStorage
Media
Type = File
}
#
Generic catalog service
Catalog
{
Name
= MyCatalog
#
Uncomment the following line if you want the dbi driver
#
dbdriver = "dbi:sqlite3"; dbaddress = 127.0.0.1; dbport =
dbname
= "bacula"; dbuser = "bacula"; dbpassword =
"centos"
}
Console
{
Name
= bacula-mon
Password
= "centos"
CommandACL
= status, .status
}
Update
Bacula console
[root@server
~]# vi /etc/bacula/bconsole.conf
Director
{
Name
= bacula-dir
DIRport
= 9101
address
= localhost
Password
= "centos"
}
Update
the Storage Daemon
[root@server
~]# vi /etc/bacula/bacula-sd.conf
Director
{
Name
= bacula-dir
Password
= "centos"
}
##Delete
the following lines (Do not uncomment). As i installed centos minimal
server, i don't have a GUI mode, so that i deleted the following
section##
#
Restricted Director, used by tray-monitor to get the
#
status of the storage daemon
#
Director
{
Name = bacula-mon
Password =
"@@MON_SD_PASSWORD@@"
Monitor = yes
}
Device
{
Name
= FileStorage
Media
Type = File
Archive
Device = /mybackup
LabelMedia
= yes;
# lets Bacula label unlabeled media
Random
Access = Yes;
AutomaticMount =
yes;
# when device opened, read it
RemovableMedia =
no;
AlwaysOpen
= no;
}
Update
the file daemon
[root@server
~]# vi /etc/bacula/bacula-fd.conf
#
List Directors who are permitted to contact this File daemon
#
Director
{
Name
= bacula-dir
Password
= "centos"
}
##Delete
(do not uncomment) these lines if you only using CUI mode in Backup
server ##
#
Restricted Director, used by tray-monitor to get the
#
status of the storage daemon
#
Director
{
Name
= bacula-mon
Password
= "@@MON_SD_PASSWORD@@"
Monitor
= yes
}
As
i mentioned in the above configuration that my archive data path is
“/mybackup”. So lets create a directory called “mybackup”.
[root@server
~]# mkdir /mybackup
[root@server
~]# chown bacula /mybackup
Now
we finished all passwords and address modifications. Next restart all
bacula daemons.
[root@server
~]# /etc/init.d/bacula-dir start
Starting
bacula-dir:
[ OK ]
[root@server
~]# /etc/init.d/bacula-fd start
Starting
bacula-fd:
[ OK ]
[root@server
~]# /etc/init.d/bacula-sd start
Starting
bacula-sd:
[ OK ]
[root@server
~]# chkconfig bacula-dir on
[root@server
~]# chkconfig bacula-fd on
[root@server
~]# chkconfig bacula-sd on
Bacula
is running successfully now. You can now add clients, jobs and
volumes by updating the bacula config files. Alternatively you can
use webmin for this purpose. It is quite easy then updating
the config files manually.
Download
and install webmin
[root@server
~]# wget
http://prdownloads.sourceforge.net/webadmin/webmin-1.620-1.noarch.rpm
[root@server
~]# rpm -ivh webmin-1.620-1.noarch.rpm
[root@server
~]# /etc/init.d/webmin start
[root@server
~]# chkconfig webmin on
Now
you can login through webmin by “//http://server-ip-address or
server-domain-name:10000/”. If you want to access the bacula
server through webmin, allow the webmin port “10000″ and
bacula ports “9101″, “9102″, “9103″ through your
firewall or router.
Add
these following lines in your iptables config file.
[root@server
~]# vi /etc/sysconfig/iptables
-A
INPUT -p udp -m state --state NEW --dport 10000 -j ACCEPT
-A
INPUT -p tcp -m state --state NEW --dport 10000 -j ACCEPT
-A
INPUT -p udp -m state --state NEW --dport 9101 -j ACCEPT
-A
INPUT -p tcp -m state --state NEW --dport 9101 -j ACCEPT
-A
INPUT -p udp -m state --state NEW --dport 9102 -j ACCEPT
-A
INPUT -p tcp -m state --state NEW --dport 9102 -j ACCEPT
-A
INPUT -p udp -m state --state NEW --dport 9103 -j ACCEPT
-A
INPUT -p tcp -m state --state NEW --dport 9103 -j ACCEPT
Restart
iptables.
[root@server
~]# service iptables restart
-
See more at:
http://www.unixmen.com/install-and-configure-bacula-server-in-centos-6-4-rhel-6-4/#sthash.LYryvhLe.dpuf
Install
webacula bacula backup server on CentOS/RHEL, Fedora
You
need to install php-ZendFramework before Webacula.
Add
remi and epel repositories.
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install
ZendFramework and Db-Adapter for Mysql
# yum --enablerepo=remi install php-ZendFramework php-ZendFramework-Db-Adapter-Pdo-Mysql
Now
download webacula, untar it and move it under /usr/share
# wget http://sourceforge.net/projects/webacula/files/latest/download
# tar zxvf webacula-5.5.1.tar.gz
# mv webacula-5.5.1 /usr/share/webacula
# cd /usr/share/webacula
# cd install/
# php check_system_requirements.php
Move
to the library directory and create a symlink for Zend. You will find
Zend under /usr/share/php/Zend/
# cd /usr/share/webacula/library/
# ln -s /usr/share/php/Zend/ .
Open
db.conf file and add the password.
# cd /usr/share/webacula/install/
# vi db.conf
This
password will be used to login to webacula console.
db_name="bacula"
db_user="root"
db_pwd="mysqlroot@123"
webacula_root_pwd="baculapass"
Execute
the scripts to create db tables for webcaula.
# cd /usr/share/webacula/install/MySql/
# ./10_make_tables.sh
# ./20_acl_make_tables.sh
If
you have bacula installed you would probably have bacula group, if
not then add it. Add apache to bacula group.
# groupadd bacula
# usermod -aG bacula apache
Allow
Apache to execute bconsole file using bconsole.conf configuration
file. My bconsole binary is under /usr/local/bacula/bin/
# chown root:bacula /usr/local/bacula/bin/bconsole
# chmod u=rwx,g=rx,o= /usr/local/bacula/bin/bconsole
#
chown root:bacula /usr/local/bacula/bin/bconsole.conf
# chmod u=rw,g=r,o= /usr/local/bacula/bin/bconsole.conf
# chmod u=rw,g=r,o= /usr/local/bacula/bin/bconsole.conf
Edit
application/config.ini and add the bacula database name and
credentials. Also remove sudo path and edit bacula.bconsole binary
location. The sudo path would be /sbin/sudo, remove that and left the
field blank as shown below
# vi /usr/share/webacula/application/config.ini
Edit
the hostname, db name, root username and password
db.adapter = PDO_MYSQL
db.config.host = localhost
db.config.username = mysqlroot@123
db.config.dbname = bacula
bacula.sudo
= ""
bacula.bconsole = "/usr/local/bacula/bin/bconsole"
bacula.bconsole = "/usr/local/bacula/bin/bconsole"
Copy
the configuration file for Apache to /etc/httpd/conf.d
# cp /usr/share/webacula/install/apache/webacula.conf /etc/httpd/conf.d/
Edit
the webacula.conf file.
# vi /etc/httpd/conf.d/webacula.conf
Add
the allowed IP’s that can access webacula. If you wish to remove
this restriction comment the Deny from all feild.
Allow from 192.161.150.0/255.255.255.0
or
#
Deny from all
Increase
values in /etc/php.ini :
# vi /etc/php.ini
Set
the values for the following variables.
memory_limit = 128M
max_execution_time = 300
Restart
the Apache service
# /etc/init.d/httpd restart
No comments:
Post a Comment