July 24, 2014

Installing Bacula on CentOS 6

Bacula BackupCentOS Logo Installing Bacula on CentOS 6 with Webmin interface quick start guide. The assumption for this CentOS 6 tutorial is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

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. Bacula is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. In technical terms, it is an Open Source, enterprise ready, network based backup program.

Bacula Website: http://www.bacula.org/en/

Install the EPEL x86_64 YUM Repository

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

Disable SELinux

This is disabled at your own risk! We dont recommend it but it makes the installtion easier.

# vi /etc/sysconfig/selinux

Change the following: SELINUX=enforcing to SELINUX=disabled

Install the Webmin YUM Repository

# 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

Add the GPG Key and Install Webmin

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

# yum install webmin

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-client 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 run the scripts

# /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

Edit the default config files

Change Director password, change address and password on Client, change Storage Address and Password, change Console password:

# vi /etc/bacula/bacula-dir.conf

Change bacula-fd password, change bacula-mon password:

# vi /etc/bacula/bacula-fd.conf

Change bacula-dir password, change bacula-mon password, change Device {Archive Device to /backup

# vi /etc/bacula/bacula-sd.conf

Change Address and Password:

# vi /etc/bacula/bconsole.conf

Change Address Password and additionally change Director name to localhost

# vi /etc/bacula/tray-monitor.conf

Create the backup folder

# mkdir /backup
# chown bacula /backup

Set the MySQL password for user bacula

# mysql -u root -p
Enter Password:

mysql> UPDATE mysql.user SET password=PASSWORD (‘somepassword’)
mysql> WHERE user=’bacula’;
mysql> UPDATE mysql.user SET password=PASSWORD (‘somepassword’) WHERE user=’bacula’;
mysql> FLUSH PRIVILEGES;
mysql> quit

Start the Bacula Services

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

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

Now use your web browser and go to the host IP address where you installed Bacula

http://10.0.0.20:10000

This will take you to the Webmin. Login using root and your password. You will find the Bacula module on the left under System

  • J-ivar
  • Phcorrigan

    I am getting errors running the install scripts on 64-bit Centos 6. When I run “/usr/libexec/bacula/grant_mysql_privileges -u root –p ‘password’ I get “Error creating privileges.”

    I assume the issue has to do with this line:

    if $bindir/mysql $* -u root -f <<END-OF-DATA

    I'm not an expert at Linux scriptiing, but there is a file "/usr/bin/mysql"

    What am I missing?

  • Anonymous

    You need to replace ‘password’ with whatever your root password for mysql is

  • Cocolocko

    Phcorrigan & How2CentOS: I had the same error message:  Error creating privileges
    The problem is, that when you copy -> /usr/libexec/bacula/grant_mysql_privileges -u root –p ‘password’  <–  the minus befor the little "p" is wrong !!!!!
    If you compare it with the minus before the little u, you see that it is diffrent!
    How2CentOS: change it in your documentation, please.
    Thank you for your very good work!
    Greetings

  • Anonymous

    Thank you! Documentation changed

  • Anonymous

    Followed this How2 and did not have any issues. All seems to have installed ok. Now it is time to test Bacula.

  • Zanderfain

    Great Doc! Thank you!

  • Vince

    Please help I keep getting the following error:

    # service bacula-dir status
    bacula-dir dead but subsys locked

  • http://lynuxstuff.com/ lynuxstuff

    Thanks for sharing

  • ubu_fan

    Oh Wow!!!
    Great Tutorial !!!!!!!!
    I got Bacula setup and running and i dont know Jack about about configuring it and stuff :) …lol!..  i guess the hard part is done, now its time to read documentation, tweak, fine tune and get familiar with bacula…
    I’ve always heard Bacula is a great Enterprise backup solution but just never got around to testing or seting it up…

    Thanks Much

  • ubu_fan

    I Thought i had Bacula running FULLY but the Bacula Director daemon kept showing DOWN in the Webmin panel and i couldn’t connect to it at the terminal with the “bconsole” command. I didn’t know what to do because i followed every step in ur tutorial.

    After fiddling around  the “/etc/bacula/bacula-dir.conf” file i realized a line was missing the MYSQL user password for Bacula. (dbname = “bacula”; dbuser = “bacula”; dbpassword = “” )

    I then inserted my Bacula User password

    # Uncomment the following line if you want the dbi driver
    # dbdriver = “dbi:sqlite3″; dbaddress = 127.0.0.1; dbport =
      dbname = “bacula”; dbuser = “bacula”; dbpassword = “password”

    And all was well again

    I’m just posting this for reference when i do a full setup in a productive environment.

    Webmin looks like this now
    Process statuses:

    Bacula Director daemon – Up
     | 
    Storage daemon – Up
     | 
    File daemon – Up

    Thanks Again :)

  • mmz

     Me too, the same problem

    service bacula-dir status
    bacula-dir dead but subsys locked

  • Railson

    It happened to me.
    The password for user bacula was wrong at the database.
    Did you run “FLUSH PRIVILEGES;” after changing the bacula user password at mysql ?

  • Yay!

     spot on!!   I also ran into this problem, but this fixed the problem :)  thx!

  • Aaa

    This worked for me too! :) Thanks.

  • http://www.facebook.com/DroBuddy Joseph Johnson

    Thank you very much. Followed your tutorial and I now (or, at least at first glance) seem to have a working Bacula install. Thanks again!

  • Suleman_bukhari

    i am facing below error while starting bacula director.

    Config error: Could not find config Resource “storage” referenced on line 33 :   Storage = File

    Can any one help.

    vi /etc/bacula/bacula-sd.conf

    Storage {                             # definition of myself
      Name = fw-dir
      SDPort = 9103                  # Director’s port
      WorkingDirectory = “/var/spool/bacula”
      Pid Directory = “/var/run”
      Maximum Concurrent Jobs = 20
    }

    vi /etc/bacula/bacula-dir.conf

    Director {                            # define myself
      Name = fw-dir
      DIRport = 9101                # where we listen for UA connections
      QueryFile = “/etc/bacula/query.sql”
      WorkingDirectory = “/var/spool/bacula”
      PidDirectory = “/var/run”
      Maximum Concurrent Jobs = 1
      Password = “bacula1″         # Console password
      Messages = Daemon
    }

    JobDefs {
      Name = “DefaultJob”
      Type = Backup
      Level = Incremental
      Client = fw-fd
      FileSet = “Full Set”
      Schedule = “WeeklyCycle”
      Storage = File
      Messages = Standard
      Pool = Default
      Priority = 10
    }
    .
    .
    .
    .
    .
    .
    .
     Storage {
      Name = fw-sd
    # Do not use “localhost” here
      Address = xsl-dbsvr                # N.B. Use a fully qualified name here
      SDPort = 9103
      Password = “bacula3″
      Device = FileStorage
      Media Type = File
    }

  • Suleman_bukhari

    i have installed all daemons on same machine.  storage and client is on same machine

  • centos_fan

    Not a great thing to set Root password for MySQL (mysqladmin -u root password ‘new-password’) you will find it in history. try mysql_secure_installation instead.

  • Velan

    Can I able to get backup from the LAN computers in my network using Ubuntu 11.10 Operating system.

  • NilByMouth

    The bacula database user password needs to be set in bacula-dir.conf

  • bnasun

    Thanks! this worked

  • khade

    [root@bacula log]# tail -f bacula.log
    15-Jul 17:52 bacula-dir JobId 0: Fatal error: Could not open Catalog “MyCatalog”, database “bacula”.
    15-Jul 17:52 bacula-dir JobId 0: Fatal error: mysql.c:196 Unable to connect to MySQL server.
    Database=bacula User=bacula
    MySQL connect failed either server not running or your authorization is incorrect.
    15-Jul 17:52 bacula-dir ERROR TERMINATION
    Please correct configuration file: /etc/bacula/bacula-dir.conf

    Hi, I am getting above error please help on this

  • GeorgeRushby

    Check to see if your MySQL database service is running?
    # service mysqld status
    Can you log into the database server using the credentials you supplied?
    # mysql -ubacula -p -hlocalhost