1、首先安装MySQL
参考https://blog.csdn.net/ageeklet/article/details/81624057
2、安装php5.6和Apache服务
获取yun源
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
安装依赖包(这里需要java环境,由于我的机器之间就已经有java了,所以这里没有写)
yum -y install httpd php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
编辑配置/etc/php.ini文件
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
编辑配置 /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/zabbix"
<Directory "/var/www/html/zabbix">
DirectoryIndex index.html index.html.var index.php
设置web前端
mkdir /var/www/html/zabbix
cp -a zabbix-3.4.3/frontends/php/ /var/www/html/zabbix
设置Apache的执行和所有者
chown -R apache:apache /var/www/html/zabbix
3、创建zabbix用户和组
groupadd zabbix
useradd -g zabbix zabbix
4、编译并安装zabbix
安装依赖包
yum install gcc* mysql-devel libxml2-devel net-snmp* curl-devel -y
编译安装
cd zabbix-3.4.14
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix
出现报错信息(这里是我出现的错误,根据具体情况自行百度解决):
yum -y install libssh2-devel
yum install OpenIPMI -y
yum install ncurses-devel -y
pm -ivh OpenIPMI-devel-2.0.16-14.el6.x86_64.rpm (自行百度下载)
yum install libevent-devel -y
yum -y install pcre*
出现下面情况,说明可以执行make install
5、修改配置文件/usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
6、添加zabbix服务器和zabbix代理启动脚本
cp zabbix-3.4.14/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp zabbix-3.4.14/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
修改 /etc/init.d/zabbix_server /etc/init.d/zabbix_agentd的BASEDIR=/usr/local/为BASEDIR=/usr/local/zabbix
7、创建zabbix数据库并导入一些表
首先进入到MySQL数据库中执行
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
Use zabbix;
source zabbix-3.4.3/database/mysql/schema.sql;
source zabbix-3.4.3/database/mysql/images.sql;
source zabbix-3.4.3/database/mysql/data.sql;
8、启动服务
/etc/init.d/httpd start
启动zaabix的时候会报错
解决方案:
[root@db ~]# find / -name libmysqlclient.so.20
/usr/local/mysql/lib/libmysqlclient.so.20
[root@db ~]# cp /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/libmysqlclient.so.20
[root@db ~]# ldconfig
[root@db ~]# /etc/init.d/zabbix_server start
Starting zabbix_server: [ OK ]
[root@db ~]# /etc/init.d/zabbix_agentd start
Starting zabbix_agentd: [ OK ]
9、浏览器访问zabbix页面进行初始化
默认用户名和密码是:Admin zabbix
参考文章