源码安装zabbix3.0


PHP配置编译选项

./configure \
--prefix=/application/php-5.5.38 \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--with-gettext \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-ldap \
--with-xsl \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-opcache=no \
--enable-ftp

./configure \
--prefix=/application/php-5.6.34 \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--with-gettext \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-opcache=no \
--enable-ftp

./configure \
--prefix=/application/php-7.2.4 \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--with-gettext \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-opcache=no \
--enable-ftp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

nginx配置
/application/nginx/conf/extra/zabbix.conf
server {
listen 80;
server_name localhost;
root /app/html;
index index.php index.html index.htm;
access_log /app/logs/zabbix/zabbix_access.log main;
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}

}


源码安装zabbix3.0

依赖包
yum install -y net-snmp net-snmp-devel fping unixODBC-devel openssl-devel OpenIPMI-devel java-devel mysql mysql-devel

创建zabbix用户
useradd zabbix -s /sbin/nologin -M

配置
./configure \
--prefix=/application/zabbix-3.0.17 \
--enable-server \
--enable-agent \
--enable-java \
--with-mysql \
--enable-ipv6 \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--with-openipmi \
--with-unixodbc \
--with-openssl


手动指定
--with-mysql=/application/mysql-5.6.40/bin/mysql_config


编译安装
make install


ln -s /application/zabbix-3.0.17/ /application/zabbix

创建zabbix库及zabbix用户并授权
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@'172.16.1.%' identified by 'zabbix';


mysql -h 172.16.1.51 -uzabbix -pzabbix


导入数据库
cd /server/tools/zabbix-3.0.17/database/mysql/
mysql -h 172.16.1.51 -uzabbix -pzabbix zabbix < schema.sql
mysql -h 172.16.1.51 -uzabbix -pzabbix zabbix < images.sql
mysql -h 172.16.1.51 -uzabbix -pzabbix zabbix < data.sql

ln -s /application/zabbix/etc/ /etc/zabbix
ln -s /application/zabbix/bin/* /usr/bin/
ln -s /application/zabbix/sbin/* /usr/sbin/

拷贝启动脚本
cd /server/tools/zabbix-3.0.17/misc/init.d/fedora/core
cp zabbix_* /etc/init.d/


修改启动文件
sed "s@BASEDIR=/usr/local@BASEDIR=/application/zabbix@g" /etc/init.d/zabbix_server -i
sed "s@BASEDIR=/usr/local@BASEDIR=/application/zabbix@g" /etc/init.d/zabbix_agentd -i

修改zabbix服务端配置文件
/etc/zabbix/zabbix_server.conf
DBHost=172.16.1.51
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

修改zabbix客户端配置文件
/etc/zabbix/zabbix_agentd.conf
Server=172.16.1.7 #zabbix-server IP地址


复制zabbix web 到nginx站点目录
cp -a /server/tools/zabbix-3.0.17/frontends/php /app/html/zabbix


站点授权
chown -R www.www /app/html/zabbix

启动zabbix-server
scp /application/mysql/lib/libmysqlclient.so.18.1.0 [email protected]:/usr/lib64/libmysqlclient.so.18

/etc/init.d/zabbix_server start


启动zabbix-agent
/etc/init.d/zabbix_agentd start

web访问zabbix
http://10.0.0.7/zabbix

用户名、密码
Admin
zabbix


PHP配置
/application/php/lib/php.ini
egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /application/php/lib/php.ini
372:max_execution_time = 300
382:max_input_time = 300
660:post_max_size = 16M
910:date.timezone = Asia/Shanghai


PHP5.6修改
vim zabbix/include/classes/setup/CFrontendSetup.php

查找 always_populate_raw_post_data


* See: http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data
*
* @return array
*/
public function checkPhpAlwaysPopulateRawPostData() {
$current = ini_get('always_populate_raw_post_data');
$current = -1;

return [
'name' => _s('PHP option "%1$s"', 'always_populate_raw_post_data'),
'current' => ($current != -1) ? _('on') : _('off'),
'required' => _('off'),
'result' => ($current != -1) ? self::CHECK_FATAL : self::CHECK_OK,
'error' => _s('PHP option "%1$s" must be set to "%2$s"', 'always_populate_raw_post_data', -1)
];
}


###################################################

PHP LDAP off Warning

以下为PHP添加模块过程:

yum install openldap openldap-devel -y

cp -a /usr/lib64/libldap* /usr/lib/

#进入模块所在的源码位置
cd /server/tools/php-5.5.38/ext/ldap

#编译PHP扩展的工具,主要是根据系统信息生成对应的configure文件
/application/php-5.5.38/bin/phpize

./configure --with-php-config=/application/php-5.5.38/bin/php-config --with-ldap
make
make install


php.ini配置文件
/application/php-5.5.38/lib/php.ini

834 ; If you wish to have an extension loaded automatically, use the following
835 ; syntax:
extension=ldap.so

添加完模块重启PHP


查看模块
/application/php-7.2.4/bin/php -m

猜你喜欢

转载自www.cnblogs.com/xiadongzhi/p/9166883.html