如何部署Bareos备份2-安装服务

Bareos

2. 服务端的安装

In Server

2.1 基本配置

2.1.1 配置主机名称

hostnamectl set-hostname bareos.cmdschool.org

2.1.2 配置时区和NTP服务

时区配置

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

安装ntp同步服务

yum install -y chrony

启动ntp服务

systemctl start chronyd
systemctl enable chronyd

同步时间

chronyc sources

2.1.3 防火墙配置

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

2.2 安装MySQL数据库

2.2.1 配置MySQL源

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

输入如下内容:

# Enable to use MySQL 5.6
[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

2.2.2 安装MySQL相关包

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

2.2.3 启动并配置服务自启动

systemctl start mysqld
systemctl enable mysqld

2.2.4 初始化MySQL服务

mysql_secure_installation

向导如下:

[…]
Enter current password for root (enter for none):
[…]
Set root password? [Y/n] y
New password: dbAdminPassword1
Re-enter new password: dbAdminPassword1
[…]
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
[…]

2.2.5 配置认证文件

vim ~/.my.cnf

输入如下内容:

[client]
host=localhost
user=root
password='abc123'

2.2.6 创建数据库

sh /usr/lib/bareos/scripts/create_bareos_database

提示如下则成功:

Creating mysql database
Creating of bareos database succeeded.

2.2.7 创建数据库的表

sh /usr/lib/bareos/scripts/make_bareos_tables

提示如下则成功:

Making mysql tables
Creation of Bareos MySQL tables succeeded.

2.2.8 创建数据库的表

sh /usr/lib/bareos/scripts/grant_bareos_privileges

提示如下则成功:

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

2.3 安装BareOS

2.3.1 配置安装源

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

2.3.2 安装相关包

yum install -y bareos bareos-database-mysql

2.3.3 启动和配置服务自启动

systemctl start bareos-dir
systemctl start bareos-sd
systemctl start bareos-fd
systemctl enable bareos-dir
systemctl enable bareos-sd
systemctl enable bareos-fd

2.4 配置Web的GUI

2.4.1 安装相关包

yum install -y bareos-webui

2.4.2 配置SELinux

setsebool -P httpd_can_network_connect on

2.4.3 启动服务并设自启动

systemctl start httpd
systemctl enable httpd

2.4.4 配置控制台密码

bconsole
*configure add console name=admin password=secret profile=webui-admin

手动配置如下:

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

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

systemctl restart bareos-dir

2.4.5 配置资源访问控制

cat /etc/bareos/bareos-dir.d/profile/webui-admin.conf

包含如下内容:

#
# bareos-webui webui-admin profile resource
#
Profile {
  Name = "webui-admin"
  CommandACL = !.bvfs_clear_cache, !.exit, !.sql, !configure, !create, !delete, !purge, !sqlquery, !umount, !unmount, *all*
  Job ACL = *all*
  Schedule ACL = *all*
  Catalog ACL = *all*
  Pool ACL = *all*
  Storage ACL = *all*
  Client ACL = *all*
  FileSet ACL = *all*
  Where ACL = *all*
}

2.4.6 http服务配置

cat /etc/httpd/conf.d/bareos-webui.conf

包含如下配置:

#
# Bareos WebUI Apache configuration file
#

# Environment Variable for Application Debugging
# Set to "development" to turn on debugging mode or
# "production" to turn off debugging mode.

        SetEnv "APPLICATION_ENV" "production"


Alias /bareos-webui  /usr/share/bareos-webui/public



        Options FollowSymLinks
        AllowOverride None

        # Following module checks are only done to support
        # Apache 2.2,
        # Apache 2.4 with mod_access_compat and
        # Apache 2.4 without mod_access_compat
        # in the same configuration file.
        # Feel free to adapt it to your needs.

        # Apache 2.2
        
                Order deny,allow
                Allow from all
        

        # Apache 2.4
        
                
                    Order deny,allow
                
                Require all granted
        

        
                RewriteEngine on
                RewriteBase /bareos-webui
                RewriteCond %{REQUEST_FILENAME} -s [OR]
                RewriteCond %{REQUEST_FILENAME} -l [OR]
                RewriteCond %{REQUEST_FILENAME} -d
                RewriteRule ^.*$ - [NC,L]
                RewriteRule ^.*$ index.php [NC,L]
        

        
                php_flag magic_quotes_gpc off
                php_flag register_globals off
        


2.4.7 配置管理的目录

egrep -v "^$|^;" /etc/bareos-webui/directors.ini

配置如下:

[localhost-dir]
enabled = "yes"
diraddress = "localhost"
dirport = 9101
[another-host-dir]
enabled = "no"
diraddress = ""
dirport = 9101

2.4.8 WEB GUI参数配置

cat /etc/bareos-webui/configuration.ini

详细如下:

[session]
# Default: 3600 seconds
timeout=3600

[tables]
# Possible values for pagination
# Default: 10,25,50,100
pagination_values=10,25,50,100

# Default number of rows per page
# for possible values see pagination_values
# Default: 25
pagination_default_value=25

# State saving - restore table state on page reload.
# Default: false
save_previous_state=false

[autochanger]
# Pooltype for label to use as filter.
# Default: none
labelpooltype=scratch

2.4.9 浏览器测试

http://10.168.0.22/bareos-webui/

===========================================================
官方文档
————-
https://github.com/bareos/bareos-docs
http://doc.bareos.org/master/html/bareos-manual-main-reference.html

官方源
————-
http://download.bareos.org/bareos/release/

没有评论

发表评论

Bareos
如何部署Bareos备份6-备份GlusterFS

6 备份GlusterFS的数据 6.1 基本配置 6.1.1 配置存储客户端名称 In Glust …

Bareos
如何部署Bareos备份5-备到GlusterFS

5 备份保存到GlusterFS 5.1 基本配置 5.1.1 配置名称解析 vim /etc/ho …

Bareos
如何部署Bareos备份4-添加客户端

4 添加备份客户端 4.1 基本配置 4.1.1 配置主机名称 In Clients hostnam …