bacula备份方案
一、系统准备
1、系统环境
[root@template tools]# cat /etc/redhat-release
Fedora release 25 (Twenty Five)
2、关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
3、关闭Centos7.1的防火墙
#停止firewall和禁止firewall开机启动
systemctl stop firewalld.service
systemctl disable firewalld.service
二、安装mariadb数据库
1、安装mysql
[root@template tools]# yum
install
mysql mysql-server mysql-devel -y
[root@template tools]# systemctl start mariadb
[root@template tools]# systemctl enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@template tools]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 853/sshd
tcp6 0 0 :::9090 :::* LISTEN 1/systemd
tcp6 0 0 :::3306 :::* LISTEN 6355/mysqld
tcp6 0 0 :::22 :::* LISTEN 853/sshd
[root@template tools]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.26-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
Bye
2、安装bacula软件
yum install bacula* -y
启动服务
[root@template bacula]# systemctl start bacula-dir
[root@template bacula]# systemctl start bacula-fd
[root@template bacula]# systemctl start bacula-sd
3、进入bacula数据库文件存放目录
[root@template bacula]# cd /usr/libexec/bacula/
[root@template bacula]# ll
total 216
-rwxr-xr-x. 1 root root 4750 Mar 16 2017 bacula_config
-rw-r--r--. 1 root root 1238 Mar 16 2017 btraceback.dbx
-rw-r--r--. 1 root root 367 Mar 16 2017 btraceback.gdb
-rw-r--r--. 1 root root 433 Mar 16 2017 btraceback.mdb
-rwxr-xr-x. 1 root root 948 Mar 16 2017 create_bacula_database
-rwxr-xr-x. 1 root root 379 Mar 16 2017 create_mysql_database
-rwxr-xr-x. 1 root root 1748 Mar 16 2017 create_postgresql_database
-rwxr-xr-x. 1 root root 277 Mar 16 2017 create_sqlite3_database
-rwxr-xr-x. 1 root root 598 Mar 16 2017 delete_catalog_backup
-rwxr-xr-x. 1 root root 10589 Mar 16 2017 disk-changer
-rwxr-xr-x. 1 root root 782 Mar 16 2017 drop_bacula_database
-rwxr-xr-x. 1 root root 951 Mar 16 2017 drop_bacula_tables
-rwxr-xr-x. 1 root root 383 Mar 16 2017 drop_mysql_database
-rwxr-xr-x. 1 root root 1297 Mar 16 2017 drop_mysql_tables
-rwxr-xr-x. 1 root root 321 Mar 16 2017 drop_postgresql_database
-rwxr-xr-x. 1 root root 969 Mar 16 2017 drop_postgresql_tables
-rwxr-xr-x. 1 root root 234 Mar 16 2017 drop_sqlite3_database
-rwxr-xr-x. 1 root root 242 Mar 16 2017 drop_sqlite3_tables
-rwxr-xr-x. 1 root root 17599 Mar 16 2017 dvd-handler
-rwxr-xr-x. 1 root root 989 Mar 16 2017 grant_bacula_privileges
-rwxr-xr-x. 1 root root 996 Mar 16 2017 grant_mysql_privileges
-rwxr-xr-x. 1 root root 2814 Mar 16 2017 grant_postgresql_privileges
-rwxr-xr-x. 1 root root 198 Mar 16 2017 grant_sqlite3_privileges
-rwxr-xr-x. 1 root root 959 Mar 16 2017 make_bacula_tables
-rwxr-xr-x. 1 root root 4162 Mar 16 2017 make_catalog_backup.pl
-rwxr-xr-x. 1 root root 14882 Mar 16 2017 make_mysql_tables
-rwxr-xr-x. 1 root root 15506 Mar 16 2017 make_postgresql_tables
-rwxr-xr-x. 1 root root 14550 Mar 16 2017 make_sqlite3_tables
-rwxr-xr-x. 1 root root 10479 Mar 16 2017 mtx-changer
-rwxr-xr-x. 1 root root 2323 Mar 16 2017 mtx-changer.conf
-rwxr-xr-x. 1 root root 964 Mar 16 2017 update_bacula_tables
-rwxr-xr-x. 1 root root 3948 Mar 16 2017 update_mysql_tables
-rwxr-xr-x. 1 root root 3970 Mar 16 2017 update_postgresql_tables
-rwxr-xr-x. 1 root root 5659 Mar 16 2017 update_sqlite3_tables
#导入数据库文件
./create_mysql_database
./grant_mysql_privileges
./make_mysql_tables
#检查数据库
[root@template ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.26-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| bacula |
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> use bacula
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [bacula]> show tables;
+------------------+
| Tables_in_bacula |
+------------------+
| BaseFiles |
| CDImages |
| Client |
| Counters |
| Device |
| File |
| FileSet |
| Filename |
| Job |
| JobHisto |
| JobMedia |
| Location |
| LocationLog |
| Log |
| Media |
| MediaType |
| Path |
| PathHierarchy |
| PathVisibility |
| Pool |
| RestoreObject |
| Snapshot |
| Status |
| Storage |
| UnsavedFiles |
| Version |
+------------------+
26 rows in set (0.00 sec)
#检查授权
MariaDB [bacula]> use mysql
MariaDB [mysql]> select user,host from mysql.user;
+--------+--------------+
| user | host |
+--------+--------------+
| bacula | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | template.com |
| root | template.com |
+--------+--------------+
7 rows in set (0.00 sec)
#重启服务
[root@template bacula]# systemctl restart bacula-dir
[root@template bacula]# systemctl restart bacula-fd
[root@template bacula]# systemctl restart bacula-sd
#检查
[root@template bacula]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9102 0.0.0.0:* LISTEN 8358/bacula-fd
tcp 0 0 0.0.0.0:9103 0.0.0.0:* LISTEN 8363/bacula-sd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 853/sshd
tcp6 0 0 :::9090 :::* LISTEN 1/systemd
tcp6 0 0 :::3306 :::* LISTEN 6355/mysqld
tcp6 0 0 :::22 :::* LISTEN 853/sshd
udp 0 0 0.0.0.0:31634 0.0.0.0:* 928/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 928/dhclient
udp 0 0 127.0.0.1:323 0.0.0.0:* 746/chronyd
udp6 0 0 :::30510 :::* 928/dhclient
udp6 0 0 ::1:323 :::* 746/chronyd
#配置文件存放目录
[root@comput4 ~]# cd /etc/bacula/
[root@comput4 bacula]# ll total 64 -rw-r-----. 1 root bacula 6190 Nov 24 14:11 bacula-dir.conf -rw-r-----. 1 root root 1020 Nov 24 10:37 bacula-fd.conf -rw-r-----. 1 root root 6779 Nov 24 14:17 bacula-sd.conf -rw-r-----. 1 root root 163 Mar 16 2017 bat.conf -rw-r-----. 1 root root 253 Nov 24 10:36 bconsole.conf -rw-r-----. 1 root bacula 312 Mar 16 2017 query.sql -rw-r-----. 1 root root 543 Mar 16 2017 tray-monitor.conf
#安装bacula-fd
apt install bacula-fd -y
systemctl start bacula-fd
systemctl enable bacula-fd
vi /etc/bacula/bacula-fd.conf
4、安装webmin管理bacula
#软件下载:http://www.webmin.com/download.html
[root@template tools]# ll
total 56456
-rw-r--r--. 1 root root 28843041 Nov 24 10:18 webmin-1.860-1.noarch.rpm
-rw-r--r--. 1 root root 28963356 Nov 24 10:19 webmin-1.860-1.src.rpm
#先安装依赖包
yum -y install perl perl-Net-SSLeay openssl perl-IO-Tty perl-Encode-Detect
#安装webmin
[root@template tools]# rpm -ivh webmin-1.860-1.src.rpm
warning: webmin-1.860-1.src.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Updating / installing...
1:webmin-1.860-1 ################################# [100%]
[root@template tools]# rpm -ivh webmin-1.860-1.noarch.rpm
warning: webmin-1.860-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Preparing... ################################# [100%]
Operating system is Fedora Linux
Updating / installing...
1:webmin-1.860-1 ################################# [100%]
Webmin install complete. You can now login to https://template.com:10000/
as root with your root password.
#打开IE浏览器,输入https://IP:10000 ,用户名为root,口令即是LINUX系统用户口令
#选择mysql
点保存。
6.安装Bacula-Web图形界面(php环境请自行安装)