Sunday, 24 March 2013

Installing Bacula on CENTOS5

Installing Bacula on CENTOS5 using YUM package-management utility. You have to have root access to install and run Bacula properly. A database server (eg MySQL) is needed to manage backup details. In this case, you will need mysql root access (ie MySQL root password). In this guide, it is assumed that the Bacula Director,File daemon,Storage daemon are installed in the same computer/server. When you want to backup across more computers/servers, just need to declare more clients and update the addresses.

Bacula is an Open Source Network Backup program that allows system admin to backup, recover data from servers and computer. More details can be obtained from its official website. (http://www.bacula.org/en)

Lets start with the yum install:

yum install bacula-client bacula-director-mysql bacula-storage-mysql bacula-traymonitor bacula-common bacula-director-common bacula-storage-common bacula-console


YUM will then go thru the dependency and add additional packages to install. Enter 'y' to proceed to install all required packages.

Is this ok [y/N]: y


Run below scripts to create and link mysql tables to Bacula:

/usr/libexec/bacula/grant_mysql_privileges -uroot -p
/usr/libexec/bacula/create_mysql_database -uroot -p
/usr/libexec/bacula/make_mysql_tables -uroot -p
/usr/libexec/bacula/grant_bacula_privileges -uroot -p
The Bacula is made up of 4 basic components: Director, File daemon(FD), Storage daemon(SD),Console programs. For security, lets change their default password. To generate a password hash:

[root@example ~]# echo "mypassword" |md5sum
d84c7934a7a786d26da3d34d5f7c6c86  -

For simplicity, I am using the above password hash to all password fields in below config files:

vi /etc/bacula/bacula-dir.conf
vi /etc/bacula/bacula-fd.conf
vi /etc/bacula/bacula-sd.conf
vi /etc/bacula/bconsole.conf
vi /etc/bacula/tray-monitor.conf

The default storage location is in /tmp. To change to another directory:

mkdir /bacula-backup


vi /etc/bacula/bacula-sd.conf

change

Archive Device = /tmp


to

Archive Device = /bacula-backup

To update the address of the file daemon:
vi /etc/bacula/bacula-dir.conf

Client {
  Name = bacula-fd
  Address = client.example.com
  FDPort = 9102
  Catalog = MyCatalog

To

Client {
  Name = bacula-fd
  Address = localhost
  FDPort = 9102
  Catalog = MyCatalog


and


Storage {

  Name = File

# Do not use "localhost" here

  Address = XXXXXXXXXX                # N.B. Use a fully qualified name here

  SDPort = 9103


To
Storage {

  Name = File

# Do not use "localhost" here

  Address = localhost                # N.B. Use a fully qualified name here

  SDPort = 9103

(Yes, the comments says do not use "localhost" and I used it. You can replace the address with a FQDN that is used as Bacula backup server.)

To enable the services:
chkconfig bacula-sd on

chkconfig bacula-fd on

chkconfig bacula-dir on


To turn on the services:
service bacula-fd start

service bacula-sd start

service bacula-dir start


To create volumes, run:
[root@example ~]# bconsole
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 2.4.4 (28 December 2008)
Enter a period to cancel a command.
*label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: File
Enter new Volume name: vol
Defined Pools:
     1: Default
     2: Scratch
Select the Pool (1-2): 1
Connecting to Storage daemon File at localhost:9103 ...
Sending label command for Volume "vol" Slot 0 ...
3000 OK label. VolBytes=195 DVD=0 Volume="vol" Device="FileStorage" (/bacula-backup)
Catalog record for Volume "vol", Slot 0  successfully created.
Requesting to mount FileStorage ...
3906 File device "FileStorage" (/bacula-backup) is always mounted.

No comments :

Post a Comment

search iomeweekly