1.安装zabbix源、aliyun YUM源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2.#安装zabbix
yum install -y zabbix-server-mysql zabbix-web-mysql
3.#安装mysql
参考https://www.cnblogs.com/zhaoliag/p/10249020.html
4.#创建数据库
创建名为zabbix 的数据库
5.#导入表结构
将/usr/share/doc/zabbix-server-mysql-3.0.13/create.sql.gz导入zabbix库
或gunzip解压用Navicat导入
6.#配置zabbixserver连接mysql
vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.110.210 #数据库主机
DBName=zabbix #库名
DBUser=root #用户名
DBPassword=123456 #密码
7.#添加时区
sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
8.#解决中文乱码
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
9.#启动服务
systemctl start zabbix-server
systemctl start httpd
10.#写入开机自启动
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start mariadb.service
systemctl start httpd
systemctl start zabbix-server
EOF
11.##输出信息
echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"
12.#web界面操作
在检测信息时,可查看具体的报错信息进行不同的解决
选择mysql数据库,输入密码
host与port不需要修改,name自定义
确认信息,正确点击下一步
安装完成、点击finsh
进入登陆界面 账号Admin密码zabbix 注意A大写
13.#如果遇到Can't connect to MySQL server on 'XXX' (13)
[root@centos]#getsebool -a | grep httpd
发现 httpd_can_network_connect_db --> off
解决方案:
#/usr/sbin/setsebool -P httpd_can_network_connect_db on