1. 安装配置bacula-gui(管理页面)
Bacula-gui分为两个部分:
Baculum-api可通过OAuth2(开放认证模式)或HTTP认证(用户名和密码)认证提供统一接口服务;
Baculum-web通过baculum-api访问bacula,并可对bacula进行操作。
注:
建议使用二进制包安装(YUM)LAMP环境,如果使用源码包安装,在baculum-web上添加client时会有如下报错,导致client不能正常添加:
1.1. 安装bacula-gui依赖包
Bacula-gui对php要求如下:
PHP 5.3.4 or higher with following modules installed:
– cURL PHP module.
– MB String PHP module.
– JSON PHP module.
• PHP 5.3.4 or higher with following modules installed:
– PDO PHP support - depending on your catalog database: PDO PostgreSQL or PDO MySQL.
Note, in case using MySQL database there is required to use MySQL native driver. It is php-mysqlnd for PHP, not php-mysql.
– BCMath PHP module.
– JSON PHP module
通过额外YUM源进行安装,以Centos为例:
添加额外YUM源
# centos7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# centos6
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOS 5.x
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
安装php(可以选择以下任意一个版本)
# 安装php7.0
yum -y install httpd php70-php php70-php-gd php70-php-gettext php70-php-mysql php70-php-pdo php70-php-bcmath php70-php-mbstring php70-php-xml php70-php-common php70-php-cli php70-php-json php70-php-mysqlnd php70-runtime php70-php-process
# 安装php7.2
yum -y install httpd php72-php php72-php-gd php72-php-gettext php72-php-mysql php72-php-pdo php72-php-bcmath php72-php-mbstring php72-php-xml php72-php-common php72-php-cli php72-php-json php72-php-mysqlnd php72-runtime php72-php-process
# 安装php7.3
yum -y install httpd php73-php php73-php-gd php73-php-gettext php73-php-mysql php73-php-pdo php73-php-bcmath php73-php-mbstring php73-php-xml php73-php-common php73-php-cli php73-php-json php73-php-mysqlnd php73-runtime php73-php-process
# 验证php
vi /var/www/html/phpinfo.php
<?php
echo phpinfo();
?>
浏览器访问
http://serverip/phpinfo.php
1.2. 创建并修改配置文件
按照bacula官方文档安装:
https://blog.bacula.org/documentation/documentation/
tar zxf bacula-gui-9.2.2.tar.gz
cd bacula-gui-9.2.2/baculum
# build文件。 DESTDIR为build目标位置
make build DESTDIR=/usr/local/baculum/
# 拷贝baculum apache配置文件
cp /usr/local/baculum/etc/httpd/conf.d/baculum-web.conf /etc/httpd/conf.d/
cp /usr/local/baculum/etc/httpd/conf.d/baculum-api.conf /etc/httpd/conf.d/
# 源码包安装的LAMP
# cp /usr/local/baculum/etc/httpd/conf.d/baculum-web.conf /usr/local/apache/conf/extra/
# cp /usr/local/baculum/etc/httpd/conf.d/baculum-api.conf /usr/local/apache/conf/extra/
# 修改baculum apache配置文件
vi /etc/httpd/conf.d/baculum-web.conf
vi /etc/httpd/conf.d/baculum-api.conf
将“/usr/share/baculum/”
替换成“/usr/local/baculum/usr/share/baculum”
# 或使用sed命令替换
#sed -i 's#/usr/share/baculum#/usr/local/baculum/usr/share/baculum#g' /etc/httpd/conf.d/baculum-web.conf
#sed -i 's#/usr/share/baculum#/usr/local/baculum/usr/share/baculum#g' /etc/httpd/conf.d/baculum-api.conf
# 链接baculum language_file(针对bacula-gui-7.x,bacula-gui-9.x无需操作)
ln -s /usr/local/baculum/usr/share/locale/en/LC_MESSAGES/baculum.mo /usr/share/locale/en/LC_MESSAGES/baculum.mo
ln -s /usr/local/baculum/usr/share/locale/pl/LC_MESSAGES/baculum.mo /usr/share/locale/pl/LC_MESSAGES/baculum.mo
ln -s /usr/local/baculum/usr/share/locale/pt/LC_MESSAGES/baculum.mo /usr/share/locale/pt/LC_MESSAGES/baculum.mo
# 创建baculum认证文件并允许apache用户读写
chown -R apache:apache /usr/local/baculum/usr/share/baculum/htdocs/
# baculum-web和baculum-api指定的认证文件位于/usr/local/baculum/usr/,需要手动创建
#chown -R apache:apache /usr/local/baculum/etc/baculum/Config-api-apache/baculum.users
#chown -R apache:apache /usr/local/baculum/etc/baculum/Config-web-apache/baculum.users
cp /usr/local/baculum/etc/baculum/Config-api-apache/baculum.users /usr/local/baculum/usr/share/baculum/htdocs/protected/API/Config/baculum.users
cp /usr/local/baculum/etc/baculum/Config-web-apache/baculum.users /usr/local/baculum/usr/share/baculum/htdocs/protected/Web/Config/baculum.users
chown -R apache:apache /usr/local/baculum/usr/share/baculum/htdocs/protected/API/Config/baculum.users
chown -R apache:apache /usr/local/baculum/usr/share/baculum/htdocs/protected/Web/Config/baculum.users
# 修改bacula权限
chmod 755 /usr/local/bacula/etc/
chmod 755 /usr/local/bacula/etc/bconsole.conf
chown -R apache.apache /usr/local/baculum/
chown -R apache:apache /usr/local/bacula/bin/
chown -R apache:apache /usr/local/bacula/etc/
chown -R apache:apache /usr/local/bacula/working/
1.3. 修改bacula-gui登录用户和密码
# baculum-web和baculum-api默认用户名和密码是admin/admin,如需手动修改可参考如下操作
# 创建baculum-web用户(用于baculum-web初始化登录)
htpasswd -c /usr/local/baculum/usr/share/baculum/htdocs/protected/Web/Config/baculum.users admin
# 创建baculum-api用户(用于baculum-api初始化登录)
htpasswd -c /usr/local/baculum/usr/share/baculum/htdocs/protected/API/Config/baculum.users admin
#chown apache:apache /usr/local/baculum/usr/share/baculum/htdocs/protected/Web/Config/baculum.users
#chown apache:apache /usr/local/baculum/usr/share/baculum/htdocs/protected/API/Config/baculum.users
1.4. 访问并配置bacula-gui
Bacula-gui需要先配置api服务,再配置web服务
# apache2.4以下版本会存在以下错误:
configuration error: couldn't perform authentication. AuthType not set!: /index.php/api/page/
该错误是由于apache的版本为2.2,不支持Require all granted,注释该配置即可。
vi /etc/httpd/conf.d/baculum-api.conf
...
Require all granted
# it's only needed on Apache >=2.4
# 所以需要注释该段
...
# 启动apache并将apache加入开机自启
service httpd start
chkconfig httpd on
1.5. 配置baculum-api服务
# 访问baculum-api,默认端口为9096,配置api服务
用户名和密码为《创建bacula-gui登录用户》中定义的用户名密码。
1.5.1. Step 1:Language
选择默认:English
1.5.2. Step 2:Catalog API
根据环境配置填写,test通过才能进行下一步。
1.5.3. Step 3:Console API
根据环境配置填写,test通过才能进行下一步。
1.5.4. Step 4:Config API
根据环境配置填写,test通过才能进行下一步。
1.5.5. Step 5:Authonization
认证方式分为两种,OAuth2(开放认证模式)和HTTP认证(用户名和密码)
OAuth2介绍:
允许用户提供一个令牌,而不是用户名和密码来访问他们存放在特定服务提供者的数据。每一个令牌授权一个特定的网站(例如,视频编辑网站)在特定的时段(例如,接下来的2小时内)内访问特定的资源(例如仅仅是某一相册中的视频)。这样,OAuth允许用户授权第三方网站访问他们存储在另外的服务提供者上的信息,而不需要分享他们的访问许可或他们数据的所有内容。
1.5.5.1. HTTP Basic authentication
首次配置的时候需要输入新的用户名和密码信息。(此用户名密码既是api页面的登录账号,又是basic api的验证账号)
配置完成后,可在API default page下List HTTP Basic users界面管理api用户。
1.5.5.2. OAuth2 for authentication
选择OAuth2 authentication,需要修改apache配置支持
vi /etc/httpd/conf.d/bacullum-api.conf
...
# NOTE: When you use OAuth2 then change this location section
# From: <Location />
# To: <Location /api/page>
#
<Location /api/page>
AuthType Basic
AuthName "Baculum Auth"
AuthUserFile /usr/local/baculum/usr/share/baculum/htdocs/protected/API/Config/baculum.users
Require valid-user
</Location>
...
# 修改完成后重启apache服务。
API default page下List OAuth2 client界面用于管理client配置。
1.6. 配置baculum-web服务
# 访问baculum-web,默认端口为9095,配置baculum web服务
用户名和密码为《创建bacula-gui登录用户》中定义的用户名密码。
1.6.1. Step 1:Lanaguage
选择默认:English
1.6.2. Step 2:Add APIs
1.6.2.1. HTTP Basic authentication
可登录baculum_api -> List HTTP Basic user添加或查看用户。
1.6.2.2. OAuth2 for authentication
OAuth2 client parameters可从登录baculum_api -> List OAuth2 clients添加或查看。
1.6.3. Step 3:Authentication
这里的认证是设置baculum web的登录账号(可自定义账号密码)
1.6.4. Step 4:Finish
保存配置,完成配置。Dashboard显示如下: