Unknown Unknown Author
Title: Bacula Server Installation and Configuration on Centos
Author: Unknown
Rating 5 of 5 Des:
What is Bacula? Bacula  is a set of Open Source, enterprise ready, computer programs that permit you (or the system administrator...

What is Bacula?

Bacula is a set of Open Source, enterprise ready, computer programs that permit you (or the system administrator) to manage backup, recovery, and verification of computer data across a network of computers of different kinds.
In technical terms, it is an Open Source, enterprise ready, network based backup program. Website: http://www.bacula.org/en/

Enable EPEL Repository on RHEL/CentOS 7/6/5?

You have to Enable Epel Repository on Centos machine for installing Bacula.For this follow below steps:
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
if you get error stating :
“Cannot retrieve metalink for repository: epel. Please verify its path and try again”
then run:
# sudo yum upgrade ca-certificates –disablerepo=epel
Now, Disable SELinux:
#vi /etc/sysconfig/selinux
Change the following: SELINUX=enforcing to SELINUX=disabled

Steps for Installation on Bacula Server:

Step 1:Install the Webmin YUM Repository:
# vim /etc/yum.repos.d/webmin.repo
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
Add GPG key for webmin and install webmin:
# rpm –import http://www.webmin.com/jcameron-key.asc
# yum install webmin
You can now login to webmin as https://baculaserver:10000/ as root with your root password.
Step 2:Install Mysql and Bacula:
# yum install mysql-devel mysql-server
# yum install bacula-storage-mysql bacula-docs
# yum install bacula-director-mysql bacula-console
# yum install bacula-traymonitor
Start and Configure Mysql for Bacula:
# service mysqld start
# chkconfig mysqld on
Change the Mysql root password if you have a fresh install of Mysql:
# mysqladmin -u root password ‘new-password’
Now, configure Mysql for bacula, for this run the following scripts, i used password as “redhat”:
# /usr/libexec/bacula/grant_mysql_privileges -u root –p
Enter password: redhat
# /usr/libexec/bacula/create_mysql_database -u root –p
Enter password: redhat
# /usr/libexec/bacula/make_mysql_tables -u root –p
Enter password: redhat
# /usr/libexec/bacula/grant_bacula_privileges -u root –p
Enter password: redhat
Now, Check mysql database for bacula:
Baculaserver # mysql -u root –p
Enter password:
mysql> show databases; (let’s see what databases the bacula user have access to)
mysql> use bacula; (set default database to bacula (bacula is the name of the Catalog database).
mysql> show tables; (let’s see what tables are in the Catalog database)
mysql> quit (quit MySQL CLI prompt to return to OS system prompt)
If you saw bacula in database as well as tables then your mysql database is working fine and database is created.

Configure the default configuration file bacula-dir.conf on bacula server:

Step 1:Edit Director Section of “bacula-dir.conf” file and Change Director Name and Password of your choice as i mentioned below:
# vim  /etc/bacula/bacula-dir.conf
1
Step 2:Edit Catalog Section of bacula-dir.conf file and Change dbuser as bacula and dbpassword as redhat:
2
Step 3:Create Client {…} section in bacula-dir.conf file for client (192.168.0.151):
Name: this Client {…} section defines the client, so name it client.
Address: the IP address of the client.
Password: password specific for client and must match the password specified in bacula-fd.conf Director {…} section on the client server.
3
Step 4:Create Client {…} section in bacula-dir.conf file for window pc (192.168.0.100):
4
Step5:Edit Storage {…} section in bacula-dir.conf file:
Name: we are going to use 2 devices (disks) for backup, so I like the name of this section to represent the disk number of the device, this section is going to point to filestorage having name file and filestorage2 is having name file2.
Address: ip address of the pc which is having storage available.
SDPort: the port on which to connect the Storage Daemon.
Password: this password should match the bacula-sd.conf Director {…} section.
Media Type: Bacula supports many different media types, eg. DDS-4 tapes, DVDs etc. We are using files to store the backup data, so we specify the Media Type = File.
5
6
Step 6:create new Pools in Pool {…} section in bacula-dir.conf:
7
8
Step 7:Open bconsole.conf file and edit bconsole.conf Director Section on bacula server:
# vim /etc/bacula/bconsole.conf
Name: Here you must use the same name you gave the bacula-dir.conf Director {} section (there the Director defines itself).
DIRport: The port on which the Console will contact the Director.
Address: the address on which the Director run
Password: the password should match the password in the bacula-dir Director {} section.
9
Edit name, address and password. It should be same as mentioned in bacula-dir.conf file.
Step 8:Create the backup folders: 
I am configuring storage on the same machine which i used for bacula server.So, storage and bacula server is on same PC.
# mkdir /backup1
# mkdir /backup2
#chown -R bacula:bacula /backup1
#chown -R bacula:bacula /backup2
#chmod -R 700 /backup1
#chmod -R 700 /backup2
Step 9:Now,Open bacula-sd.conf file and edit storage Section:
# vim /etc/bacula/bacula-sd.conf
Name: This same name is also in the bacula-dir.conf Storage {…} section.
SDPort: The port on which this Storage daemon will listen (and therefore the port on which the Director must contact this Storage daemon).
SDAdress: mention IP of the storage server.
10
Now, Edit Director Section in bacula-sd.conf file:
Name: the name of the Director that can administer this Storage daemon.
Password: the password that the Director must use to administer this Storage daemon. This same password is also in the bacula-dir.conf Storage {…} section.
11
Now, Edit device Section in bacula-sd.conf file:
Name: this will specify a disk device to use for storage.
Archive Device: here you specify the mount point of the actual device (the actual hard drive I want to use is mounted as /bacula/backup1). You can also use just a folder to store your backup, it does not need to be a fresh disk.
12
13
Step 10:Edit message Section in bacula-sd.conf file:
Change to correct Director Name, in our case its kvit-dir. This section Send all messages to the Director, mount messages also are sent to the email address.
14
 Now, start Bacula and Mysql services:
# service bacula-dir start
# service bacula-sd start
# chkconfig bacula-dir on
# chkconfig bacula-sd on
# service mysqld start
# chkconfig mysqld on

Install and configure Linux File Daemon (bacula-fd) on bacula client machine(centos machine):

Use Putty on a Windows box to log onto the client linux machine and install:
#yum install bacula-client
#rpm –qa bacula-client bacula-common
DONE – bacula file daemon installed on backup target server.
Now, Edit bacula-fd.conf file on client machine and do the following changes as mentioned in red circles:
# vim /etc/bacula/bacula-fd.conf
15
16
17
Start bacula-fd service on baculaclient:
# service bacula-fd start
#chkconfig bacula-fd on

Install and Configure Windows File Daemon on the windows machine : (bacula client)

Log on to a windows server that you want to backup either locally or remote using eg. Remote Desktop.
From SourceForge.net download the bacula windows file daemon that match the version on your backup server (in my case it is 5.0.3).
On your windows server, double click the downloaded installation file to start the bacula file daemon installer.
18
192021
Write the name that you later will give to the Bacula Director (I choose kvit-dir). Press the “Install” button.
Navigate to C:\Program Files\Bacula, the Bacula main folder on the window (admin1) machine.
In C:\Program Files\Bacula folder notice  bacula-fd.conf file.Edit this file and change the followings:
2223
Now, Restart the file daemon service on admin1 :
write services.msc at run and press the “Ok” button to launch the Services Manager.
24
Now, Window machine is configured for backup by bacula.

Configure Webmin and testing connections on bacula and mysql:

Now use your web browser and enter the host IP address where you installed Bacula:
https://192.168.0.125:10000
This will take you to the Webmin. Login using user root. You will find the Bacula module on the left under System. It’s showing error. Click on module configuration and do the following changes which mentioned in red circle and save it. Now, you are able to access bacula through webmin console.
25
26
Now, we are going to check the connections on bacula server:
On bacula server type bconsole and press enter:
#bconsole
This starts the console program and confirms that you can connect to bacula Director.
*status storage                  (test if you can connect to storage resources)
27
*status client (prompt for a client to connect to – try selecting win-fd to see if you can connect to window pc)
28
*list clients           (you should be able to see the 2 clients win & client)
29
*quit
Check database on mysql server:
#mysql –u bacula –p
Enter password:
Mysql>show databases; (show what databases the bacula user have access to)
Mysql> use bacula; (set default database to bacula (bacula is the name of the Catalog database).
Mysql> show tables; (let’s see what tables are in the Catalog database)
Mysql>select * from Client; (you get exactly the same 2 clients we saw before using the bacula list clients command)
Mysql>quit

Create Jobs and Filesets under bacula-dir directory:

#vi /etc/bacula/bacula-dir.conf
#######create backup and restore job for client pc############
Job {
Name = RemoteBackup
JobDefs = DefaultJob
Client = client-fd
Pool = RemoteFile
Level = Full
FileSet = “Full Set”
Storage = File
}
Job {
Name = “RestoreRemote”
Type = Restore
Client=client-fd
FileSet=”Full Set”
Storage = File
Pool = Default
Messages = Standard
Where = /bacula/restore
}
#######create backup and restore job for windows pc############
Job {
Name = “RestorewinRemote”
Type = Restore
Client=win-fd
FileSet=”Full Set”
Storage = File
Pool = Default
Messages = Standard
Where = /bacula/restore
}
Job {
Name = “RemotewinBackup”
JobDefs = “DefaultJob”
Client = win-fd
Pool = RemoteFile
}
############### Create “Fileset” for window client #################
FileSet {
Name = win-backup
Include {
File = D:/folder1
Options {
}
}
}
################# Create “Fileset” for linux client #################
FileSet {
Name = “Full Set”
Include {
Options {
signature = MD5
}
}
}

Run backup and restore jobs for window client:

On bacula server type bconsole and press enter:
#bconsole
*run          (start the interactive prompt for running a job, you should see all jobs defined)
30
31
*status dir
32
33
As shown above in red circle job 39 completed.
Now, lets see how to Restore files:
On bacula server type bconsole and press enter:
#bconsole
34
Start the interactive restore process. The Catalog MyCatalog is automatically selected and you are presented with 12 different ways to select from which JobIds you want to restore.
35
Select method 5 “Select the most recent backup for a client” which will prompt you to select what client to restore.
Here I selected client win-fd
36
The latest full backup JobId (30) is selected.
we use dir to see what is in current folder, here we find a subfolder called D:/
cd D:/ : we use cd to change directory.
we use mark to mark files or folders we want to restore, here we mark “folder1″ folder. We mark folder1 to backup.
we use done to tell that we are finished selecting files.
37
38
39
40
41As above we can see that restore job is completed.

About Author

Advertisement

Post a Comment

 
Top