Zabbix3.0源码安装
环境:nginx1.6.3 php-5.6.22 mysql-5.5.49
请参考前面的博文自行搭建
安装依赖并创建用户
[root@test88 ~]# yum install -y libxml2-devel net-snmp-devel libcurl-devel [root@test88 ~]# useradd zabbix -s /sbin/nglogin -M
安装Zabbix
cd /server/tools/ wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz tar xf zabbix-3.0.3.tar.gz cd zabbix-3.0.3 ./configure --prefix=/application/zabbix-3.0.3 --sysconfdir=/application/zabbix-3.0.3/etc/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql --with-libxml2 make make install ln -s /application/zabbix-3.0.3/ /application/zabbix cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ sed -i "s@BASEDIR=/usr/local@BASEDIR=/application/zabbix@g" /etc/init.d/zabbix_server chmod +x /etc/init.d/zabbix_*
修改Zabbix配置文件
[root@test88 zabbix-3.0.3]# vim /application/zabbix/etc/zabbix_server.conf SourceIP=172.16.1.88 DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=123456 ListenIP=127.0.0.1,172.16.1.88
修改PHP配置文件
[root@test88 zabbix-3.0.3]# vim /application/php/lib/php.ini date.timezone = Asia/Shanghai post_max_size = 32M max_execution_time = 300 max_input_time = 300 always_populate_raw_post_data = -1
创建并初始化数据库
[root@test88 zabbix-3.0.3]# mysql -uroot -p -S /data/3306/mysql.sock Enter password: mysql> create database zabbix charset 'utf8'; Query OK, 1 row affected (0.19 sec) mysql> grant all on zabbix.* to zabbix@'127.0.0.1' identified by '123456'; Query OK, 0 rows affected (0.37 sec) mysql> flush privileges; Query OK, 0 rows affected (0.31 sec) [root@test88 zabbix-3.0.3]# mysql -uroot -p123456 -S /data/3306/mysql.sock zabbix < database/mysql/schema.sql [root@test88 zabbix-3.0.3]# mysql -uroot -p123456 -S /data/3306/mysql.sock zabbix < database/mysql/images.sql [root@test88 zabbix-3.0.3]# mysql -uroot -p123456 -S /data/3306/mysql.sock zabbix < database/mysql/data.sql
修改Nginx配置文件
[root@test88 zabbix-3.0.3]# egrep -v "^$|#" /application/nginx/conf/nginx.conf.default > /application/nginx/conf/nginx.conf [root@test88 zabbix-3.0.3]# vim /application/nginx/conf/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; root html; index index.php index.html index.htm; error_page 500 502 503 504 /50x.html; location / { } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } }
迁移ZabbixWeb程序
[root@test88 zabbix-3.0.3]# mkdir -p /application/nginx/html/zabbix [root@test88 zabbix-3.0.3]# cp -r frontends/php/* /application/nginx/html/zabbix/ [root@test88 zabbix-3.0.3]# chown -R nginx.nginx /application/nginx/html/zabbix/
启动服务
[root@test88 zabbix-3.0.3]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64 [root@test88 zabbix-3.0.3]# /application/nginx/sbin/nginx -t [root@test88 zabbix-3.0.3]# /application/nginx/sbin/nginx -s reload [root@test88 zabbix-3.0.3]# pkill php-fpm [root@test88 zabbix-3.0.3]# /application/php/sbin/php-fpm [root@test88 zabbix-3.0.3]# /data/3306/mysql restart [root@test88 zabbix-3.0.3]# /etc/init.d/zabbix_server start [root@test88 zabbix-3.0.3]# chkconfig zabbix_server on
登录Zabbix页面进行初始化
172.16.1.88/zabbix