测试系统环境
[root@dylan ~]## uname -a
localhost 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@dylan ~]#cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
[root@dylan sbin]# systemctl stop firewalld.service #关闭防火墙
(1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
)
1、配置LAMP环境
2、下载 最新版Zabbix
[root@dylan ~]#wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.2/zabbix-2.4.2.tar.gz
解压缩
[root@dylan ~]# tar zxvf zabbix-2.4.2.tar.gz
3、安装所需的组件
#yum install -y curl curl-devel net-snmp snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath php-mbstring
4、创建Zabbix数据库及数据库用户
[root@dylan ~]# systemctl start mariadb.service
[root@dylan ~]# systemctl start httpd.service
[root@dylan ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.40-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> create database zabbix;
MariaDB [(none)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [zabbix]> grant all privileges on zabbix.* to zabbix@'%' identified by '12345';
MariaDB [zabbix]> flush privileges;
MariaDB [zabbix]> source /root/zabbix-2.4.2/database/mysql/schema.sql
MariaDB [zabbix]> source /root/zabbix-2.4.2/database/mysql/data.sql
MariaDB [zabbix]> source /root/zabbix-2.4.2/database/mysql/images.sql
5、编译安装
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql --enable-net-snmp --with-libcurl
#make && make install
6、.添加zabbix服务对应的端口(可以省略),一般系统中都已经存在了,若没有可以如下添加
#vim /etc/service
zabbix-agent 10050/tcp //客户端
zabbix-agent 10050/udp
zabbix-trapper 10051/tcp //服务端
zabbix-trapper 10051/udp
7、为zabbix提供启动脚本和配置文件
(1)测试zabbix服务启动
#/usr/local/zabbix/sbin/zabbix_agentd //客户端
#/usr/lcoal/zabbix/sbin/zabbix_server //服务端
查看端口:
#netstart -tnlp | grep zabbix
停止zabbix服务:
#pkill zabbix
(2)为zabbix提供开机启动脚本:
#mkdir -v /etc/zabbix
#cp /root/zabbix-2.2.2/misc/init.d/tru64/zabbix_agentd /etc/init.d/ //客户端
#cp /root/zabbix-2.2.2/misc/init.d/tru64/zabbix_server /etc/init.d/ //服务端
#chmod 777 /etc/init.d/zabbix*
(3)修改zabbix_agentd、zabbix_server程序目录的位置:
#vim /etc/init.d/zabbix_agentd
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
#vim /etc/init.d/zabbix_server
DAEMON=/usr/local/zabbix/sbin/zabbix_server
启动zabbix服务:
#service zabbix_agentd start
#service zabbix_server start
添加开启启动
#chkconfig --add zabbix_server
#chkconfig --add zabbix_agentd
修改php配置文件
[root@dylan ~]# vim /etc/php.ini 修改对应的项
[root@dylan ~]# egrep -v "#|^%" /etc/php.ini
重启Apache服务
[root@dylan ~]# systemctl restart httpd.service
创建 zabbix.conf.php文件
[root@dylan ~]# cd /var/www/html/zabbix/conf/
[root@dylan conf]# vim zabbix.conf.php
<?php
// Zabbix GUI configuration file
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'root';
$DB['PASSWORD'] = '12345';
// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
登录
默认用户名 admin 密码:zabbix
设置中文界面
修改胚子文件
[root@dylan include]# vim locales.inc.php
、