zabbix源码编译过程

安装依赖库
yum install -y gcc vim wget openssl nasm bzip2 gcc-c++ autoconf automake libtool 
yum install -y openssl-devel python-devel zlib-devel libpng-devel libjpeg-devel freetype-devel readline-devel


readline下载安装
wget -c https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
tar -zxvf readline-7.0.tar.gz 
cd readline-7.0
./configure --prefix=/opt/pgsql
make && make installl


pgsql安装
wget https://ftp.postgresql.org/pub/source/v11.1/postgresql-11.1.tar.gz
tar -zxvf postgresql-11.1.tar.gz
cd postgresql-11.1
./configure --prefix=/opt/pgsql
make && make install



export PGHOME=/opt/pgsql
export PGDATA=/opt/pgsql/data
export PATH=$PGHOME/bin:$PATH
export MANPATH=$PGHOME/share/man:$MANPATH
export LANG=en_US.utf8
export DATE=`date +"%Y-%m-%d %H:%M:%S"`
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH



下载expat
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_3/expat-2.2.3.tar.bz2
tar -jxvf expat-2.2.3.tar.bz2
cd expat-2.2.3
./configure --prefix=/opt/httpd
make && make install


下载apr
wget https://archive.apache.org/dist/apr/apr-1.6.5.tar.gz
tar -zxvf apr-1.6.5.tar.gz
cd apr-1.6.5
./configure --prefix=/opt/httpd
make && make install


下载aprutil
wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/opt/httpd --with-apr=/opt/httpd --with-expat=/opt/httpd
make && make install 


下载pcre
wget https://ftp.pcre.org/pub/pcre/pcre-8.39.tar.gz
tar -zxvf pcre-8.39.tar.gz
cd pcre-8.39
./configure --prefix=/opt/httpd
make && make install


下载httpd
wget http://archive.apache.org/dist/httpd/httpd-2.4.37.tar.gz
tar -zxvf httpd-2.4.37.tar.gz
cd httpd-2.4.37
./configure --prefix=/opt/httpd --with-apr=/opt/httpd --with-apr-util=/opt/httpd --with-pcre=/opt/httpd --enable-so --enable-static-support
make && make install


启动httpd
/opt/httpd/bin/httpd -f /opt/httpd/conf/httpd.conf -k start

下载libxml2
wget http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz
tar -zxvf libxml2-2.9.8.tar.gz
cd libxml2-2.9.8
./configure --prefix=/opt/httpd
make && make install


下载libjpeg-turbo
wget https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-1.5.3.tar.gz
tar -zxvf libjpeg-turbo-1.5.3.tar.gz
cd libjpeg-turbo-1.5.3
./configure --prefix=/opt/httpd/
make && make install


下载gettext
wget https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.gz
tar -zxvf gettext-0.19.8.1.tar.gz
cd gettext-0.19.8.1
./configure --prefix=/opt/httpd/
make && make install


下载libwebp
wget https://codeload.github.com/webmproject/libwebp/tar.gz/refs/tags/v1.0.1
mv v1.0.1 libwebp-1.0.1.tar.gz
tar -zxvf libwebp-1.0.1.tar.gz
cd libwebp-1.0.1
./autogen.sh

./configure --prefix=/opt/httpd

make && make install


php下载
wget http://cn2.php.net/distributions/php-7.1.3.tar.gz
tar -zxvf php-7.1.3.tar.gz
cd php-7.1.3
./configure --prefix=/opt/php --enable-bcmath --enable-ctype --enable-sockets --enable-mbstring -with-apxs2=/opt/httpd/bin/apxs --with-pgsql=/opt/pgsql --with-pdo-pgsql=/opt/pgsql --with-gd --with-jpeg-dir=/opt/httpd --with-freetype-dir --with-gettext=/opt/httpd --with-libxml-dir=/opt/httpd --with-jpeg-dir=/opt/httpd 
make && make install


安装java jdk

下载libssh2-1.8.0.tar.gz
wget  https://www.libssh2.org/download/libssh2-1.8.0.tar.gz
tar -zxvf libssh2-1.8.0.tar.gz
cd libssh2-1.8.0
./configure --prefix=/opt/zabbix
make 
make install


下载libevent
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/opt/zabbix
make && make install

ln -s /opt/zabbix/lib/libevent-2.1.so.6 /usr/lib/libevent-2.1.so.6


下载 zabiix
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.15/zabbix-3.4.15.tar.gz
tar -zxvf zabbix-3.4.15.tar.gz
cd zabbix-3.4.15


./configure --prefix=/opt/zabbix --enable-server --enable-proxy --enable-agent --enable-java --with-ssh2=/opt/zabbix --with-postgresql=/opt/pgsql/bin/pg_config --with-libevent=/opt/zabbix

make && make install

配置php

#创建配置文件目录
mkdir -p /opt/httpd/php



#从源码包拷贝配置文件
cp /opt/soft/php-7.3.27/php.ini-production /opt/httpd/php/php.ini


#修改配置项
vim /opt/httpd/php/php.ini

max_execution_time 300
memory_limit 128M
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
date.timezone = Asia/Chongqing



配置httpd
vim /opt/httpd/conf/httpd.conf

#去掉注释  152行
LoadModule rewrite_module modules/mod_rewrite.so

#增加
PhpIniDir php
#文件尾部增加
TraceEnable off
ServerTokens Prod
ServerSignature Off

#DirectoryIndex后增加index.php
DirectoryIndex index.html index.php

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.ph(p[2-6]?|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]

#启动httpd
/opt/httpd/bin/httpd -f /opt/httpd/conf/httpd.conf -k start


配置 pgsql
adduser postgres

mkdir -p /opt/pgsql/data

chown -R postgres:postgres /opt/pgsql


su - postgres -c "/opt/pgsql/bin/initdb -D /opt/pgsql/data"
su - postgres -c "/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data start"
/opt/pgsql/bin/createdb -p 5432 -U postgres console_server
echo "postgres:Console1.2@2018" | chpasswd
echo "alter user postgres with password 'Console1.2@2018'" | /opt/pgsql/bin/psql -U postgres -p 5432

vim /opt/pgsql/data/postgresql.conf
listen_addresses = '*'



配置zabbix
adduser zabbix

mkdir /opt/httpd/htdocs/zabbix
cp -r /opt/soft/zabbix-3.4.15/frontends /opt/httpd/htdocs/zabbix/
chmod 755 /opt/httpd/htdocs/zabbix/ -R

#初始化数据库
/opt/pgsql/bin/psql -U postgres -p 5432 console_server < /opt/soft/zabbix-3.4.15/database/postgresql/schema.sql
/opt/pgsql/bin/psql -U postgres -p 5432 console_server < /opt/soft/zabbix-3.4.15/database/postgresql/images.sql
/opt/pgsql/bin/psql -U postgres -p 5432 console_server < /opt/soft/zabbix-3.4.15/database/postgresql/data.sql 


vim /opt/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=console_server
DBUser=postgres
DBPassword=Console1.2@2018

mkdir /opt/zabbix/logs
chown -R zabbix:zabbix /opt/zabbix/
su - zabbix -c "export LD_LIBRARY_PATH=/opt/pgsql/lib:/opt/zabbix/lib;$LD_LIBRARY_PATH /opt/zabbix/sbin/zabbix_server -c /opt/zabbix/etc/zabbix_server.conf > /opt/zabbix/logs/zabbix.log 2>&1 &"




访问
http://ip/zabbix

按提示下一步操作

Alternatively, you can install it manually:

Download the configuration file

Save it as “/opt/httpd/htdocs/zabbix/frontends/php/conf/zabbix.conf.php”

将下载的地址上传到指定目录中刷新页面

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值