Bacula 5.2.13 and PostgreSQL 9.3

From DFWLPiki
Jump to: navigation, search


EDIT: Updated to reflect usage of PostgreSQL 9.3

This articles covers doing a new installation of bacula 5.2.13 with PostgreSQL 9.3, on CentOS 6.x (i was actually using 6.3 for this writing).

First, we need 2 repos not included with CentOS Postgres93, and EPEL's Bacula repo.

yum install -y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm

And now add this repo file for current bacula from epel:

[root@d0lphb040 ~]# cat /etc/yum.repos.d/epel-bacula.repo 
# Place this file in your /etc/yum.repos.d/ directory

[epel-bacula]
name=Bacula backports from rawhide
baseurl=http://repos.fedorapeople.org/repos/slaanesh/bacula/epel-$releasever/$basearch/
enabled=1
skip_if_unavailable=1
gpgkey=http://repos.fedorapeople.org/repos/slaanesh/bacula/RPM-GPG-KEY-slaanesh
gpgcheck=1

[epel-bacula-source]
name=Bacula backports from rawhide - Source
baseurl=http://repos.fedorapeople.org/repos/slaanesh/bacula/epel-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgkey=http://repos.fedorapeople.org/repos/slaanesh/bacula/RPM-GPG-KEY-slaanesh
gpgcheck=1

Start with installing PostgreSQL93

yum install -y postgresql93-{contrib,devel,libs,server}

I keep my pgsql folder on a different partition from default, i use /opt/postgres (i dont want it contending for space on my /var paritition)

mv /var/lib/pgsql /opt/postgres/
ln -s /opt/postgres/pgsql /var/lib/

Now lets pull in our bacula packages that we need.

yum install -y bacula-{client,common,console,director,libs,libs-sql,storage}

Intialize the postgresql database for the first time.

/etc/init.d/postgresql-9.3 initdb
/etc/init.d/postgresql-9.3 start

Add md5 password hash to file /var/lib/pgsql/data/pg_hba.conf. Add it directly under #TYPE DATABASE...

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local bacula bacula md5

Change to postgres user, and create bacula database.

su - postgres
cd /usr/libexec/bacula/
createuser bacula (answer with superuser no, create db yes, create roles no)
./create_bacula_database
./make_bacula_tables
./grant_bacula_privileges

While still user postgres, add password to the bacula user in postgresql, and then log out of user postgres:

psql bacula
alter user bacula with password 'password';
\q
logout

Set the deamons to start automatically:

chkconfig postgresql-9.3 on
chkconfig bacula-dir on
chkconfig bacula-fd on
chkconfig bacula-sd on

Restart Postgres:

/etc/init.d/postgresql-9.3 restart

At this point, we need to edit the config files located in /etc/bacula/. All the default passwords should be changed to something appropriate.

Start all Bacula daemons:

/etc/init.d/bacula-fd start
/etc/init.d/bacula-sd start
/etc/init.d/bacula-dir start

For tape drive usage/troubleshooting, check:

   /var/log/bacula for read:write permission for bacula user
   /var/spool/bacula for read:write permissions on mtx.log
   add bacula user to tape and disk in/etc/group