How to: Install Bacula on Centos6 (or Fedora16)

On June 21, 2012 by Courtney

How to: Install Bacula on Centos6 (or Fedora16)_Bacula

So, I went through a bit of hell trying to install Bacula & Amanda. There many how-to’s, but like most people… I like instructions that are easy to follow with examples and had trouble finding something like that. So, here’s my guide to installing Bacula (not Amanda, screw that noise).

Important Notes: You will be doing this all on your Bacula Director. This means the server you have designated to run the Bacula processes & backups. Clients only require the bacula-client. It is suggested that before you start, you make firewall changes so you don’t spend hours troubleshooting only to realize iptables wasn’t letting the port through. You will need ports 1901-1903 open. I will also be doing this entire install as root. Finally, I am using disks and not tapes.

 

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02 Step 1: Make sure you have the EPEL x86_64 Yum Repository

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

Note: This sometimes changes. If it does, be sure to get the most recent version by going to http://download.fedoraproject.org/pub/epel/6/x86_64 and looking for the proper epel-release.

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02 Step 2: Install MySQL & Bacula. Note: Bacula can use MySQL or PostgreSQL. I used MySQL, but just know either or can be used.

yum install mysql-devel mysql-server
yum install bacula-storage-mysql
yum install bacula-director-mysql bacula-console
yum install bacula-client

Note: Install this if you plan to be utilizing the GUI and want the monitor icon. Since I only use CLI, I will not be including this as part of the install.
yum install bacula-traymonitor

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02 Step 3: You will need to start your mysql services & create a password for your root user.

service mysqld start
chkconfig mysqld on

Now create your root password (unless you want to leave it blank, not advised)

mysqladmin -u root password NEWPASSWORD

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02Step 4: Now you need to run the scripts provided to you by Bacula that will create all your tables! (Pro-Tip: -u root -p means login with user root and prompt for password…)

/usr/libexec/bacula/grant_mysql_privileges -u root -p
/usr/libexec/bacula/create_mysql_database -u root -p
/usr/libexec/bacula/make_mysql_tables -u root -p
/usr/libexec/bacula/grant_bacula_privileges -u root -p

Also, change the bacula user password;

mysql -u root -p
mysql> UPDATE mysql.user SET password=PASSWORD (thisisthenewpassword) WHERE user=’bacula’;
mysql> FLUSH PRIVILEGES;
mysql> quit

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02Step 5: Here comes the super fun part! You’ll need to update all your config files with new passwords & addresses (bacula run otherwise, citing ‘default passwords’ being used). I’ll break down what you need to edit in each file;

The Director
vi /etc/bacula/bacula-dir.conf

Make changes to the director password, the client password & address, the storage password & address , the Catalog dbpassword, and the console password.

VI NOTE: If you don’t know how to use Vi, allow me to do a quick tutorial here. To insert text (aka change it) you’ll need to press i. This will open the file for editing mode.  Type what you need to. Also, utilizing /searchstring (ex /Director) will search through the file and pressing n while move through found entries.

Practical example: I press i and change the director password to test, then I press esc and do a /Client to find the client. I can press n until I find the correct Client entry I want to change. Then I press i again and change that password. Rinse & repeat until I’m finished editing the file. Then I type esc and :wq! (write & quit + override).

 

 

How to: Install Bacula on Centos6 (or Fedora16)_Centos_07

Figure 1

How to: Install Bacula on Centos6 (or Fedora16)_Centos_08

Figure 2

How to: Install Bacula on Centos6 (or Fedora16)_Centos_09

Figure 3

How to: Install Bacula on Centos6 (or Fedora16)_Centos_10

Figure 4

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_11

Figure 5

The Console

vi /etc/bacula/bconsole.conf

Make changes to the password & address.

How to: Install Bacula on Centos6 (or Fedora16)_Fedora1_12

Figure 6

The Storage Daemon

vi /etc/bacula/bacula-sd.conf

Make changes to the director (bacula-dir) password. The second one (bacula-mon) is for the tray monitor. I don’t use this, so I simply delete these lines from the config (aka, in VI, make sure you aren’t in insert mode and press dd to delete line by line). Finally, since I am using disks, I need to make changes to the Device; I will change Archive Device = /backup and make sure the Media Type = File.

How to: Install Bacula on Centos6 (or Fedora16)_Centos_13

Figure 7

How to: Install Bacula on Centos6 (or Fedora16)_Fedora1_14

Figure 8

How to: Install Bacula on Centos6 (or Fedora16)_Centos_15

Figure 9

 

The File Daemon

vi /etc/bacula/bacula-fd.conf

Make changes to the director (bacula-dir) password. The second one (bacula-mon) is for the tray monitor. I don’t use this, so I simply delete these lines from the config.

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_16

Figure 10

How to: Install Bacula on Centos6 (or Fedora16)_Fedora1_17

Figure 11

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02 Step 6Now, we’ve got all the passwords + addresses updated. Whew! Do a victory shake.

 

 

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02Step 7: You’ll noticed we told the storage daemon that the Archive Device was /backup. We now need to create /backup and change ownership to Bacula so that it can write there. That’s easy!

mkdir /backup
chown bacula /backup

How to: Install Bacula on Centos6 (or Fedora16)_Bacula_02Step 8: That’s it. You’ve installed bacula. Now it’s time to start the service and also make sure bacula services start up automatically on reboot (chkconfig)!

service bacula-dir start
service bacula-fd start
service bacula-sd start

chkconfig bacula-dir on
chkconfig bacula-fd on
chkconfig bacula-sd on

You’ve finished, Bacula is running. How do you maintain it? Well. There’s a few ways. You can update the config files to add clients, volumes, jobs, etc. This will just depend on how comfortable you are with editing configs. However, it can get annoying to edit configs … so there are a few alternatives such as puppet or webmin.

Here is the puppet module & install instructions: GitHub or Forge (PuppetLabs).

The install of Webmin is fairly straightforward (Webmin Source).

Step 1: Add the Webmin repo. You can do this with the following command;

cat > /etc/yum.repos.d/webmin.repo << EOF

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
EOF

 Step 2: Import the GPG key

wget http://www.webmin.com/jcameron-key.asc
rpm --import http://www.webmin.com/jcameron-key.asc

Step 3: Install webmin

yum install webmin

Step 4: Go to http://test.bzaeds.org:10000 (aka, your server).

Step 5: You’ll initially find the “Bacula Backup System” under Unused Modules. You’ll need to update it with the MySQL username + pass for bacula and specify what database you are using (Postgre, MySQL, etc). After you update this information, you’ll find “Bacula Backup System” under System > Bacula Backup System.

That’s all folks.

Related Articles: