监控服务zabbix的部署

监控服务zabbix部署

文章目录

  • 监控服务zabbix部署
    • 1. zabbix介绍
    • 2. zabbix特点
    • 3. zabbix配置文件
    • 4. 部署zabbix
      • 4.1apache安装
      • 4.2mysql安装
      • php安装(yum方式)
      • 4.3php安装(源码方式)
      • 4.4配置apache代理
      • 4.5zabbix安装
      • 4.6zabbix服务端配置
      • 4.7zabbix服务端web界面安装与配置
        • 4.7.1zabbix web界面安装前配置
        • 4.7.2用域名访问的话
        • 4.7.3登录zabbix

1. zabbix介绍

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

zabbix由2部分构成,zabbix server与可选组件zabbix agent

zabbix server可以通过SNMPzabbix agentping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Ubuntu,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

zabbix agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。

zabbix server可以单独监视远程服务器的服务状态;同时也可以与zabbix agent配合,可以轮询zabbix agent主动接收监视数据(agent方式),同时还可被动接收zabbix agent发送的数据(trapping方式)。
另外zabbix server还支持SNMP (v1,v2),可以与SNMP软件(例如:net-snmp)等配合使用。

2. zabbix特点

zabbix的主要特点:

  • 安装与配置简单,学习成本低
  • 支持多语言(包括中文)
  • 免费开源
  • 自动发现服务器与网络设备
  • 分布式监视以及WEB集中管理功能
  • 可以无agent监视
  • 用户安全认证和柔软的授权方式
  • 通过WEB界面设置或查看监视结果
  • email等通知功能

Zabbix主要功能:

  • CPU负荷
  • 内存使用
  • 磁盘使用
  • 网络状况
  • 端口监视
  • 日志监视

3. zabbix配置文件

zabbix配置文件有两种:

  • 服务器端配置文件(/usr/local/etc/zabbix_server.conf)
  • 客户端配置文件(/usr/local/etc/zabbix_agentd.conf)
  • zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)

服务器端配置文件zabbix_server.conf常用配置参数:

参数作用
LogFile设置服务端日志文件存放路径
ListenIP设置服务端监听IP
ListenPort设置服务端监听的端口号
PidFile设置服务端进程号文件存放路径
DBHost指定zabbix的数据库服务器IP
DBName指定zabbix使用的数据库库名
DBUser指定zabbix数据库登录用户
DBPassword指定zabbix数据库登录密码
DBPort指定zabbix数据库端口号
User设置zabbix以什么用户的身份运行
AlertScriptsPath设置告警脚本存放路径
ExternalScripts外部脚本存放路径

客户端配置文件zabbix_agentd.conf常用配置参数:

参数作用
Server指定zabbix服务器的IP或域名
ServerActive指定zabbix服务器的IP或域名
Hostname指定本机的主机名,此项必须与web界面配置项一致
UnsafeUserParameters是否启用自定义监控项,可选值为{1 | 0}
UserParameter指定自定义监控脚本参数
LogFile设置客户端日志文件存放路径

4. 部署zabbix

环境说明:

环境IP要安装的应用
服务器192.168.116.140lamp架构 zabbix server zabbix agent
客户端192.168.116.143zabbix agent

因为zabbix是用php语言开发的,所以必须先部署lamp架构,使其能够支持运行php网页

[root@localhost ~]# hostnamectl set-hostname zabbix-server
[root@localhost ~]# bash
[root@zabbix-server ~]# 
[root@zabbix-server ~]# systemctl disable --now firewalld
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@zabbix-server ~]# vi /etc/selinux/config
[root@zabbix-server ~]# cat /etc/selinux/config | grep '^SELINUX'
SELINUX=disabled
SELINUXTYPE=targeted
[root@zabbix-server ~]# setenforce 0
[root@zabbix-server ~]# getenforce
Permissive

4.1apache安装

1.安装依赖包
[root@zabbix-server ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make vim
Complete!

2.创建系统用户
[root@zabbix-server ~]# useradd -r -M -s /sbin/nologin apache
[root@zabbix-server ~]# id apache
uid=991(apache) gid=991(apache) groups=991(apache)

3.下载软件包(官网下apache.org)
[root@zabbix-server ~]# wget https://downloads.apache.org/apr/apr-1.7.4.tar.gz
[root@zabbix-server ~]# wget https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz
[root@zabbix-server ~]# wget https://downloads.apache.org/httpd/httpd-2.4.58.tar.gz

4.解压软件包
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz
[root@zabbix-server ~]# tar xf apr-1.7.4.tar.gz 
[root@zabbix-server ~]# tar xf apr-util-1.6.3.tar.gz 
[root@zabbix-server ~]# tar xf httpd-2.4.58.tar.gz 
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4  apr-1.7.4.tar.gz  apr-util-1.6.3  apr-util-1.6.3.tar.gz  httpd-2.4.58  httpd-2.4.58.tar.gz

5.编译软件包
//apr-1.7.4
[root@zabbix-server ~]# cd apr-1.7.4
[root@zabbix-server apr-1.7.4]# ls
apr-config.in  apr.pc.in   buildconf         configure     encoding    libapr.dsp  Makefile.in   network_io     random        support     tools
apr.dep        apr.spec    build-outputs.mk  configure.in  file_io     libapr.mak  Makefile.win  NOTICE         README        tables      user
apr.dsp        atomic      CHANGES           docs          helpers     libapr.rc   memory        NWGNUmakefile  README.cmake  test
apr.dsw        build       CMakeLists.txt    dso           include     LICENSE     misc          passwd         shmem         threadproc
apr.mak        build.conf  config.layout     emacs-mode    libapr.dep  locks       mmap          poll           strings       time
[root@zabbix-server apr-1.7.4]# vim configure
cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
   # $RM "$cfgfile"          //注释这一行后者删除这一行

[root@zabbix-server apr-1.7.4]# ./configure --prefix=/usr/local/apr
[root@zabbix-server apr-1.7.4]# ls       //是否生成makefile文件
apr-1-config    apr.exp    build             config.layout  docs           file_io      libapr.mak  Makefile.in   NOTICE         README.cmake  threadproc
apr-config.in   apr.mak    build.conf        config.log     dso            helpers      libapr.rc   Makefile.win  NWGNUmakefile  shmem         time
apr-config.out  apr.pc     buildconf         config.nice    emacs-mode     include      libtool     memory        passwd         strings       tools
apr.dep         apr.pc.in  build-outputs.mk  config.status  encoding       libapr-1.la  LICENSE     misc          poll           support       user
apr.dsp         apr.spec   CHANGES           configure      exports.c      libapr.dep   locks       mmap          random         tables
apr.dsw         atomic     CMakeLists.txt    configure.in   export_vars.c  libapr.dsp   Makefile    network_io    README         test
[root@zabbix-server apr-1.7.4]# make
[root@zabbix-server apr-1.7.4]# make install

//apr-util-1.6.3
[root@zabbix-server ~]# cd apr-util-1.6.3
[root@zabbix-server apr-util-1.6.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@zabbix-server apr-util-1.6.3]# make
[root@zabbix-server apr-util-1.6.3]# make install

//httpd-2.4.58
[root@zabbix-server ~]# cd httpd-2.4.58
[root@zabbix-server httpd-2.4.58]# ./configure --prefix=/usr/local/apache \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
[root@zabbix-server httpd-2.4.58]# make
[root@zabbix-server httpd-2.4.58]# make install

6.配置环境变量
[root@zabbix-server ~]# cd /usr/local/apache
[root@zabbix-server apache]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
[root@zabbix-server apache]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@zabbix-server apache]# source /etc/profile.d/httpd.sh 
[root@zabbix-server apache]# ln -s /usr/local/apache/include/ /usr/include/apache

7.设置开机自启
[root@zabbix-server ~]# cd /usr/lib/systemd/system
[root@zabbix-server system]# cp sshd.service httpd.service
[root@zabbix-server system]# vim httpd.service 
[root@zabbix-server system]# cat httpd.service 
[Unit]
Description=httpd server daemon
After=network.target 

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecStop=/usr/local/apache/bin/apachectl stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@zabbix-server system]# systemctl daemon-reload
[root@zabbix-server system]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@zabbix-server system]# ss -antl
State              Recv-Q             Send-Q                           Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                    0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  128                                       [::]:22                                     [::]:*                                    
LISTEN             0                  511                                          *:80                                        *:*                                    

4.2mysql安装

1.安装依赖包
//mariadb-devel要到pkgs.org上面找这个软件包默认是没有的
[root@zabbix-server ~]# yum -y install https://mirror.stream.centos.org/9-stream/CRB/x86_64/os/Packages/mariadb-devel-10.5.16-2.el9.x86_64.rpm
[root@zabbix-server ~]# yum -y install ncurses-devel openssl-devel openssl cmake

2.创建系统用户
[root@zabbix-server ~]# useradd -r -M -s /sbin/nologin mysql
[root@zabbix-server ~]# id mysql
uid=990(mysql) gid=990(mysql) groups=990(mysql)

3.下载软件包(官网下:mysql.com,下了之后上传)
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4  apr-1.7.4.tar.gz  apr-util-1.6.3  apr-util-1.6.3.tar.gz  httpd-2.4.58  httpd-2.4.58.tar.gz  mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz

4.解压软件包
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4  apr-1.7.4.tar.gz  apr-util-1.6.3  apr-util-1.6.3.tar.gz  httpd-2.4.58  httpd-2.4.58.tar.gz  mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
[root@zabbix-server ~]# 
[root@zabbix-server ~]# tar xf mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz -C /usr/local
[root@zabbix-server ~]# cd /usr/local
[root@zabbix-server local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  mysql-8.0.35-linux-glibc2.28-x86_64  sbin  share  src
[root@zabbix-server local]# mv mysql-8.0.35-linux-glibc2.28-x86_64 mysql
[root@zabbix-server local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  mysql  sbin  share  src

5.配置环境变量
[root@zabbix-server local]# cd mysql
[root@zabbix-server mysql]# ls
bin  docs  include  lib  LICENSE  man  README  share  support-files
[root@zabbix-server mysql]# echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@zabbix-server mysql]# source /etc/profile.d/mysql.sh
[root@zabbix-server mysql]# ln -s /usr/local/mysql/include/ /usr/include/mysql/
[root@zabbix-server mysql]# vim /etc/ld.so.conf.d/mysql.conf
[root@zabbix-server mysql]# cat /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib
[root@zabbix-server mysql]# ldconfig -v

6.修改用户所有者和所属组
[root@zabbix-server ~]# chown -R mysql.mysql /usr/local/mysql
[root@zabbix-server ~]# ll /usr/local/mysql
total 296
drwxr-xr-x.  2 mysql mysql   4096 Oct 12 22:11 bin
drwxr-xr-x.  2 mysql mysql     38 Oct 12 22:11 docs
drwxr-xr-x.  3 mysql mysql   4096 Oct 12 22:11 include
drwxr-xr-x.  6 mysql mysql   4096 Oct 12 22:11 lib
-rw-r--r--.  1 mysql mysql 279355 Oct 12 19:45 LICENSE
drwxr-xr-x.  4 mysql mysql     30 Oct 12 22:11 man
-rw-r--r--.  1 mysql mysql    666 Oct 12 19:45 README
drwxr-xr-x. 28 mysql mysql   4096 Oct 12 22:11 share
drwxr-xr-x.  2 mysql mysql     77 Oct 12 22:11 support-files

7.初始化
//创建目录并修改所有者和所属组
[root@zabbix-server ~]# mkdir /opt/data
[root@zabbix-server ~]# chown -R mysql.mysql /opt/data
[root@zabbix-server ~]# ll -d /opt/data
drwxr-xr-x. 2 mysql mysql 6 Jan  4 14:48 /opt/data
[root@zabbix-server ~]# mysqld --initialize --user mysql --datadir /opt/data
2024-01-04T06:49:33.874760Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.35) initializing of server in progress as process 159751
2024-01-04T06:49:33.881444Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-01-04T06:49:34.200975Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-01-04T06:49:36.290548Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: QiM.!Wu&#1ip
[root@zabbix-server ~]# echo 'QiM.!Wu&#1ip'>pass
[root@zabbix-server ~]# cat pass
QiM.!Wu&#1ip

8.生成配置文件
[root@zabbix-server ~]# vim /etc/my.cnf
[root@zabbix-server ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve

9.配置服务启动脚本
[root@zabbix-server ~]# cd /usr/local/mysql/support-files/
[root@zabbix-server support-files]# ls
mysqld_multi.server  mysql-log-rotate  mysql.server
[root@zabbix-server support-files]# mkdir /etc/init.d
[root@zabbix-server support-files]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@zabbix-server support-files]# vim /etc/init.d/mysqld 
basedir=/usr/local/mysql
datadir=/opt/data

10.设置开机自启
[root@zabbix-server ~]# cd /usr/lib/systemd/system
[root@zabbix-server system]# cp sshd.service mysqld.service
[root@zabbix-server system]# vim mysqld.service 
[root@zabbix-server system]# cat mysqld.service 
[Unit]
Description=mysql server daemon
After=network.target 

[Service]
Type=forking
ExecStart=service mysqld start
ExecStop=service mysqld stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@zabbix-server system]# systemctl daemon-reload
[root@zabbix-server system]# systemctl enable --now mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@zabbix-server system]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    

11.修改数据库密码
[root@zabbix-server ~]# cat pass
QiM.!Wu&#1ip
[root@zabbix-server ~]# mysql -uroot -p'QiM.!Wu&#1ip'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.35

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user root@localhost identified with mysql_native_password by 'Passw0rd@_~';
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye
[root@zabbix-server ~]# mysql -uroot -pPassw0rd@_~
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.35 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

php安装(yum方式)

1.安装php
[root@zabbix-server ~]# yum list all | grep php
php.x86_64                                           8.0.30-1.el9_2                      appstream    
php-bcmath.x86_64                                    8.0.30-1.el9_2                      appstream    
php-cli.x86_64                                       8.0.30-1.el9_2                      appstream    
php-common.x86_64                                    8.0.30-1.el9_2                      appstream    
php-dba.x86_64                                       8.0.30-1.el9_2                      appstream    
php-dbg.x86_64                                       8.0.30-1.el9_2                      appstream    
php-devel.x86_64                                     8.0.30-1.el9_2                      appstream    
php-embedded.x86_64                                  8.0.30-1.el9_2                      appstream    
php-enchant.x86_64                                   8.0.30-1.el9_2                      appstream    
php-ffi.x86_64                                       8.0.30-1.el9_2                      appstream    
php-fpm.x86_64                                       8.0.30-1.el9_2                      appstream    
php-gd.x86_64                                        8.0.30-1.el9_2                      appstream    
php-gmp.x86_64                                       8.0.30-1.el9_2                      appstream    
php-intl.x86_64                                      8.0.30-1.el9_2                      appstream    
php-ldap.x86_64                                      8.0.30-1.el9_2                      appstream    
php-mbstring.x86_64                                  8.0.30-1.el9_2                      appstream    
php-mysqlnd.x86_64                                   8.0.30-1.el9_2                      appstream    
php-odbc.x86_64                                      8.0.30-1.el9_2                      appstream    
php-opcache.x86_64                                   8.0.30-1.el9_2                      appstream    
php-pdo.x86_64                                       8.0.30-1.el9_2                      appstream    
php-pear.noarch                                      1:1.10.13-1.el9                     appstream    
php-pecl-apcu.x86_64                                 5.1.20-5.el9                        appstream    
php-pecl-apcu-devel.x86_64                           5.1.20-5.el9                        appstream    
php-pecl-rrd.x86_64                                  2.0.3-3.el9                         appstream    
php-pecl-xdebug3.x86_64                              3.1.2-1.el9                         appstream    
php-pecl-zip.x86_64                                  1.19.2-6.el9                        appstream    
php-pgsql.x86_64                                     8.0.30-1.el9_2                      appstream    
php-process.x86_64                                   8.0.30-1.el9_2                      appstream    
php-snmp.x86_64                                      8.0.30-1.el9_2                      appstream    
php-soap.x86_64                                      8.0.30-1.el9_2                      appstream    
php-xml.x86_64                                       8.0.30-1.el9_2                      appstream    
[root@zabbix-server ~]# yum -y install php*
Complete!

2.启动服务
[root@zabbix-server ~]# systemctl enable --now php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@zabbix-server ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
[root@zabbix-server ~]# find / -name www.conf
/etc/php-fpm.d/www.conf
[root@zabbix-server ~]# vim /etc/php-fpm.d/www.conf
listen = 0.0.0.0:9000
[root@zabbix-server ~]# systemctl restart php-fpm
[root@zabbix-server ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  511                                   0.0.0.0:9000                                 0.0.0.0:*                                    
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    

[root@zabbix-server opt]# yum -y remove httpd     //用yum安装php包的时候,把httpd也一并安装了,这时需要卸载一并安装的,因为上面已经源码安装了
Complete!
[root@zabbix-server ~]# rpm -qa | grep httpd
httpd-filesystem-2.4.57-5.el9.noarch
[root@zabbix-server ~]# apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:feed:2b10%ens33. Set the 'ServerName' directive globally to suppress this message
//出现这种提示,修改一下配置就行
[root@zabbix-server ~]# vim /usr/local/apache/conf/httpd.conf 
#ServerName www.example.com:80    //取消这一行注释

4.3php安装(源码方式)

1.安装依赖包
[root@localhost ~]# yum list all | grep php | grep mysql
php-mysqlnd.x86_64                                   8.0.30-1.el9_2                      appstream    

[root@localhost ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel  pcre-devel freetype freetype-devel gmp gmp-devel  readline readline-devel libxslt libxslt-devel  php-mysqlnd
Complete!
[root@localhost ~]# echo $?
0

2.下载php软件包(官网下最新的:php.net)
[root@localhost ~]# wget https://www.php.net/distributions/php-8.3.0.tar.xz
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz                         pass
apr-1.7.4        apr-util-1.6.3    httpd-2.4.58           mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz  php-8.3.0.tar.xz

3.解压软件包
[root@localhost ~]# tar xf php-8.3.0.tar.xz 
[root@localhost ~]# cd php-8.3.0
[root@localhost php-8.3.0]# ls
appveyor   buildconf.bat        configure.ac     EXTENSIONS  pear                 README.REDIST.BINS  SECURITY.md  UPGRADING
benchmark  CODEOWNERS           CONTRIBUTING.md  LICENSE     php.ini-development  run-tests.php       tests        UPGRADING.INTERNALS
build      CODING_STANDARDS.md  docs             main        php.ini-production   sapi                travis       win32
buildconf  configure            ext              NEWS        README.md            scripts             TSRM         Zend
4.编译安装php
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif  \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
configure: WARNING: unrecognized options: --enable-inline-optimization, --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-json, --enable-zip
checking for grep that handles long lines and -e... /usr/bin/grep   //开头的警告

configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:  //结尾的报错
Package 'sqlite3', required by 'virtual:world', not found

//解决方案
[root@localhost php-8.3.0]# ./configure --help | grep optimization
[root@localhost php-8.3.0]# ./configure --help | grep gd
  --with-gdbm[=DIR]       DBA: GDBM support
  --enable-gd             Include GD support
  --with-external-gd      Use external libgd
  --with-avif             GD: Enable AVIF support (only for bundled libgd)
  --with-webp             GD: Enable WEBP support (only for bundled libgd)
  --with-jpeg             GD: Enable JPEG support (only for bundled libgd)
  --with-xpm              GD: Enable XPM support (only for bundled libgd)
                          libgd)
  --enable-gd-jis-conv    GD: Enable JIS-mapped Japanese font support (only
                          for bundled libgd)
[root@localhost php-8.3.0]# ./configure --help | grep jpeg
  --with-jpeg             GD: Enable JPEG support (only for bundled libgd)
[root@localhost php-8.3.0]# ./configure --help | grep png
[root@localhost php-8.3.0]# ./configure --help | grep freetype
  --with-freetype         GD: Enable FreeType 2 support (only for bundled
[root@localhost php-8.3.0]# 
[root@localhost php-8.3.0]# ./configure --help | grep json
[root@localhost php-8.3.0]# ./configure --help | grep zip
  --with-zip              Include Zip read/write support

//修改后重新编译
[root@localhost php-8.3.0]#./configure --prefix=/usr/local/php8  \
--with-config-file-path=/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif  \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:
Package 'sqlite3', required by 'virtual:world', not found

//解决方案
[root@localhost php-8.3.0]# yum -y install epel-release
[root@localhost php-8.3.0]# yum list all | grep sqlite3
libsqlite3x.x86_64                                                                       20071018-31.el9                                epel               
libsqlite3x-devel.x86_64                                                                 20071018-31.el9                                epel               
preludedb-sqlite3.x86_64                                                                 5.2.0-2.el9                                    epel               
rubygem-sqlite3.x86_64                                                                   1.4.2-8.el9                                    epel               
rubygem-sqlite3-doc.noarch                                                               1.4.2-8.el9                                    epel               
soci-sqlite3.x86_64                                                                      4.0.3-1.el9                                    epel               
soci-sqlite3-devel.x86_64                                                                4.0.3-1.el9                                    epel               
uwsgi-plugin-sqlite3.x86_64                                                              2.0.23-1.el9                                   epel               
zabbix-dbfiles-sqlite3.noarch                                                            1:6.0.22-2.el9                                 epel               
zabbix-proxy-sqlite3.x86_64                                                              1:6.0.22-2.el9                                 epel               
[root@localhost php-8.3.0]# yum -y install libsqlite3x-devel
Complete!

//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
.........
configure: error: Package requirements (oniguruma) were not met:
Package 'oniguruma', required by 'virtual:world', not found

//解决方案
[root@localhost php-8.3.0]# yum list all | grep oniguruma
oniguruma.i686                                                                           6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  appstream          
[root@localhost php-8.3.0]# cd
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
epel-cisco-openh264.repo  epel.repo  epel-testing.repo  rocky-addons.repo  rocky-devel.repo  rocky-extras.repo  rocky.repo
[root@localhost yum.repos.d]# vim rocky-devel.repo 
[root@localhost yum.repos.d]# cat rocky-devel.repo 
[devel]
name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[root@localhost yum.repos.d]# yum list all | grep oniguruma
oniguruma.i686                                                                           6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  devel              
oniguruma-devel.x86_64                                                                   6.9.6-1.el9.5                                  devel              
[root@localhost php-8.3.0]# yum -y install oniguruma-devel
Complete!

//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
........
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found

//解决方案
[root@localhost php-8.3.0]# yum list all | grep libzip
libzip.i686                                                                              1.7.3-7.el9                                    appstream          
libzip.x86_64                                                                            1.7.3-7.el9                                    appstream          
libzip.x86_64                                                                            1.7.3-7.el9                                    devel              
libzip-devel.x86_64                                                                      1.7.3-7.el9                                    devel              
libzip-tools.x86_64                                                                      1.7.3-7.el9                                    devel              
[root@localhost php-8.3.0]# yum -y install libzip-devel
Complete!

//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
--with-config-file-path=/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif  \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
config.status: executing default commands

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

[root@localhost php-8.3.0]# make
[root@localhost php-8.3.0]# echo $?
0
[root@localhost php-8.3.0]# make install
[root@localhost php-8.3.0]# echo $?
0

5.配置环境变量
[root@localhost ~]# cd /usr/local/php8
[root@localhost php8]# ls
bin  etc  include  lib  php  sbin  var
[root@localhost php8]# echo 'export PATH=/usr/local/php8/bin:/usr/local/php8/sbin:$PATH' > /etc/profile.d/php8.sh
[root@localhost php8]# source /etc/profile.d/php8.sh
[root@localhost php8]# which php
/usr/local/php8/bin/php
[root@localhost php8]# php -v
PHP 8.3.0 (cli) (built: Dec 11 2023 17:25:44) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies

6.配置php-fpm
[root@localhost ~]# cd php-8.3.0
[root@localhost php-8.3.0]# ls
appveyor       CODEOWNERS           configure        EXTENSIONS  main                NEWS                 README.REDIST.BINS  tests                win32
benchmark      CODING_STANDARDS.md  configure.ac     include     Makefile            pear                 run-tests.php       travis               Zend
build          config.log           CONTRIBUTING.md  libs        Makefile.fragments  php.ini-development  sapi                TSRM
buildconf      config.nice          docs             libtool     Makefile.objects    php.ini-production   scripts             UPGRADING
buildconf.bat  config.status        ext              LICENSE     modules             README.md            SECURITY.md         UPGRADING.INTERNALS
[root@localhost php-8.3.0]# cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y
[root@localhost php-8.3.0]# 
[root@localhost php-8.3.0]# cd sapi
[root@localhost sapi]# ls
apache2handler  cgi  cli  embed  fpm  fuzzer  litespeed  phpdbg
[root@localhost sapi]# cd fpm
[root@localhost fpm]# ls
config.m4  fpm             init.d.php-fpm.in  Makefile.frag  php-fpm.8     php-fpm.conf     php-fpm.service     status.html     tests     www.conf.in
CREDITS    init.d.php-fpm  LICENSE            php-fpm        php-fpm.8.in  php-fpm.conf.in  php-fpm.service.in  status.html.in  www.conf
[root@localhost php-8.3.0]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-8.3.0]# chmod +x /etc/init.d/php-fpm
[root@localhost php-8.3.0]# ll -d /etc/init.d/php-fpm
-rwxr-xr-x. 1 root root 2402 Dec 11 17:53 /etc/init.d/php-fpm

[root@localhost ~]# cd /usr/local/php8
[root@localhost php8]# ls
bin  etc  include  lib  php  sbin  var
[root@localhost php8]# cd /etc
[root@localhost etc]# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[root@localhost etc]# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf

7.启动php.fpm
[root@localhost ~]# service php-fpm start
Starting php-fpm  done
[root@localhost ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  4096                                127.0.0.1:9000                                 0.0.0.0:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    

4.4配置apache代理

[root@zabbix-server ~]# vim /usr/local/apache/conf/httpd.conf 
LoadModule proxy_module modules/mod_proxy.so            //取消这一行注释
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so      //取消这一行注释
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php      //添加这一行
    AddType application/x-httpd-php-source .phps   //添加这一行

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Include conf/extra/vhosts.conf            //添加这一行

<IfModule dir_module>
    DirectoryIndex  index.html index.php(添加这)
</IfModule>
[root@zabbix-server ~]# systemctl restart httpd

[root@zabbix-server ~]# cd /usr/local/apache/
[root@zabbix-server apache]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
[root@zabbix-server apache]# cd htdocs/
[root@zabbix-server htdocs]# ls
index.html
[root@zabbix-server htdocs]# mkdir test
[root@zabbix-server htdocs]# ls
index.html  test
[root@zabbix-server test]# vim index.php
<?php
phpinfo();
?>
[root@zabbix-server test]# ls
index.php

[root@zabbix-server apache]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
[root@zabbix-server apache]# cd conf
[root@zabbix-server conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@zabbix-server conf]# ls extra/
httpd-autoindex.conf  httpd-default.conf  httpd-languages.conf  httpd-mpm.conf                 httpd-ssl.conf      httpd-vhosts.conf
httpd-dav.conf        httpd-info.conf     httpd-manual.conf     httpd-multilang-errordoc.conf  httpd-userdir.conf  proxy-html.conf
[root@zabbix-server conf]# vim extra/vhosts.conf
[root@zabbix-server conf]# cat extra/vhosts.conf 
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/test"
    ServerName www.test.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/test$1
    <Directory "/usr/local/apache/htdocs/test">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>  

[root@zabbix-server apache]# chown -R apache.apache /usr/local/apache/htdocs/
[root@zabbix-server ~]# systemctl restart httpd
[root@zabbix-server ~]# systemctl restart php-fpm

在这里插入图片描述

4.5zabbix安装

1.安装依赖包
[root@zabbix-server ~]# yum -y install net-snmp-devel libevent-devel
Complete!

2.下载zabbix与解压
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz                         pass       php-8.3.0.tar.xz
apr-1.7.4        apr-util-1.6.3    httpd-2.4.58           mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz  php-8.3.0  zabbix-6.4.10.tar.gz
[root@zabbix-server ~]# tar xf zabbix-6.4.10.tar.gz 
[root@zabbix-server ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz                         pass       php-8.3.0.tar.xz  zabbix-6.4.10.tar.gz
apr-1.7.4        apr-util-1.6.3    httpd-2.4.58           mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz  php-8.3.0  zabbix-6.4.10

3.创建zabbix用户
[root@zabbix-server ~]# useradd -r -M -s /sbin/nologin zabbix
[root@zabbix-server ~]# id zabbix
uid=987(zabbix) gid=987(zabbix) groups=987(zabbix)

4.配置zabbix数据库
[root@zabbix-server ~]# mysql -uroot -pPassw0rd@_~
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.35 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.02 sec)
mysql> create user 'zabbix'@'localhost' identified with mysql_native_password by 'Passw0rd@_~';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SET GLOBAL log_bin_trust_function_creators = 1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

[root@zabbix-server ~]# cd zabbix-6.4.10
[root@zabbix-server zabbix-6.4.10]# ls
aclocal.m4  bin    ChangeLog  conf          config.sub  configure.ac  database  include  install-sh  Makefile.am  man   missing  README  src
AUTHORS     build  compile    config.guess  configure   COPYING       depcomp   INSTALL  m4          Makefile.in  misc  NEWS     sass    ui
[root@zabbix-server zabbix-6.4.10]# cd database/mysql
[root@zabbix-server mysql]# ls
data.sql  images.sql  Makefile.am  Makefile.in  option-patches  schema.sql
[root@zabbix-server mysql]# mysql -uzabbix -pPassw0rd@_~ zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zabbix-server mysql]# mysql -uzabbix -pPassw0rd@_~ zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zabbix-server mysql]# mysql -uzabbix -pPassw0rd@_~ --default-character-set=utf8mb4 zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

[root@zabbix-server mysql]# mysql -uroot -pPassw0rd@_~

mysql> SET GLOBAL log_bin_trust_function_creators = 0;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit
Bye

[root@zabbix-server ~]# export CFLAGS="-std=gnu99"

5.编译安装zabbix
[root@zabbix-server zabbix-6.4.10]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[root@zabbix-server zabbix-6.4.10]# echo $?
0
[root@zabbix-server zabbix-6.4.10]# make
[root@zabbix-server zabbix-6.4.10]# make install

4.6zabbix服务端配置

//修改服务端配置文件
//设置数据库信息
[root@zabbix-server ~]# ls /usr/local/etc/
zabbix_agentd.conf  zabbix_agentd.conf.d  zabbix_server.conf  zabbix_server.conf.d
[root@zabbix-server ~]# vim /usr/local/etc/zabbix_server.conf
DBPassword=Passw0rd@_~     //找到这一行取消注释,设置密码
DBName=zabbix
DBHost=localhost
DBUser=zabbix

//启动zabbix_server和zabbix_agentd
[root@zabbix-server ~]# ls /usr/local/etc/
zabbix_agentd.conf  zabbix_agentd.conf.d  zabbix_server.conf  zabbix_server.conf.d
[root@zabbix-server ~]# zabbix_server   //启动之后端口没有起来的话重启一下reboot
[root@zabbix-server ~]# zabbix_agentd
[root@zabbix-server ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  4096                                  0.0.0.0:10050                                0.0.0.0:*                                    
LISTEN             0                  4096                                  0.0.0.0:10051                                0.0.0.0:*                                    
LISTEN             0                  4096                                127.0.0.1:9000                                 0.0.0.0:*                                    
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    

//假如没有监听到10051端口的话,以下是解决方案
[root@zabbix-server ~]# cat /tmp/zabbix_server.log
[root@zabbix-server ~]# vim /usr/local/etc/zabbix_server.conf
DBSocket=/tmp/mysql.sock     //取消这一行注释,添加套接字
[root@zabbix-server ~]#  
[root@zabbix-server ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  4096                                  0.0.0.0:10051                                0.0.0.0:*                                    
LISTEN             0                  4096                                  0.0.0.0:10050                                0.0.0.0:*                                    
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  4096                                127.0.0.1:9000                                 0.0.0.0:*                                    
LISTEN             0                  4096                                     [::]:10051                                   [::]:*                                    
LISTEN             0                  4096                                     [::]:10050                                   [::]:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    

4.7zabbix服务端web界面安装与配置

4.7.1zabbix web界面安装前配置
[root@zabbix-server ~]# cd zabbix-6.4.10
[root@zabbix-server zabbix-6.4.10]# ls
aclocal.m4  build      conf          config.status  configure.ac  depcomp  install-sh  Makefile.am  misc     README  ui
AUTHORS     ChangeLog  config.guess  config.sub     COPYING       include  m4          Makefile.in  missing  sass
bin         compile    config.log    configure      database      INSTALL  Makefile    man          NEWS     src
[root@zabbix-server zabbix-6.4.10]# cd ui
[root@zabbix-server ui]# ls
api_jsonrpc.php     chart3.php     conf                 hostinventoriesoverview.php  include         jsrpc.php    robots.txt       trigger_prototypes.php
api_scim.php        chart4.php     data                 hostinventories.php          index_http.php  local        setup.php        triggers.php
app                 chart6.php     disc_prototypes.php  host_prototypes.php          index.php       locale       sysmap.php       vendor
assets              chart7.php     favicon.ico          httpconf.php                 index_sso.php   map.php      sysmaps.php      widgets
audio               chart.php      graphs.php           httpdetails.php              items.php       modules      templates.php    zabbix.php
browserwarning.php  composer.json  history.php          image.php                    js              report2.php  toptriggers.php
chart2.php          composer.lock  host_discovery.php   imgstore.php                 jsLoader.php    report4.php  tr_events.php
[root@zabbix-server ui]# cp -a * /usr/local/apache/htdocs/test
cp: -r not specified; omitting directory 'app'
cp: -r not specified; omitting directory 'assets'
cp: -r not specified; omitting directory 'audio'
cp: -r not specified; omitting directory 'conf'
cp: -r not specified; omitting directory 'data'
cp: -r not specified; omitting directory 'include'
cp: overwrite '/usr/local/apache/htdocs/index.php'? y
cp: -r not specified; omitting directory 'js'
cp: -r not specified; omitting directory 'local'
cp: -r not specified; omitting directory 'locale'
cp: -r not specified; omitting directory 'modules'
cp: -r not specified; omitting directory 'vendor'
cp: -r not specified; omitting directory 'widgets'
[root@zabbix-server ui]# ls /usr/local/apache/htdocs/
api_jsonrpc.php     chart6.php           favicon.ico                  host_prototypes.php  index_http.php  map.php      sysmaps.php             zabbix.php
api_scim.php        chart7.php           graphs.php                   httpconf.php         index.php       report2.php  templates.php
browserwarning.php  chart.php            history.php                  httpdetails.php      index_sso.php   report4.php  toptriggers.php
chart2.php          composer.json        host_discovery.php           image.php            items.php       robots.txt   tr_events.php
chart3.php          composer.lock        hostinventoriesoverview.php  imgstore.php         jsLoader.php    setup.php    trigger_prototypes.php
chart4.php          disc_prototypes.php  hostinventories.php          index.html           jsrpc.php       sysmap.php   triggers.php
[root@zabbix-server ui]# chown -R apache.apache /usr/local/apache/
[root@zabbix-server ui]# chmod 777 /usr/local/apache/htdocs/test/conf
[root@zabbix-server ui]# systemctl restart httpd
[root@zabbix-server ui]# systemctl restart httpd
[root@zabbix-server ui]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  4096                                  0.0.0.0:10050                                0.0.0.0:*                                    
LISTEN             0                  4096                                  0.0.0.0:10051                                0.0.0.0:*                                    
LISTEN             0                  4096                                127.0.0.1:9000                                 0.0.0.0:*                                    
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    

在这里插入图片描述
在这里插入图片描述

//解决方案
[root@zabbix-server ~]# sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
[root@zabbix-server ~]# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
[root@zabbix-server ~]# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
[root@zabbix-server ~]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
[root@zabbix-server ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

4.7.2用域名访问的话
  • 修改/etc/hosts文件,添加域名与IP的映射
  • 在浏览器上访问域名,本文设置的域名为zabbix.wangqing.com,你需要修改成你自己的域名
  • 恢复zabbix/conf目录的权限为755
➜  ~ sudo vim /etc/hosts
Password:
➜  ~ cat /etc/hosts
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost
172.16.12.128   zabbix.wangqing.com

恢复zabbix/conf目录的权限为755:

[root@localhost ~]# chmod 755 /usr/local/apache/htdocs/zabbix/conf
[root@localhost ~]# ll -d /usr/local/apache/htdocs/zabbix/conf
drwxr-xr-x 2 apache apache 104 Aug 17 13:05 /usr/local/apache/htdocs/zabbix/conf
4.7.3登录zabbix

zabbix默认登录用户名和密码:

用户名密码
Adminzabbix

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/541921.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【2024年5月备考新增】《软考真题分章练习(含答案解析) - 18 管理科学-运筹学基础 (2)》

21、某种商品价格 P 变动与某指标 A 的变化具有很强的相关性,指标 A 的增长会导致 P 的降低,反之亦然。指标 A 和价格 P 的相关性系数是()。 A.0.18 B.0 C.0.98 D.-0.83 【答案】D 【解析】A 的增长会导致 B 的降低,反比关系,系数必然是一个负数。正比函数 y=kx,当 k>…

Linux知识点(3)

文章目录 11. 进程间通信11.1 管道11.1.0 |11.1.1 匿名管道11.1.2 命名管道11.1.3 用匿名管道形成进程池 11.2 system V共享内存11.2.1 system V函数11.2.2 system 命令 11.3 system V消息队列11.4 system V 信号量 12. 进程信号12.1 前台进程和后台进程12.1.1 jobs12.1.2 fg &…

Golang | Leetcode Golang题解之第25题K个一组翻转链表

题目&#xff1a; 题解&#xff1a; func reverseKGroup(head *ListNode, k int) *ListNode {hair : &ListNode{Next: head}pre : hairfor head ! nil {tail : prefor i : 0; i < k; i {tail tail.Nextif tail nil {return hair.Next}}nex : tail.Nexthead, tail my…

Linux 使用 ifconfig 报错:Failed to start LSB: Bring up/down networking

一、报错信息 在运行项目时报错数据库连接失败&#xff0c;我就想着检查一下虚拟机是不是 Mysql 服务忘了开&#xff0c;结果远程连接都连接不上虚拟机上的 Linux 了&#xff0c;想着查一下 IP 地址看看&#xff0c;一查就报错了&#xff0c;报错信息&#xff1a; Restarting…

【排序 贪心】3107. 使数组中位数等于 K 的最少操作数

算法可以发掘本质&#xff0c;如&#xff1a; 一&#xff0c;若干师傅和徒弟互有好感&#xff0c;有好感的师徒可以结对学习。师傅和徒弟都只能参加一个对子。如何让对子最多。 二&#xff0c;有无限多1X2和2X1的骨牌&#xff0c;某个棋盘若干格子坏了&#xff0c;如何在没有坏…

读所罗门的密码笔记19_治理模式

1. 解决方案 1.1. 全球人工智能的环境错综复杂&#xff0c;它严重依赖于价值观&#xff0c;且关系重大 1.2. 即使是与大家同仇敌忾的问题做斗争&#xff0c;也往往无法在国际社会中取得最佳效果 1.3. OPCW&#xff08;禁止化学武器组织&#xff09;已经帮助限制了化学武器的…

编曲知识17:音高修正 节奏修正 压缩器应用 压缩数值算法

34届音高修正 节奏修正 压缩器应用 压缩数值算法独立音乐人训练营基地,七年在线教育编曲系统授课,培养了几千名独立音乐人https://app8epdhy0u9502.pc.xiaoe-tech.com/detail/l_660be2e3e4b023c02af7abbc/4?course_id=course_2XLKtQnQx9GrQHac7OPmHD9tqbv 修音 准备工作 …

005Node.js模块URL的使用

引入 URL 模块 要使用 URL 模块&#xff0c;首先需要在代码中引入它。可以使用以下代码将 URL 模块导入到你的脚本中&#xff1a; const url require(url);实例代码 const urlrequire(url); var apihttp://www.baidu.com?nameshixiaobin&age20; console.log(url.parse(…

你的高佣副业不二之选,开始流量卡推广,一文看懂号卡推广

在这个信息化的时代&#xff0c;网络已成为人们生活中不可或缺的一部分。然而&#xff0c;在享受着便捷与高效的同时&#xff0c;我们也必须面对一个现实问题&#xff0c;也就是高昂的流量费用。为了解决这一困扰广大用户的痛点&#xff0c;我们今天带来了一个极具吸引力的机会…

CLIP模型入门

简介 CLIP&#xff08;Contrastive Language-Image Pre-Training&#xff09;是OpenAI在2021年初发布的多模态预训练神经网络模型&#xff0c;用于匹配图像和文本。该模型的关键创新之一是将图像和文本映射到统一的向量空间&#xff0c;通过对比学习的方式进行预训练&#xff…

C语言中抽象的编译和链接原理

今天04.12&#xff0c;身体小有不适&#xff0c;但是睡不着觉&#xff0c;秉着不能浪费时间的原则&#xff0c;现在就简单写一下有关我们C语言中编译和链接的大体过程吧&#xff0c;因为编译和链接是比较抽象的&#xff0c;而且内容是比较底层&#xff0c;我们这里就简单了解它…

MySQL进阶-合

目录 1.使用环境 2.条件判断 2.1.case when 2.2.if 3.窗口函数 3.1.排序函数 3.2.聚合函数 3.3.partiton by ​​​​​​​3.4.order by 4.排序窗口函数 5.聚合窗口函数 1.使用环境 数据库&#xff1a;MySQL 8.0.30 客户端&#xff1a;Navicat 15.0.12 MySQL进阶…

【数学】主成分分析(PCA)的详细深度推导过程

本文基于Deep Learning (2017, MIT)&#xff0c;推导过程补全了所涉及的知识及书中推导过程中跳跃和省略的部分。 blog 1 概述 现代数据集&#xff0c;如网络索引、高分辨率图像、气象学、实验测量等&#xff0c;通常包含高维特征&#xff0c;高纬度的数据可能不清晰、冗余&am…

L1 【哈工大_操作系统】什么是操作系统

从本期开始&#xff0c;笔者将出一系列哈工大的《操作系统》课堂要点笔记&#xff0c;该课程应该算得上是国内最好的操作系统课程之一&#xff0c;也是哈工大CS课程含金量最高的课程之一。尤其是对于想学习国外课程《MIT 6.S081》《MIT 6.828》又基础不足的同学&#xff0c; 特…

微服务学习3

目录 1.微服务保护 1.1.服务保护方案 1.1.1.请求限流 1.1.2.线程隔离 1.1.3.服务熔断 1.2.Sentinel 1.2.1.微服务整合 1.2.2.请求限流 1.3.线程隔离 1.3.1.OpenFeign整合Sentinel 1.3.2.配置线程隔离 1.4.服务熔断 1.4.1.编写降级逻辑 1.4.2服务熔断 2.分布式事…

SpringMVC(一)【入门】

前言 学完了大数据基本组件&#xff0c;SpringMVC 也得了解了解&#xff0c;为的是之后 SpringBoot 能够快速掌握。SpringMVC 可能在大数据工作中用的不多&#xff0c;但是 SSM 毕竟是现在就业必知必会的东西了。SpringBoot 在数仓开发可能会经常用到&#xff0c;所以不废话学吧…

有序二叉树的增删改查(源代码讲解)

有序二叉树的相关实体类 TreeNode类 二叉树结点类&#xff0c;包含三个属性&#xff1a;value&#xff0c;leftChild&#xff0c;rightChild 有序二叉树类就包括这样一个根节点 剩下的getter和setter方法&#xff0c;有参无参构造&#xff0c;toString方法都是老生长谈&…

Zotero插件ZotCard中AI-NNDL文献笔记卡分享及卡片使用方法

一、卡片社区分享 github&#xff1a;ZotCard插件AI-NNDL论文卡片模板 Issue #67 018/zotcard (github.com) 二、卡片效果预览 ZotCard插件AI-NNDL论文卡片模板是关于人工智能神经网络与深度学习论文的笔记卡片&#xff0c;效果预览如下图&#xff1a; 三、卡片代码 经过了…

【MySQL】MySQL在Centos 7环境安装

目录 准备工作 第一步&#xff1a;卸载不要的环境 第二步&#xff1a;下载官方的mysql 第三步 上传到Linux中 第四步 安装 正式安装 启动 ​编辑 登录 准备工作 第一步&#xff1a;卸载不要的环境 使用root进行安装 如果是普通用户&#xff0c;使用 su - 命令&#…

a == 1 a== 2 a== 3 返回 true ?

1. 前言 下面这道题是 阿里、百度、腾讯 三个大厂都出过的面试题&#xff0c;一个前端同事跳槽面试也被问了这道题 // &#xff1f; 位置应该怎么写&#xff0c;才能输出 trueconst a ?console.log(a 1 && a 2 && a 3) 看了大厂的面试题会对面试官的精神…