Bacula is an open source network based backup software, used to allow the System Administrators to manage backup, recovery and send the verification of data’s from any systems in any location across the network.
Install Bacula in CentOS 6.4
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
Thats it. Now you can maintain and configure your Bacula server using webmin. Then you will find the bacula module is up and running. Login to webmin using your root user and its password.
You will find the Bacula Backup System in the left pane of webmin console under System -> Bacula Backup System. If not is found there, try in the “unused modules” section.
Click on the “Bacula Backup System” tab. Initially the Bacula server doesn’t get started. To get started Bacula server click on “Module Configuration” section on the right of the “Bacula Backup System” page. Now enter the bacula user password and select the database i.e “MySQL” in this case. Then click save. Now you will get the window like shown below.
From here you can add Backup clients, Volumes and schedule jobs etc.
--------------------------------------------------------------------- Install and Configure Bacula Server in CentOS 6.4 / RHEL 6.4