Hi,
Today my topic is 'How To Configure Backup Server Using Bacula And Webmin"
Bacula server is a good idea for scheduling backup . Bacula is an open source, network backup software, used to allow the System Administrators tomanage backup, recovery and send the verification of data’s from any systems in any location across the network
Bacula server Scenario-
OS- Centos 6.5
IP- 10.0.2.182/21
Step- 1
1- Change IP Address..
[root@server ashutosh]# vim /etc/sysconfig/
network-scripts/ifcfg-eth0
------------------------------ ------------------------------ ---
DEVICE="eth0"
IPADDR=10.0.2.182
NETMASK=255.255.248.0
HWADDR="00:16:D4:39:5B:6F"
NM_CONTROLLED="yes"
ONBOOT="yes"
------------------------------ ------------------------------ --
2- Restart Network Service..
[root@server ashutosh]# service network restart
[root@server ashutosh]# ifconfig
Step-2 Install Some following prerequisites packages..
------------------------------
DEVICE="eth0"
IPADDR=10.0.2.182
NETMASK=255.255.248.0
HWADDR="00:16:D4:39:5B:6F"
NM_CONTROLLED="yes"
ONBOOT="yes"
------------------------------
2- Restart Network Service..
[root@server ashutosh]# service network restart
[root@server ashutosh]# ifconfig
Step-2 Install Some following prerequisites packages..
[root@server ashutosh]# 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 notes, I am using password as “centos” wherever i need to setup password . Define your own.
Step-3 Restart mysqld Services..
[root@server ashutosh]# service mysqld start
[root@server ashutosh]# chkconfig mysqld on
[root@server ashutosh]# mysqladmin -u root password centos
Next run the following commands one by one to create database and necessary tables for Bacula. Here “-u root” means that login with root account and “-p” means prompt for mysql root password i.e “centos” in my case.
[root@server ashutosh]# /usr/libexec/bacula/grant_mysql_privileges -u root -p [root@server ashutosh]# /usr/libexec/bacula/create_ mysql_database -u root -p [root@server ashutosh]# /usr/libexec/bacula/make_ mysql_tables -u root -p [root@server ashutosh]# /usr/libexec/bacula/grant_ bacula_privileges -u root -p
Step-4 Now set bacula user password on MySQL. To do that, log in to your MySQL server with command:
[root@server ashutosh]# mysql -u root -p
------------------------------------------------------------------------------------
And set password as shown below:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.5.35 MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2013, 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.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
------------------------------------------------------------------------------------
Step-5 Update Bacula Director
[root@server ashutosh]# vi /etc/bacula/bacula-dir.conf
# Update
Bacula server hostname, bacula mysql user password, Bacula console
password, Bacula file daemon password etc. Be mindful that you should
use a fully qualified domain name for adding clients or simply use the IP address instead.
[...] 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 = 192.168.1.101 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 = 192.168.1.101 # 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 }
Step-6 Update Bacula Console
[root@server ashutosh]# vi /etc/bacula/bconsole.conf
Change the console password:
Director {
Name = bacula-dir
DIRport = 9101
address = localhost
Password = "centos"
}
Step-7 Update Storage Daemon
# vi /etc/bacula/bacula-sd.conf
# Update the password, Find the red lines and delete them, do not uncomment them. Also set your Archive device path.
[...]
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;
}
[...]
Step-8 Update file daemon
[root@server ashutosh]# 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
}
Step-9
As i mentioned in the above configuration, my archive device path is “/mybackup”. So let me create a directory called “mybackup”.
[root@server ashutosh]# mkdir /mybackup [root@server ashutosh]# chown bacula /mybackup
Step-10
Now we
finished all passwords and address modifications. Next restart all
bacula daemons and make them to start automatically on every reboot.
[root@server ashutosh]# service bacula-dir start [root@server ashutosh]# service bacula-fd start [root@server ashutosh]# service bacula-sd start [root@server ashutosh]# chkconfig bacula-dir on [root@server ashutosh]# chkconfig bacula-fd on [root@server ashutosh]# chkconfig bacula-sd on
Bacula has
been successfully installed and configured. You can now add clients,
jobs and volumes by updating the bacula config files. Alternatively you
can use webmin to make the work more simple. It is quite easier then updating the config files manually.
Manage Bacula With WebminWebmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more.
Download and install the latest version of webmin from here.
[root@server ashutosh]# wget http://sourceforge.net/projects/webadmin/files/ webmin/1.660/webmin-1.660-1. noarch.rpm [root@server ashutosh]# rpm -Uvh webmin-1.660-1.noarch.rpm [root@server ashutosh]# service webmin start [root@server ashutosh]# chkconfig webmin on
Step-10
Adjust Firewall/Router-
If you want to access the bacula server through from a remote system, allow the webmin port “10000″ and bacula ports “9101″, “9102″, “9103″ through your firewall or router.
Edit file /etc/sysconfig/iptables,
[root@server ashutosh]# vi /etc/sysconfig/iptables
Add these following lines in your iptables config file.
[...]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9101 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9103 -j ACCEPT
[...]
Restart iptables:
[root@server ashutosh]# service iptables restart
Step-11 Access Webmin
Now you can login through webmin by “//10.0.2.182: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.
And Then click..Module Configuration..
Select the database i.e “MySQL” in this case and enter the bacula database user password. Then click save.
Now you will get the window like shown below.
That’s it. From here you can add Backup clients, Volumes and schedule jobs etc.
I Hope You Like It,
So Enjoy..
______________________________________________________________________________________