zabbix服务端安装:
wget https://cdn.zabbix.com/zabbix/sources/stable/4.0/zabbix-4.0.24.tar.gz
yum -y install gcc gcc-c++ cmake make mysql-devel libxml2 libxml2-devel net-snmp-devel libevent-devel curl-devel
./configure --prefix=/data/software/zabbix --enable-server --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
make && make install
echo "export PATH=$PATH:/data/software/zabbix/sbin/:/data/software/zabbix/bin/" >> /etc/profile
zabbix_server --version
mysql(另外一台机器)
#创建用户
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to ’zabbix‘@‘%’ identified by '*****';
##引入zabbix包中的mysql数据库文件
mysql -uzabbix -p***** zabbix < schema.sql
mysql -uzabbix -p**** zabbix < images.sql
mysql -uzabbix -p**** zabbix < data.sql
php安装:(7版本有很大变化,可以通过官方文档查看change log)
yum ‐y install epel‐release libxml2 libxml2‐devel libcurl libcurl‐devel libjpeg libjpeg‐devel libpng libpng‐devel freetype freetype‐devel openldap openldap‐devel libmcrypt libmcrypt‐devel sqlite-devel m4 autoconf
wget https://www.php.net/distributions/php-7.4.10.tar.gz
yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-6.9.5+rev1-2.el7.remi.x86_64.rpm
yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-devel-6.9.5+rev1-2.el7.remi.x86_64.rpm
./configure \
--prefix=/data/software/php \
--with-config-file-path=/etc \
--enable-fpm \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--enable-gd \
--with-openssl-dir \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--with-ldap-sasl \
--enable-opcache=no
make && make install
[root@opennebula php-7.4.10]# cp php.ini-development /data/software/php/etc/php.ini
[root@opennebula php-7.4.10]# pwd
/data/install/php-7.4.10
cp php-fpm.conf.default php-fpm.conf
[root@opennebula etc]# pwd
/data/software/php/etc
[root@opennebula php-fpm.d]# cp www.conf.default www.conf
[root@opennebula php-fpm.d]# pwd
/data/software/php/etc/php-fpm.d
nginx集成php
location / {
root html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
zabbix配置:
vim /data/software/zabbix/etc/zabbix_server.conf
LogFile=/data/logs/zabbix/zabbix_server.log
DBHost=192.168.1.*
DBName=zabbix
DBUser=zabbix
DBPassword=*****
DBPort=3306
Timeout=30
AlertScriptsPath=/data/software/zabbix/alertscripts
ExternalScripts=/data/software/zabbix/externalscripts
LogSlowQueries=3000
php优化:(保证zabbix-web 第2步不出现红色报错)
vim /data/software/php/etc/php.ini
post_max_size=32M
max_execution_time=350
max_input_time=350
date.timezone=Asia/Shanghai
always_populate_raw_post_data=‐1
systemctlrestartphp‐fpm