Zabbix5.0.34源码安装参考
zabbix 5.0.34 源码安装
mysql 5.7 rpm安装
nginx 1.23.0 源码安装
php 7.4.33 源码安装
#########################################下载rpm安装包相关服务
# yum install yum-utils -y
# yumdownloader --resolve 安装包名称
#########################################
# wget http://mirrors.aliyun.com/repo/Centos-7.repo
# mv Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo
====================================================================php7.4 源码安装
下载地址
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libpng-devel libxslt libxslt-devel autoconf libXpm-devel gmp-devel icu libicu libicu-devel sqlite-devel libzip-devel php-ldap icu libzip-devel libjpeg-turbo-devel libzip-devel net-snmp-devel libtool
yum install autoconf automake libtool
wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz 正则表达库
tar -xvf oniguruma-6.9.4.tar.gz
cd oniguruma-6.9.4/
./autogen.sh
./configure --prefix=/usr/local/php --libdir=/lib64
make && make install
# wget https://www.php.net/distributions/php-7.4.33.tar.gz
# cd /opt/ tar xf php-7.4.33.tar.gz && cd php-7.4.33
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-intl --enable-pcntl --enable-ftp --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --disable-fileinfo --enable-opcache --enable-maintainer-zts --enable-gd --with-xsl --with-kerberos --with-libdir=lib64 --with-mysqli --with-pdo-mysql --with-pdo-sqlite --with-bz2 --enable-mbregex --enable-sysvshm --with-iconv --enable-cli --enable-shared --enable-session --with-jpeg --with-freetype --without-gdbm --with-ldap --enable-mbstring --disable-mbregex
--without-pear --disable-phar
make clean && make && make install
cp -arp /opt/php-7.4.33/php.ini-production /usr/local/php/etc/php.ini
cp -arp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp -arp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
vim /usr/local/php/etc/php.ini
post_max_size = 32M
max_execution_time = 300
max_input_time = 600
date.timezone = Asia/Shanghai
mysqli.default_socket = /var/lib/mysql/mysql.sock
vim /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid
环境变量
vim /etc/profile
# php
PATH=$PATH:/usr/local/php/bin
export PATH
source /etc/profile
php -v
mv /lib/systemd/system/php-fpm.service /lib/systemd/system/php-fpm.service5.bak
启动文件
vim /lib/systemd/system/php-fpm.service
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm
ExecReload=/bin/kill -USR2 MAINPID
ExecStop=/bin/kill −INT MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl stop php-fpm.service
systemctl start php-fpm.service
systemctl status php-fpm.service
浏览器访问测试http://192.168.5.124/test.php
vim /usr/local/nginx/html/test.php
phpinfo();
?>
====================================================================nginx 1.23.0 源码安装
yum groupinstall 'Development Tools'
yum install -y vim lrzsz gcc gcc-c++ lsof zip unzip tree net-tools wget ntpdate conntrack-tools automake autoconf pcre pcre-devel libtool iproute telnet openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmemcached-devel make unixODBC unixODBC-devel libssh2-devel OpenIPMI-devel libevent-devel curl-* net-snmp* libxml2-* tar libevent
# useradd nginx -s /sbin/nologin -M
# cd /opt/ && wget http://nginx.org/download/nginx-1.23.0.tar.gz
# tar xf nginx-1.23.0.tar.gz
# cd nginx-1.23.0/
# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/etc/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/log/nginx/nginx.pid --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_realip_module --with-pcre
# make && make install
# /usr/local/nginx/sbin/nginx -t
# cp -arp /usr/local/nginx/sbin/nginx /usr/bin/
# vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start nginx
systemctl status nginx.service
systemctl enable nginx.service
==================nginx主配置文件
mv /usr/local/nginx/etc/nginx.conf /usr/local/nginx/etc/nginx.conf.bak
cat /usr/local/nginx/etc/nginx.conf
user root;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/log/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include /usr/local/nginx/etc/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /usr/local/nginx/etc/conf.d/*.conf;
}
=================nginx添加zabbix虚拟主机
mkdir /usr/local/nginx/etc/conf.d
cat /usr/local/nginx/etc/conf.d/zabbix.conf
server {
listen 80;
server_name localhost;
location / {
root /usr/local/nginx/html;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /status {
stub_status on;
allow all;
access_log off;
}
location ~ \.php$ {
#root /usr/local/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
# systemctl restart nginx
# curl localhost/status
====================================================================mysql 5.7 安装
# rpm -qa | grep mariadb
# wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
# rpm -Uvh mysql57-community-release-el7-10.noarch.rpm
# yum install -y mysql-community-server mysql-devel
systemctl start mysqld.service
systemctl status mysqld.service
systemctl enable mysqld
systemctl daemon-reload
# grep 'temporary password' /var/log/mysqld.log
# mysql -u root -psData#888
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'sData#888';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'sData#888' WITH GRANT OPTION;
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'sData#888';
mysql> FLUSH PRIVILEGES;
====================================================================zabbix 5.0.34 安装
wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.34.tar.gz
groupadd zabbix
useradd -g zabbix zabbix -s /sbin/nologin
tar xf zabbix-5.0.34.tar.gz
cd zabbix-5.0.34
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --enable-proxy --with-libxml2 --with-net-snmp --with-libcurl --enable-ipv6 --with-mysql --with-openipmi --with-ssh2 --with-unixodbc --with-openssl
make && make install
vim /usr/local/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=sData#888
复制前端数据
mkdir /usr/local/nginx/html/zabbix
cd /opt/zabbix-5.0.34/ui
cp -arp * /usr/local/nginx/html/zabbix/
导入数据库
cd /opt/zabbix-5.0.34/database/mysql
mysql -u root -psData#888 zabbix < schema.sql
mysql -u root -psData#888 zabbix < images.sql
mysql -u root -psData#888 zabbix < data.sql
设置开机开机自启
# cp /opt/zabbix-5.0.34/misc/init.d/fedora/core/* /etc/init.d/
# chkconfig zabbix_server on
# chkconfig zabbix_agentd on
# vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
# vim /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
#启动zabbix
systemctl daemon-reload
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
完成后可以查看状态
# systemctl status zabbix_server
# systemctl status zabbix_agentd

浙公网安备 33010602011771号