MySQL安装配置
 略。请参考MySQL相关文章
创建zabbix数据库
 
1
 2
 3
 4
 5
 6
 7
  
sql> create database zabbix character set utf8 collate utf8_bin;
 sql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
 sql> flush privileges;
 sql> use zabbix
 sql> source /soft/zabbix-3.4.9/database/mysql/schema.sql
 sql> source /soft/zabbix-3.4.9/database/mysql/images.sql
 sql> source /soft/zabbix-3.4.9/database/mysql/data.sql
  
 
PHP安装
 安装依赖包
 
1
  
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre-devel  libxslt-devel curl-devel
  
 
编译安装PHP
 
 1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
  
# tar -xvf php-7.2.0.tar.gz
 # cd php-7.2.0
 # ./configure --prefix=/usr/local/php7 \
 --enable-zip \
 --with-curl \
 --enable-ftp \
 --enable-sockets \
 --disable-ipv6 \
 --with-gd \
 --with-jpeg-dir=/usr/local \
 --with-png-dir=/usr/local \
 --with-freetype-dir=/usr/local \
 --with-iconv-dir=/usr/local \
 --enable-mbstring \
 --enable-calendar \
 --with-gettext \
 --with-libxml-dir=/usr/local \
 --with-zlib \
 --with-pdo-mysql=mysqlnd \
 --with-mysqli=mysqlnd \
 --enable-dom \
 --enable-xml \
 --enable-fpm \
 --with-libdir=lib64 \
 --enable-bcmath
 
 # make && make install -j 4
  
 
配置PHP
 
1
 2
 3
 4
 5
 6
 7
 8
 9
  
# cp /soft/php-7.2.0/php.ini-development /usr/local/php7/bin/php.ini
 # cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
 # cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
 # cp -R /usr/local/php7/sbin/php-fpm /etc/init.d/php-fpm
 # vi /usr/local/php7/bin/php.ini
 post_max_size =16M
 max_execution_time =300
 max_input_time =300
 date.timezone=PRC
  
 
启动PHP
 
1
  
# /etc/init.d/php-fpm -y /usr/local/php7/etc/php-fpm.conf -c /usr/local/php7/bin/php.ini
  
 
安装配置Nginx
 安装依赖包
 
1
  
# yum install pcre zlib
  
 
编译安装nginx
 
1
 2
 3
 4
 5
 6
 7
  
# tar -xvf nginx-1.12.2.tar.gz
 # cd nginx-1.12.2/
 # ./configure --prefix=/usr/local/nginx \
 --with-http_ssl_module \
 --with-http_stub_status_module \
 --with-pcre
 # make && make install -j 4
  
 
配置nginx
 
 1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
  
server {
 	listen 80;
 	server_name 182.168.8.100;
 	access_log /zabbix/log/zabbix.log;
  
 	index index.php index.html index.html;
 	root /zabbix/html;
  
 	location /
 	{
 		try_files $uri $uri/ /index.php?$args;
 	}
  
 	location ~ .*\.(php)?$
 	{
 		expires -1s;
 		try_files $uri =404;
 		fastcgi_split_path_info ^(.+\.php)(/.+)$;
 		include fastcgi_params;
 		fastcgi_param PATH_INFO $fastcgi_path_info;
 		fastcgi_index index.php;
 		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 		fastcgi_pass 127.0.0.1:9000;
 	}
 }
  
 
启动nginx
 
1
  
# /usr/local/nginx/sbin/nginx
  
 
安装zabbix
 安装依赖包
 
1
  
# yum install unixODBC-devel net-snmp-devel libxml2-devel libcurl-devel libevent-devel pcre
  
 
下载介质
 DownLoad Source Package 
创建用户和组
 
1
 2
  
# groupadd zabbix 
 # useradd -g zabbix zabbix
  
 
编译安装zabbix
 
1
  
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql=/usr/local/mysql/bin/mysql_config --with-libxml2
  
 
Tips: 过程中可能会遇见错误“error: Unable to use libevent (libevent check failed)”,需要安装libevent 
编辑参数文件
 
 1
  2
  3
  4
  5
  6
  7
  8
  9
 10
  
# cat /usr/local/zabbix/etc/zabbix_sever.conf
 DBName=zabbix
 DBUser=zabbix
 DBPassword=zabbix
 ListenIP=127.0.0.1
 AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
 
 # cat /usr/local/zabbix/etc/zabbix_agentd.conf
 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
 UnsafeUserParameters=1
  
 
加入系统服务
 
 1
  2
  3
  4
  5
  6
  7
  8
  9
 10
  
# cp ./zabbix-3.4.9/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server
 # cp ./zabbix-3.4.9/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
 # chmod +x /etc/rc.d/init.d/zabbix_server
 # chmod +x /etc/rc.d/init.d/zabbix_agentd
 # chkconfig zabbix_server on
 # chkconfig zabbix_agentd on
 # vi /etc/rc.d/init.d/zabbix_server
    BASEDIR=/usr/local/zabbix
 # vi /etc/rc.d/init.d/zabbix_agentd 
    BASEDIR=/usr/local/zabbix
  
 
配置web服务
 
1
  
# cp /soft/zabbix-3.4.9/frontends/php /zabbix/my.zabbix.com/ -r
  
 
启动zabbix
 
1
 2
  
# service zabbix_server start
 # service zabbix_agent start
  
 
Tips: 如果遇见错误”error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory“,执行echo “/usr/local/mysql/lib” »/etc/ld.so.conf 
访问zabbix
 [setup.php]http://182.168.8.100/setup.php
[index.php]http://182.168.8.100/index.php
默认的用户名密码为admin/zabbix 
 
    
    
    
    
    
        
   
   
   
 
        Licensed under CC BY-NC-SA 4.0