一、卸载已安装的zabbix
rpm -e `rpm -qa |grep zabbix`
二、使用yum安装zabbix依赖包
yum install -y yum-utils java-headless dejavu-sans-fonts fping OpenIPMI-libs libevent net-snmp-libs unixODBC php-mysql
yum install -y ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/aevseev/CentOS7/x86_64/iksemel-1.4-20.122.el7.x86_64.rpm
三、安装zabbix源
rpm -Uvh https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum-config-manager --enable rhel-7-server-optional-rpms
四、使用清华源安装zabbix的rpm包(注意:需要按此顺序执行,解决依赖关系,不然报错)
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-server-mysql-3.4.15-1.el7.x86_64.rpm
yum install -y https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-web-3.4.15-1.el7.noarch.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-web-mysql-3.4.15-1.el7.noarch.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-web-mysql-3.4.15-1.el7.noarch.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-java-gateway-3.4.15-1.el7.x86_64.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-get-3.4.15-1.el7.x86_64.rpm
五、创建数据库
登录数据库:mysql -uzabbix -pzabbix
创建数据库:create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
查看数据库:show databases;
六、导入数据
zcat /usr/share/doc/zabbix-server-mysql-3.4.15/create.sql.gz | mysql -uzabbix -pzabbix zabbix
七、配置数据库用户及密码
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
82:SocketDir=/var/run/zabbix
101:DBName=zabbix
117:DBUser=root
330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
448:Timeout=4
490:AlertScriptsPath=/usr/lib/zabbix/alertscripts
500:ExternalScripts=/usr/lib/zabbix/externalscripts
536:LogSlowQueries=3000
八、启动zabbix server并设置开机启动
systemctl enable zabbix-server
systemctl start zabbix-server
九、编辑Zabbix前端PHP配置,更改时区
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
十、启动httpd并设置开机启动
systemctl start httpd
systemctl enable httpd
十一、安装Zabbix Web
浏览器访问,并进行安装 http://192.168.108.98/zabbix/ 按照提示安装web界面即可
默认用户名Admin
默认密码:zabbix
十二、安装zabbix客户端
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.1-1.el7.x86_64.rpm
十三、修改配置文件
vim /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1,192.168.108.98 #修改此处ip为zabbix服务端ip即可
十四、启动zabbix_agent并加入到开机自启动
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service