CentOS7安装配置BareOS备份工具

本文详细介绍了如何在CentOS7上安装和配置BareOS备份工具,包括添加第三方yum源、配置防火墙、安装MySQL数据库、启动BareOS服务、配置BareOS WebUI、添加CentOS客户端以及Ubuntu客户端。同时,文章提供了详细的配置文件示例和故障排查步骤,旨在为中小微企业提供稳定可靠的备份/恢复系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

备份/恢复系统BAREOS的安装

BAREOS(来自于BAckup and REcovery Open Sourced的缩写)是源于Bacula系统的开源免费备份/恢复系统。Bareos在2010年从Bacula分支,在此以后一直由德国的bareos.com/bareos.org提供开发和服务。我们选用Bareos的主要原因是Bareos的Web界面支持完整的备份和恢复功能(不支持配置,配置仍需要通过CLI完成),另一个原因是Bareos的社区较为活跃。

Bareos是一个企业级的备份/恢复系统,是一个非常完整的系统。也因为它的完整性,对完整系统管理的要求很高,对中小微企业来说管理成本太高。本文介绍的是如何在默认安装的基础上,做少量的客户定制,为中小微企业提供一种稳定可靠的备份/恢复系统。

Bareos(http://www.bareos.org/)是Backup Archiving REcovery Open Sourced的缩写,它是跨平台的网络备份工具,是Bacula项目的一个衍生版本,它在其基础上增加很多新特性。
Bareos源代码托管在Github:

https://github.com/bareos/bareos

准备操作系统

	安装CentOS7

Bareos软件仓库的URL是:

http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo

安装BareOS

  • 添加第三方yum源

rm -rf /etc/yum.repos.d/* ##删掉原有的yum配置文件 wget -O
/etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.aliyun.com/repo/Centos-7.repo
#使用阿里的yum仓库是为了避免后续安装过程中出现缺少插件的情况。

yum update
yum list all

  • 配置防火墙策略(当然也可以关闭防火墙)

firewall-cmd --permanent --add-port 9101-9103/tcp
firewall-cmd --permanent --add-service http
firewall-cmd --reload
firewall-cmd --list-all

安装BareOS及插件

yum install -y bareos bareos-database-mysql
安装MySQL数据库(除了MySQL数据库外还可以使用PostgreSQL数据库,这里以MySQL试例)

配置MySQL源

vim /etc/yum.repos.d/mysql56-community.repo

输入如下内容:

[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.mysql.com/RPM-GPG-KEY-mysql

安装MySQL相关包

yum install -y mysql-community-server mysql-community-devel mysql-community-client

启动并配置服务自启

systemctl start mysqld
systemctl enable mysqld

初始化MySQL服务

mysql_secure_installation

向导如下:
注意:这一步可以不设置密码,如果设置密码之后需要些认证文件

[…]
Enter current password for root (enter for none):
[…]
Set root password? [Y/n] y
New password: eisoo.com
Re-enter new password: eisoo.com
[…]
Remove anonymous users? [Y/n] y
[…]
Disallow root login remotely? [Y/n] n
[…]
Remove test database and access to it? [Y/n] y
[…]
Reload privilege tables now? [Y/n] y
[…]

配置认证文件

vim ~/.my.cnf

输入如下内容:

[client]
host=localhost
user=root
password=‘eisoo.com’

注意:如果初始化MySQL的时候没有设置密码就要确保root用户可以不用密码 MySQL数据库;默认安装的MySQL数据库密码为空,所以可以直接访问,如下:
在这里插入图片描述

创建数据库:

sh /usr/lib/bareos/scripts/create_bareos_database

提示如下则成功:

Creating mysql database
Creating of bareos database succeeded.

创建数据库的表:

sh /usr/lib/bareos/scripts/make_bareos_tables

提示如下则成功:

Making mysql tables
Creation of Bareos MySQL tables succeeded.

sh /usr/lib/bareos/scripts/grant_bareos_privileges

提示如下则成功:

Granting mysql tables
Privileges for user bareos granted ON database bareos.

启动并配置BareOS服务自启:

systemctl start bareos-dir # Director进程,逻辑控制
systemctl start bareos-sd # Storage Daemon
systemctl start bareos-fd # File Daemon
systemctl enable bareos-dir
systemctl enable bareos-sd
systemctl enable bareos-fd

Bareos使用的端口 9101-9103。
使用如下命令访问Director:

bconsole

在这里插入图片描述
输入help命令查看帮助:
在这里插入图片描述
常用的命令有:

*show filesets
*status dir
*status client
*status storage
*run命令开始执行备份任务

安装Bareos Webui
Bareos-webui是Bareos的Web管理接口,比 bconsole 命令要简单直观。
Bareos-webui依赖Apache和PHP;安装Apache和PHP:

yum install -y bareos-webui

配置SELinux

setsebool -P httpd_can_network_connect on

启动服务并设自启动

systemctl start httpd
systemctl enable httpd

配置控制台密码

[root@localhost ~]#bconsole
*configure add console name=admin password=admin profile=webui-admin

如果提示为configure: is an invalid command.则命令无效
如果在控制台配置无效的话就手动配置

手动配置如下:

cp /etc/bareos/bareos-dir.d/console/admin.conf.example /etc/bareos/bareos-dir.d/console/admin.conf

注:请根据实际情况修改
手动配置需要重启服务使配置生效:

systemctl restart bareos-dir

这时候就可以访问web界面了

http://192.168.0.30/bareos-webui/
账号admin
密码admin
测试Bareos Webui
使用浏览器访问:http://192.168.0.30/bareos-webui/

在这里插入图片描述
完成安装:

在这里插入图片描述

添加CentOS客户端

客户端防火墙配置

firewall-cmd --permanent --add-port 9102/tcp
firewall-cmd --reload
firewall-cmd --list-all

安装客户端软件包

配置yum源

curl http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo > /etc/yum.repos.d/bareos.repo

安装相关包

yum install -y bareos-filedaemon

启动并配置自启服务

systemctl start bareos-fd
systemctl enable bareos-fd

服务端:

[root@localhost ~]#bconsole
Connecting to Director localhost:9101
1000 OK: bareos-dir Version: 16.2.4 (01 July 2016)
Enter a period to cancel a command.
*configure add client nam

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值