快速安装zabbix

环境:CentOS 7.x

数据库mysql已事先安装

1、配置epel源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2、安装依赖
yum install OpenIPMI-devel libssh2-devel libssh2 fping libcurl-devel libxml2 libxml2-devel net-snmp* httpd-devel mysql-community-server php php-devel  -y

3、安装zabbix服务端及客户端

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-sender zabbix-java-gateway zabbix-get -y

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

mysql  -uroot  -p

登录数据库后执行如下操作:

create  database zabbix character set utf8 collate utf8_bin;
show  databases;
grant  all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
show grants for zabbix@localhost;
flush privileges;
quit;

ll /usr/share/doc/zabbix-server-mysql-3.4.14/create.sql.gz
zcat /usr/share/doc/zabbix-server-mysql-3.4.14/create.sql.gz | mysql -uzabbix -pzabbix zabbix

mkdir -p /var/lib/mysql
chown mysql:mysql -R /var/lib/mysql
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

更改配置文件/etc/httpd/conf.d/zabbix.conf 中php时区设置如下:
php_value date.timezone Asia/Shanghai

systemctl start httpd
systemctl enable httpd
systemctl status httpd

转到web界面设置(所有状态均ok),设置后的结果如下:

systemctl start zabbix-server
systemctl enable zabbix-server
systemctl status zabbix-server

systemctl start zabbix-agent
systemctl enable zabbix-agent
systemctl status zabbix-agent

登录
默认用户名:Admin
默认密码:zabbix

Agent安装
rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install OpenIPMI-devel libssh2-devel libssh2 fping libcurl-devel libxml2 libxml2-devel net-snmp* -y

yum install zabbix-agent zabbix-sender -y

sed -i 's#Server=127.0.0.1#Server=10.0.91.7#g' /etc/zabbix/zabbix_agentd.conf
sed -i 's#ServerActive=127.0.0.1#ServerActive=10.0.91.7#g' /etc/zabbix/zabbix_agentd.conf
sed -n "s#Hostname=Zabbix server#Hostname=node.`ifconfig|grep eth0 -A 1|grep -oP '(?<=inet )[d.]+'|awk -F. '{print $4}'`#p" /etc/zabbix/zabbix_agentd.conf #注意网卡名称

systemctl restart zabbix-agent
systemctl enable zabbix-agent
systemctl status zabbix-agent

netstat -tunlp|grep zabbix

原文地址:https://www.cnblogs.com/wyzhou/p/9830886.html