How to Setup Backup Server Using Bacula And Webmin in CentOS
Setup Backup Server Using Bacula And Webmin in CentOS
Bacula is a free tool that allows the Admin to manage backup, recovery and send the verification of data from any systems in any location across the network. The procedure to setup Backup Server using Bacula and webmin is explained in this article.
To install Bacula
Install Bacula and mysql server using the following command.
[root@linuxhelp1 ~]# yum install bacula-director-mysql bacula-console bacula-client bacula-storage-mysql mysql-server mysql-devel -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* extras: mirror.dhakacom.com
* updates: mirror.dhakacom.com
Resolving Dependencies
--> Running transaction check
---> Package bacula-client.x86_64 0:5.0.0-13.el6 will be installed
--> Processing Dependency: bacula-common = 5.0.0-13.el6 for package: bacula-client-5.0.0-13.el6.x86_64
---> Package bacula-console.x86_64 0:5.0.0-13.el6 will be installed
---> Package bacula-director-mysql.x86_64 0:5.0.0-13.el6 will be installed
--> Processing Dependency: bacula-director-common = 5.0.0-13.el6 for package: bacula-director-mysql-5.0.0-13.el6.x86_64
---> Package bacula-storage-mysql.x86_64 0:5.0.0-13.el6 will be installed
.
.
.
zlib-devel.x86_64 0:1.2.3-29.el6
Complete!
Start the mysqld service.
[root@linuxhelp1 ~]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ' new-password'
/usr/bin/mysqladmin -u root -h linuxhelp1 password ' new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
[root@linuxhelp1 ~]# chkconfig mysqld on [root@linuxhelp1 ~]# mysqladmin -u root password linuxc
Create database and necessary tables for Bacula by utilising the following commands.
[root@linuxhelp1 ~]# /usr/libexec/bacula/grant_mysql_privileges -u root -p
Enter password:
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
localhost root *9176348B738266A09F9E292716D2914D60B6677C Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 00 0 0
linuxhelp1 root Y Y Y Y Y Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y 0 00 0
127.0.0.1 root Y Y Y Y Y Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y 0 00 0
localhost N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
linuxhelp1 N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
localhost bacula N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
% bacula N N N N N N N N N N N N N N N NN N N N N N N N N N N N 0 0 00
Privileges for user bacula granted on database bacula.
[root@linuxhelp1 ~]# /usr/libexec/bacula/create_mysql_database -u root -p Enter password: Creation of bacula database succeeded. [root@linuxhelp1 ~]# /usr/libexec/bacula/make_mysql_tables -u root -p Enter password: Creation of Bacula MySQL tables succeeded.
[root@linuxhelp1 ~]# /usr/libexec/bacula/grant_bacula_privileges -u root -p
Granting MySQL privileges
Enter password:
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
localhost root *9176348B738266A09F9E292716D2914D60B6677C Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 00 0 0
linuxhelp1 root Y Y Y Y Y Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y 0 00 0
127.0.0.1 root Y Y Y Y Y Y Y Y Y Y Y Y Y Y YY Y Y Y Y Y Y Y Y Y Y Y Y 0 00 0
localhost N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
linuxhelp1 N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
localhost bacula N N N N N N N N N N N N N N NN N N N N N N N N N N N N 0 00 0
% bacula N N N N N N N N N N N N N N N NN N N N N N N N N N N N 0 0 00
Privileges for user bacula granted on database bacula.
Set bacula user password for MySQL.
[root@linuxhelp1 ~]# 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.73 Source distribution 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(" linuxc" ) 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.00 sec) mysql> exit Bye
To Update Bacula Director
Open the bacula-dir.conf file to update Bacula Director.
[root@linuxhelp1 ~]# vim /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 = " linuxc" # Console password Messages = Daemon }
# Client (File Services) to backup Client { Name = bacula-fd Address = 192.168.5.111 FDPort = 9102 Catalog = MyCatalog Password = " linuxc" # password for FileDaemon File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = yes # Prune expired Jobs/Files }
Storage { Name = File # Do not use " localhost" here Address = 192.168.5.111 # N.B. Use a fully qualified name here SDPort = 9103 Password = " linuxc" 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 = " linuxc" }
# Console { Name = bacula-mon Password = " linuxc" CommandACL = status, .status }
To Update Bacula Console
Open the bconsole.conf file to update the bacula console.
[root@linuxhelp1 ~]# vim /etc/bacula/bconsole.conf
Director { Name = bacula-dir DIRport = 9101 address = localhost Password = " linuxc" }
To Update Storage Daemon
Open the bacula-sd.conf file and edit as follows.
[root@linuxhelp1 ~]# vim /etc/bacula/bacula-sd.conf
# List Directors who are permitted to contact Storage daemon # Director { Name = bacula-dir Password = " linuxc" } . . . 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 }
change the entry of the directory and remove the previous entry.
To Update file daemon
[root@linuxhelp ~]# vim /etc/bacula/bacula-fd.conf
# List Directors who are permitted to contact this File daemon # Director { Name = bacula-dir Password = " linuxc" }
change the directory entry and remove the previous entry
Create a directory called “ mybackup” .
[root@linuxhelp1 ~]# mkdir /mybackup [root@linuxhelp1 ~]# chown bacula /mybackup/
Restart all the bacula daemons and allow them to start automatically on every reboot.
[root@linuxhelp1 ~]# service bacula-dir start Starting bacula-dir: [ OK ] [root@linuxhelp1 ~]# service bacula-fd start Starting bacula-fd: [ OK ] [root@linuxhelp1 ~]# service bacula-sd start Starting bacula-sd: [ OK ] [root@linuxhelp1 ~]# chkconfig bacula-dir on [root@linuxhelp1 ~]# chkconfig bacula-fd on [root@linuxhelp1 ~]# chkconfig bacula-sd on
To manage Bacula With Webmin
Webmin is a web-based interface to setup user accounts, file sharing, Apache, DNS etc.,
[root@linuxhelp1 ~]# wget http://sourceforge.net/projects/webadmin/files/webmin/1.660/webmin-1.660-1.noarch.rpm
--2016-07-18 17:17:42-- http://heanet.dl.sourceforge.net/project/webadmin/webmin/1.660/webmin-1.660-1.noarch.rpm
Resolving heanet.dl.sourceforge.net... 193.1.193.66, 2001:770:18:aa40::c101:c142
Connecting to heanet.dl.sourceforge.net|193.1.193.66|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22005436 (21M) [application/octet-stream]
Saving to: “ webmin-1.660-1.noarch.rpm”
100%[======================================================================================================> ] 22,005,436 304K/s in 2m 59s
2016-07-18 17:20:42 (120 KB/s) - “ webmin-1.660-1.noarch.rpm” saved [22005436/22005436]
[root@linuxhelp1 ~]# rpm -Uvh webmin-1.660-1.noarch.rpm
warning: webmin-1.660-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Preparing... ########################################### [100%]
Operating system is CentOS Linux
1:webmin ########################################### [100%]
Webmin install complete. You can now login to http://linuxhelp1:10000/
as root with your root password.
Now start the web admin services.
[root@linuxhelp1 ~]# service webmin start [root@linuxhelp1 ~]# chkconfig webmin on
Allow the webmin port “ 10000” and bacula ports “ 9101” , “ 9102” , “ 9103” on the firewall or router as shown below.
[root@linuxhelp1 ~]# vim /etc/sysconfig/iptables
-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
To Connect Webmin
Dive into the browser and enter “ //http://< ip_address> :10000” or “ http://< domain_name> :10000/”
Go to System &rarr Bacula Backup System to backup your datas.
The Bacula server cannot start automatically. Click on “ Module Configuration” link on the “ Bacula Backup System” page.
Select the database type and fill the bacula database user and password. Then click Save.
Comments ( 0 )
No comments available