需求:zabbix2.2升级到3.0.4
备注:zabbix 2.5之后对php有严格要求,php版本必须大于php5.4
php升级可以覆盖安装,也可以多处安装再选择,此处选择后者。
安装php5.6.24
yum install -y libxml2 libxml2-devel \
openssl openssl-devel \
curl* libcurl* \
libvpx* libjpeg* \
libpng libpng-devel \
freetype* t1lib* \
zlib zlib-devel \
zip unzip gzip \
ncurses* pcre pcre-devel \
bzip2* gd gd-devel \
libevent libevent-devel \
libmcrypt-devel libmcrypt \
libxslt-devel net-snmp-devel hping2 php-bcmath
###下载php5.6.18
wget http://10.31.67.32:8099/Download/php/php-5.6.18.tar.gz
tar -zxf php-5.6.18.tar.gz
cd php-5.6.18
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-bz2 --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 --enable-gd-native-ttf --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 --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath --enable-xmlwriter --enable-xmlreade
make && make install
cp php.ini-production /usr/local/php5/etc/php.ini
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
vi /usr/local/php5/etc/php-fpm.conf
user = nginx
group = nginx
vi /usr/local/php5/etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = PRC
###nginx端配置上反代php
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;
}
/usr/local/php5/sbin/php-fpm
###安装zabbix3.0.4server端
tar -zxf zabbix-3.0.4.tar.gz
cd zabbix-3.0.4
./configure --prefix=/usr/local/zabbix3.0.4 --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make && make install
##报错configure: error: MySQL library not found
#yum install mysql-devel
###安装zabbix3.0.4agentd端
tar -zxf zabbix-3.0.4.tar.gz
./configure --prefix=/usr/local/zabbix3.0.4/ --enable-agent
make && make install
##copy旧版本的配置文件
cp /etc/zabbix/zabbix_agentd.conf /usr/local/zabbix3.0.4/etc/
cp /etc/zabbix/zabbix_server.conf /usr/local/zabbix3.0.4/etc/
《《《《《修改日志部分,便于查询问题》》》》》》
vi /usr/local/php5/etc/php.ini
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai
###copy新的zabbix前端目录
cp -a /home/software/zabbix-2.2.10rc1/frontends/php/* /usr/local/nginx/html/zabbixdx/
###编辑zabbix.conf.php
cp -a /usr/local/nginx/html/zabbix/conf/zabbix.conf.php /usr/local/nginx/html/zabbixdx/conf/
vi zabbix.conf.php
###修改字体
mv /home/server/DejaVuSans.ttf /usr/local/nginx/html/zabbixdx/fonts/
###把新的zabbix3.0.4启动
/usr/local/zabbix3.0.4/sbin/zabbix_server -c /usr/local/zabbix3.0.4/etc/zabbix_server.conf
/usr/local/zabbix3.0.4/sbin/zabbix_agentd -c /usr/local/zabbix3.0.4/etc/zabbix_agentd.conf
###修改字体
###回滚旧版本zabbix2.2
/etc/init.d/zabbix_server -c /etc/zabbix/zabbix_server.conf
/etc/init.d/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
###兆维zabbix mysql重启命令
service mysqld restart
###修改web页面显示多少条告警
vi defines.inc.php
define('DEFAULT_LATEST_ISSUES_CNT', 500)