#使用nginx官方源安装nginxyum install nginx#php安装yum install epel-releaseyum install https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpmyum install libxml2-devel sqlite-devel libcurl-devel libpng-devel libjpeg-turbo-devel libXpm-devel freetype-devel libicu-devel gcc-c++ libxslt-devel oniguruma-devel libsodium-devel openldap-devel net-snmp-devel libwebp-develyum --enablerepo=remi-php74 install php php-cli php-common php-devel php-embedded php-gd php-mbstring php-pdo php-xml php-fpm php-mysqlnd php-opcache php-mcrypt php-pecl-memcached php-pecl-mongodb php-pecl-redis php-bcmath php-intl php-xmlrpc php-pecl-zip php-soap php-snmp php-ldap
修改php-fpm用户
egrep "^(user|group)" /etc/php-fpm.d/www.conf user = nginxgroup = nginx
修改php.ini
vim /etc/php.ini
修改post_max_size = 16Mmax_execution_time = 300max_input_time = 300
nginx配置
vim /etc/nginx/conf.d/zabbix.conf
server { listen 80; server_name localhost; location / { root /usr/share/nginx/html/zabbix; try_files $uri $uri/ /index.php?query_string; index index.php index.html index.htm; } location ~ \.php$ { root /usr/share/nginx/html/zabbix; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }}
注:mysql需要8.0
mysql服务器安装参考
https://blog.csdn.net/wuxingge/article/details/100774308
导入sql
ll zabbix-6.0.7/database/mysql/总用量 34284-rw-r--r-- 1 jenkins jenkins 32910804 7月 25 16:20 data.sql-rw-r--r-- 1 jenkins jenkins 282 7月 25 16:06 double.sql-rw-r--r-- 1 jenkins jenkins 1526 7月 25 16:20 history_pk_prepare.sql-rw-r--r-- 1 jenkins jenkins 1978341 7月 18 15:31 images.sql-rw-r--r-- 1 root root 16702 7月 30 22:17 Makefile-rw-r--r-- 1 jenkins jenkins 508 7月 25 16:20 Makefile.am-rw-r--r-- 1 jenkins jenkins 16352 7月 25 16:20 Makefile.in-rw-r--r-- 1 jenkins jenkins 163854 7月 25 16:20 schema.sql
create database zabbix character set utf8 collate utf8_bin;create user 'zabbix'@'%' identified by 'zabbix';grant all privileges on zabbix.* to 'zabbix'@'%';source schema.sql; source images.sql;source data.sql;
安装mysql客户端
rpm -e mariadb-libs --nodepsrpm -ivh mysql-community-common-8.0.20-1.el7.x86_64.rpm --nodeps --forcerpm -ivh mysql-community-libs-8.0.20-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-client-8.0.20-1.el7.x86_64.rpm --nodeps --forcerpm -ivh mysql-community-devel-8.0.20-1.el7.x86_64.rpm --nodeps --force
安装zabbix-server
# 安装依赖:yum install -y libssh2-devel unixODBC-devel ncurses-devel OpenIPMI-devel libevent-devel java-1.8.0-openjdk-devel openldap-devel gnutls-devel net-snmp-devel curl-devel# 下载上传zabbix-6.0.0.tar.gz源码包并解压tar xf zabbix-6.0.0.tar.gzgroupadd --system zabbixuseradd --system -g zabbix -d /app/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix./configure --prefix=/app/zabbix --enable-server --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc --with-jabber --with-ssh2 --with-zlib --with-libpcre --enable-java --with-ldap --with-gnutlsmakemake install
cd zabbix-6.0.0cp -r ui/* /usr/share/nginx/html/zabbix/chmod 777 /usr/share/nginx/html/zabbix/confcd /app/zabbixmkdir logschown -R zabbix:zabbix /app/zabbixsystemctl restart nginx.service
zabbix-server配置
egrep -v "#|^$" /app/zabbix/etc/zabbix_server.confLogFile=/app/zabbix/logs/zabbix_server.logPidFile=/app/zabbix/logs/zabbix_server.pidDBHost=192.168.41.70DBName=zabbixDBUser=zabbixDBPassword=zabbixDBPort=3306Timeout=4LogSlowQueries=3000StatsAllowedIP=127.0.0.1
zabbix-server启动文件
vim /etc/systemd/system/zabbix-server.service[Unit]Description=Zabbix ServerAfter=syslog.targetAfter=network.target[Service]Environment="CONFFILE=/app/zabbix/etc/zabbix_server.conf"EnvironmentFile=-/app/zabbix/sbin/zabbix_serverType=forkingRestart=on-failurePIDFile=/app/zabbix/logs/zabbix_server.pidKillMode=control-groupExecStart=/app/zabbix/sbin/zabbix_server -c $CONFFILEExecStop=/bin/kill -SIGTERM $MAINPIDRestartSec=10s[Install]WantedBy=multi-user.target
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/7/x86_64/zabbix-agent2-6.0.7-1.el7.x86_64.rpmyum localinstall zabbix-agent2-6.0.7-1.el7.x86_64.rpm
http://192.168.41.70/setup.php
zabbix6自带k8s监控模板
yum install wqy-microhei-fontscp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/nginx/html/zabbix/assets/fonts/DejaVuSans.ttf
来源地址:https://blog.csdn.net/wuxingge/article/details/126079229