Установка Bacula 7.4.0 на CentOS 6.x


Actually information from slaanesh about Bacula repos


# install repo Bacula 7.4.0 for CentOS 6.x
wget https://copr.fedorainfracloud.org/coprs/slaanesh/Bacula/repo/epel-6/slaanesh-Bacula-epel-6.repo -P /etc/yum.repos.d/

yum -y install mysql-server
yum -y install bacula-director bacula-storage bacula-client bacula-console
# Bacula gui for desktop
yum -y install bacula-console-bat

alternatives --set libbaccats.so /usr/lib64/libbaccats-mysql.so

chkconfig mysqld on
service mysqld start


При выполнении команды:
$ ./make_bacula_tables mysql -p

Появляются ошибки вида:
===
Making mysql tables
Enter password:
ERROR 1067 (42000) at line 91: Invalid default value for 'CleaningDate'
ERROR 1067 (42000) at line 111: Invalid default value for 'SchedTime'
ERROR 1067 (42000) at line 145: Invalid default value for 'SchedTime'
ERROR 1067 (42000) at line 187: Invalid default value for 'Date'
ERROR 1067 (42000) at line 201: Invalid default value for 'CreateTime'
ERROR 1067 (42000) at line 225: Invalid default value for 'FirstWritten'
ERROR 1067 (42000) at line 321: Invalid default value for 'Time'
Creation of Bacula MySQL tables succeeded.
===

Фиксим:
дропаем базу bacula и выполняем:
$ sed -i 's/DATETIME DEFAULT 0/DATETIME/g' /usr/libexec/bacula/make_mysql_tables

При выполнении:
$ ./grant_bacula_privileges mysql -p

Появляются ошибки вида:
===
Granting mysql privileges
Enter password:
ERROR 1133 (42000) at line 2: Can't find any matching row in the user table
ERROR 1133 (42000) at line 3: Can't find any matching row in the user table
...
Privileges for user bacula granted on database bacula.
===

Фиксим в /usr/libexec/bacula/grant_mysql_privileges:
===
use mysql
CREATE USER ${db_user}@localhost IDENTIFIED BY "${pass}";
CREATE USER ${db_user}@"%" IDENTIFIED BY "${pass}";
grant all privileges on ${db_name}.* to ${db_user}@localhost ${ssl_options};
grant all privileges on ${db_name}.* to ${db_user}@"%" ${ssl_options};
select * from user;
===



# adding at the end "-p" parameter for MySQL ask password
cd /usr/libexec/bacula
./create_bacula_database mysql
./make_bacula_tables mysql
./grant_bacula_privileges mysql

# Change passwords in /etc/bacula/*.conf with something you like.
sed -i \
-e 's/@@DIR_PASSWORD@@/dir-password/g' \
-e 's/@@FD_PASSWORD@@/fd-password/g' \
-e 's/@@SD_PASSWORD@@/sd-password/g' \
-e 's/@@MON_DIR_PASSWORD@@/mon-dir-password/g' \
-e 's/@@MON_FD_PASSWORD@@/mon-fd-password/g' \
-e 's/@@MON_SD_PASSWORD@@/mon-sd-password/g' \
/etc/bacula/*.conf

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

service bacula-dir start
echo status dir=bacula-dir | bconsole

service bacula-sd start
echo status storage=bacula-sd | bconsole

service bacula-fd start
echo status client=bacula-fd | bconsole

#chmod +r /etc/bacula/bconsole.conf /etc/bacula/bat.conf

chown -R root:root /etc/bacula
chmod 755 /etc/bacula
chmod 640 /etc/bacula/*
chgrp bacula /etc/bacula/bacula-dir.conf /etc/bacula/query.sql




*** ЗАМЕЧАНИЯ

Если у вас версия MySQL 5.5 или выше вы можете столкнуться с ошибкой, фиксим так:
===
$ cat > /usr/libexec/bacula/make_mysql_tables.patch << EOF
--- make_mysql_tables.orig 2010-02-15 16:05:14.000000000 +0200
+++ make_mysql_tables 2010-02-15 16:09:50.000000000 +0200
@@ -322,12 +322,12 @@



-CREATE TABLE Counters (
- Counter TINYBLOB NOT NULL,
- MinValue INTEGER DEFAULT 0,
- MaxValue INTEGER DEFAULT 0,
- CurrentValue INTEGER DEFAULT 0,
- WrapCounter TINYBLOB NOT NULL,
+CREATE TABLE \`Counters\` (
+ \`Counter\` TINYBLOB NOT NULL,
+ \`MinValue\` INTEGER DEFAULT 0,
+ \`MaxValue\` INTEGER DEFAULT 0,
+ \`CurrentValue\` INTEGER DEFAULT 0,
+ \`WrapCounter\` TINYBLOB NOT NULL,
PRIMARY KEY (Counter(128))
);
EOF

$ patch < /usr/libexec/bacula/make_mysql_tables.patch
===


ПОЛЕЗНОСТИ

breport - The Bacula Reporter
baculum - administration interface (web)