Bareos(http://www.bareos.org/)是Backup Archiving REcovery Open Sourced的缩写,它是跨平台的网络备份工具,是Bacula项目的一个衍生版本,它在其基础上增加很多新特性。
Bareos源代码托管在Github:https://github.com/bareos/bareos
Bareos is a 100% open source fork of the backup project from bacula.org. The fork is in development since late 2010, it has a lot of new features.
安装Bareos
添加第三方源:
wget -O /etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo
安装bareos:
yum install bareos bareos-database-mysql
安装MariaDB数据库
除了MySQL外,你还可以使用PostgreSQL数据库。
yum install mariadb-server
启动MariaDB:
$ systemctl start mariadb
$ systemctl enable mariadb
确保root用户可以不用密码直接访问MariaDB数据库;默认安装的MariaDB root密码为空,所以可以直接访问,如下:

如果你设置了root密码,可在~/my.cnf文件中写入认证信息,如:
[client]
host=localhost
user=root
password=your_MySQL_root_password
最后,运行如下脚本,为Bareos创建数据库和表:
/usr/lib/bareos/scripts/create_bareos_database
/usr/lib/bareos/scripts/make_bareos_tables
/usr/lib/bareos/scripts/grant_bareos_privileges
启动Bareos服务
systemctl start bareos-dir # Director进程,逻辑控制
systemctl start bareos-sd # Storage Daemon
systemctl start bareos-fd # File Daemon
Bareos使用的端口 9101-9103。
使用如下命令访问Director:
bconsole

输入help命令查看帮助:

常用的命令有:
*show filesets
*status dir
*status client
*status storage
最后,运行run命令开始执行备份任务:
*run
安装Bareos Webui
Bareos-webui是Bareos的Web管理接口,比 bconsole 命令要简单直观。
Bareos-webui依赖Apache和PHP;安装Apache和PHP:
yum install httpd php php-cli php-common
安装 bareos-webui:
yum install epel-release
yum install bareos-webui
bareos-webui 默认的两个配置文件:
/etc/bareos/bareos-dir.d/webui-consoles.conf
/etc/bareos/bareos-dir.d/webui-profiles.conf
把上面的两个配置文件引入到 bareos-dir.conf 文件中:
echo "@/etc/bareos/bareos-dir.d/webui-consoles.conf" >> /etc/bareos/bareos-dir.conf
echo "@/etc/bareos/bareos-dir.d/webui-profiles.conf" >> /etc/bareos/bareos-dir.conf
配置Apache
Bareos-webui已经把默认的配置文件放到了/etc/httpd/conf.d中了。
编辑/etc/bareos-webui/directors.ini文件:
vim /etc/bareos-webui/directors.ini
; Section localhost-dir
;
[localhost-dir]
; Enable or disable section. Possible values are “yes” or “no”, the default is “yes”.
enabled = "yes"
; Fill in the IP-Address or FQDN of you director.
diraddress = "localhost"
; Default value is 9101
dirport = 9101
; Section another-host-dir
;
[another-host-dir]
enabled = "no"
diraddress = ""
dirport = 9101
注意替换上的域名/IP。
重启Apache和bareos-dir服务:
systemctl restart httpd
systemctl restart bareos-dir
如果你开启了SELinux,你可以选择关闭SELinux或允许HTTPD连接网络:
setsebool -P httpd_can_network_connect on
测试Bareos Webui
使用浏览器访问:http://your_domain_or_IP/bareos-webui/

使用用户名 user1 密码 CHANGEME 登录。登录认证信息保存在/etc/bareos/bareos-dir.d/webui-consoles.conf文件中:

完成安装:

Bareos官方文档:http://www.bareos.org/en/documentation.html