LINUX下部署ZABBIX服务器的记录

系统环境:CENTOS7

ZABBIX:3.4

安装脚本:

[root@cons7s ~]# cat /shell/zabbix/1.sh 
#!/bin/bash
systemctl stop firewalld.service
setenforce 0
a=`rpm -aq httpd`
if
[ ! -n $a ]; then
yum install httpd -y
fi
systemctl start httpd
systemctl enable httpd
yum install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
if [ ! -e /usr/bin/expect ] 
 then  yum install expect -y 
fi

/usr/bin/expect <<-EOF
set time 30
spawn mysql_secure_installation
expect {
"enter for none" { send "zabbix\r"; exp_continue}
"Y/n" { send "Y\r" ; exp_continue}
"New password" { send "zabbix\r"; exp_continue}
"Re-enter new password" { send "zabbix\r"; exp_continue}
"Cleaning up" { send "\r"}
}
#interact
expect eof
EOF
yum install php php-mysql php-gd php-pear -y
systemctl restart httpd
yum install epel-release -y
rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
mysql -uroot -pzabbix -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -uroot -pzabbix -e "grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';"
mysql -uroot -pzabbix -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
mysql -uroot -pzabbix -e "grant all privileges on zabbix.* to [email protected] identified by 'zabbix';"
a=`ls /usr/share/doc/ | grep zabbix-server-mysql`
cd /usr/share/doc/$a
zcat create.sql.gz |mysql -uroot zabbix -pzabbix
cp -r /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bak
sed -i '/# DBHost=/a\DBHost=localhost' /etc/zabbix/zabbix_server.conf
sed -i '/# DBPassword=/a\DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
systemctl start zabbix-server
systemctl enable zabbix-server
cp -r /etc/httpd/conf.d/zabbix.conf /etc/httpd/conf.d/zabbix.conf.bak
sed -i '/# php_value date.timezone Europe\/Riga/a\php_value date.timezone Asia\/Shanghai' /etc/httpd/conf.d/zabbix.conf
systemctl restart httpd
systemctl start zabbix-agent
systemctl enable zabbix-agent

执行安装脚本 sh  /shell/zabbix/1.sh

继续Zabbix Web网页安装

按照安装向导一步一步完成,安装完成以后默认的用户名密码是Admin  zabbix

猜你喜欢

转载自blog.csdn.net/lsysafe/article/details/81454438
今日推荐