zabbix5.0源码编译安装

安装mysql

源码安装mysql

安装nginx

  1. 安装依赖
yum install pcre pcre-devel openssl-devel gcc-c++ -y
  1. 解压 tar
  2. 创建用户
useradd -s /sbin/nologin -M nginx
  1. 编译
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --sbin-path=/apps/nginx/sbin/nginx --conf-path=/apps/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module --with-stream
make && make install
  1. 添加为系统服务
vim /usr/lib/systemd/system/nginx.service
写入
[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/apps/nginx/sbin/nginx
ExecReload=/apps/nginx/sbin/nginx -s reload
ExecStop=/apps/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target
然后
systemctl daemon-reload
systemctl start nginx.service
systemctl enable nginx.service

安装PHP

  1. 下载
wget https://www.php.net/distributtons/php-7.4.7.tar.gz
  1. 安装依赖
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip gcc-c++ libsqlite3x-devel oniguruma  onigurma-devel
  1. 解压编译
./configure --prefix=/usr/local/php7.4.7 --with-config-file-path=/usr/local/php/etc --enable-ctype --enable-mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-soap --with-gettext --enable-fpm --with-freetype --with-jpeg
make & make install
  1. 添加软链接
ln -s /usr/local/php7.4.7/ /usr/local/php
  1. 复制配置文件
cp php.ini-production /usr/local/php/etc/php.ini
vim /usr/local/php/etc/php.ini
在php.ini的最后添加
post_max_size= 64M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
  1. 添加环境变量
vim /etc/profile
export PHP_PATH=/usr/local/php/bin/
  1. 修改配置文件
cp /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
在php-fpm.conf中 添加
[global]
[www]
user = nginx
group = nginx
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
  1. 验证
php-fpm -t
出现如下情况说明成功
NOTICE: configuration file /usr/local/php7.4.7/etc/php-fpm.conf test is successful
  1. 添加为系统服务
vim /usr/lib/systemd/system/php-fpm.service
写入
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin/php-fpm
[Install]
WantedBy=multi-user.target
  1. 启动验证
systemctl start php-fpm.service
systemctl enable php-fpm.service
systemctl status php-fpm.service

整合

整合nginx

进入安装的nginx目录,修改nginx.conf文件
vim nginx.conf
##
location / {
            root   html;
            index index.php index.html index.htm;
        }

location ~ .*\.(php|php5)?$ {
	    root html;
	    fastcgi_pass 127.0.0.1:9000;
	    fastcgi_index  index.php;
	    include fastcgi.conf;
		}
##
测试
./nginx -t
./nginx -s reload
mkdir -p /usr/local/nginx/html/zabbix

配置java环境

上传安装包,解压,配置环境变量
vim /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_301
export CLASSPATH=$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

安装zabbix5.0

上传安装包,解压,编译
./configure --prefix=/home/zabbix5 --enable-java --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config  --with-net-snmp --with-libcurl --with-libxml2

make install
  1. 添加环境变量
vim /etc/profile
export PATH=$PATH:/home/zabbix5/sbin/
  1. 配置
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
ldconfig
cp -a /home/zabbix-5.0.17/ui/* /usr/local/nginx/html/zabbix/
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值