2019年9月6日 星期五

CentOS7 安裝 Bacula 9.x

安裝 MariaDB 及編譯環境
yum install gcc gcc-c++ libacl-devel lzo-devel mt-st mtx openssl-devel readline-devel zlib-devel make -y
yum install wget mariadb-server mysql-devel -y

下載 Bacula 9.x
wget https://nchc.dl.sourceforge.net/project/bacula/bacula/9.4.4/bacula-9.4.4.tar.gz

設定編輯 Bacula 9.x 
tar zxvf  bacula-9.4.4.tar.gz

cd bacula-9.4.4
./configure --prefix=/opt/bacula --with-scriptdir=/opt/bacula/scripts --with-mysql
make;make install;make install-autostart

設定 Mariadb
systemctl enable mariadb
systemctl start mariadb
echo -e "\nn\n\n\n\n\n\n" | mysql_secure_installation
/opt/bacula/scripts/create_mysql_database
/opt/bacula/scripts/make_mysql_tables
/opt/bacula/scripts/grant_mysql_privileges

啟動 Bacula  測試
/opt/bacula/sbin/bacula start

使用 Systemd 服務
cat < /etc/systemd/system/bacula.service
[Unit]
Description=Bacula backup service
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/opt/bacula/sbin/bacula start
ExecReload=/opt/bacula/sbin/bacula reload
ExecStop=/opt/bacula/sbin/bacula stop

[Install]
WantedBy=multi-user.target
EOF

chmod a+x /etc/systemd/system/bacula.service
systemctl daemon-reload
systemctl start bacula.service 


安裝 baculum
rpm --import http://bacula.org/downloads/baculum/baculum.pub

echo "
[baculumrepo]
name=Baculum CentOS repository
baseurl=http://bacula.org/downloads/baculum/stable/centos
gpgcheck=1
enabled=1

[baculumrepo]
name=Baculum Fedora repository
baseurl=http://bacula.org/downloads/baculum/stable/fedora
gpgcheck=1
enabled=1" > /etc/yum.repos.d/baculum.repo

yum install -y baculum-common baculum-api baculum-api-httpd baculum-web baculum-web-httpd sudo

echo "Defaults:apache "'!'"requiretty
apache  ALL=NOPASSWD:  /usr/sbin/bconsole
apache  ALL=NOPASSWD:  /usr/sbin/bdirjson
apache  ALL=NOPASSWD:  /usr/sbin/bsdjson
apache  ALL=NOPASSWD:  /usr/sbin/bfdjson
apache  ALL=NOPASSWD:  /usr/sbin/bbconsjson" > /etc/sudoers.d/baculum

chown -R apache /opt/bacula/etc
systemctl enable httpd.service
systemctl restart httpd.service

連線測試  帳號 admin/admin
http://ip:9095
http://ip:9096

沒有留言: