1、创建zabbix运行的用户
[root@ ~]# groupadd zabbix
[root@ ~]# useradd -g zabbix -m zabbix
[root@ ~]# grep zabbix /etc/passwd
zabbix:x:1001:1001::/home/zabbix:/bin/bash
2、zabbix安装
2.1 安装阿里云yum配置文件
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
2.2 安装zabbix-server、zabbix-agent
yum install zabbix-server zabbix-get zabbix-agent zabbix-web zabbix-server-mysql zabbix-web-mysql -y
2.3 修改php时区
sed -i 's@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g' /etc/httpd/conf.d/zabbix.conf
2.4 创建zabbix数据库
启动mysql,并创建zabbix数据库。
mysql
> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
> grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
> exit;
cd /usr/share/doc/zabbix-server-mysql-3.2.6/
zcat create.sql.gz|mysql -uzabbix -pzabbix zabbix
2.5 修改zabbix配置
修改zabbix数据库密码
sed -i '116a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
1、编辑zabbix_server.conf
grep -n ^[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
81:DBHost=localhost
91:DBName=zabbix
107:DBUser=zabbix
115:DBPassword=zabbix
287:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
413:Timeout=4
455:AlertScriptsPath=/usr/lib/zabbix/alertscripts
465:ExternalScripts=/usr/lib/zabbix/externalscripts
501:LogSlowQueries=3000
2.6 启动zabbix和httpd
systemctl start zabbix-server
systemctl start zabbix-agent
systemctl start httpd
开机启动的话用enable
启动不了:
检查发现是否关闭SELinux:
[root@CentOS7x64 ~]# getenforce
Enforcing
按要求关闭SELinux后再尝试启动zabbix-server服务:
[root@CentOS7x64 ~]# getenforce
Disabled
3、web界面安装
浏览器中输入ip+/zabbix/setup.php,按照提示操作
登录,用户名密码为Admin/zabbix