监控服务zabbix的部署

news2024/11/24 15:01:29

监控服务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

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python应用|获取矢量数据的多边形个数

import geopandas as gpd #首先导入geopandas包# 读取Shapefile文件 shp_file "E:\python\china" gdf gpd.read_file(shp_file)# 获取多边形个数 num_polygons len(gdf)print("Number of polygons:", num_polygons) 图1|输出结果

淄博、哈尔滨、天水…社交媒体助推下的网红城市能“长红”吗?

烧烤卷饼带火山东传统工业小镇淄博&#xff1b; 冰雪狂欢让东北的哈尔滨在寒冬爆火&#xff1b; 一碗麻辣烫让西北天水小城变“网红”…… 在刚刚过去的清明假期&#xff0c;甘肃天水可谓是“热辣滚烫”&#xff0c;在春暖花开时节&#xff0c;迎来了属于它的春天。而被人们逐…

QT:QMainWindow、ui界面、资源文件的添加、信号和槽

1.练习&#xff1a;使用手动连接&#xff0c;将登录框中的取消按钮使用qt4版本的连接到自定义的槽函数中&#xff0c;在自定义的槽函数中调用关闭函数 #include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(…

【STL】栈(stack)

笔者在做下面这道题的时候想到用栈&#xff0c;但写的很麻烦 代码&#xff1a; #include<bits/stdc.h> using namespace std; #define MAXC 255 typedef int SElemType; typedef struct StackNode {SElemType data;struct StackNode *next; }StackNode,*LinkStack; bool…

LiveNVR监控流媒体Onvif/RTSP功能-概览负载统计展示取流中、播放中、录像中点击柱状图快速定位相关会话

LiveNVR概览负载统计展示取流中、播放中、录像中点击柱状图快速定位相关会话 1、负载信息说明2、快速定位会话3、RTSP/HLS/FLV/RTMP拉流Onvif流媒体服务 1、负载信息说明 实时展示取流中、播放中、录像中等使用数目 取流中&#xff1a;当前拉流到平台的实时通道数目播放中&am…

天诚物联网锁亮相福州南京沈阳西安展会,与您见证AIoT行业发展

目光灼灼&#xff0c;步履不辍。自4月1日第七届CCLE中国教育后勤展览会一别&#xff0c;全场景AIoT解决方案服务商——江苏新巢天诚智能技术有限公司&#xff08;以下简称“天诚”&#xff09;打造的校园物联网锁软硬一体化解决方案获得了诸多准意向代理商、集成商同仁们的咨询…

人形机器人行业报告:AI赋能人形机器人开启产业化元年

今天分享的是人形机器人专题系列深度研究报告&#xff1a;《AI赋能&#xff0c;人形机器人开启产业化元年》。 &#xff08;报告出品方&#xff1a;国泰君安证券&#xff09; 报告共计&#xff1a;56页 要点 通用性是人形机器人商业化的关键&#xff0c;AI大模型赋能加速机…

蓝桥杯 每日2题 day5

碎碎念&#xff1a;哦哈呦&#xff0c;到第二天也是哦哈哟&#xff0c;&#xff0c;学前缀和差分学了半天&#xff01;day6堂堂连载&#xff01; 0.单词分析 14.单词分析 - 蓝桥云课 (lanqiao.cn) 关于这题就差在input前加一个sorted&#xff0c;记录一下下。接下来就是用字…

jenkins+git+maven+nodejs安装(linux系统)

前文已经安装完成sonarqube和Sonar Scanner了&#xff0c;接下来可以开始jenkins了 jenkins安装 命令&#xff08;版本为 2.440&#xff09; wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo wget https://pkg.jenkins.io/redh…

golangci-lint 报错

File is not gci-ed with --skip-generated -s standard,default (gci) golangci-lint 报错上面的错解决办法&#xff1a; 1. 文件换行需要换成"LF" 而不是"CRLF" ---->>> 我用的goland IDE&#xff0c;随便在这个文件删除一个空行&#xff…

《手把手教你》系列基础篇之2-python+ selenium自动化测试-打开和关闭浏览器(详细)

1. 简介 本节介绍如何初始化一个webdriver实例对象driver&#xff0c;然后打开和关闭firefox浏览器。要用selenium打开fiefox浏览器。首先需要去下载一个driver插件geckodriver.exe&#xff0c; 下载地址https://github.com/mozilla/geckodriver/releases&#xff0c;下载好这…

爬虫现在还有那么吃香嘛?

Python 作为一种广泛应用的编程语言&#xff0c;在 Web 开发、大数据开发、人工智能开发和嵌入式开发等领域都有着重要的应用。 Python 的易学性、清晰性和可移植性等特点使它得到很多技术人士的喜爱。对于数据科学和机器学习领域的程序员来说&#xff0c;Python 提供了强大的…

并发编程-线程安全:volatile、Lock、synchronized、CAS、ABA、AQS

并发编程-线程安全 1、volatile 关键字1.1 作用1.2 底层实现原理 2、synchronized2.2 synchronized 用法2.2 synchronized 和 volatile 的区别 3、Lock3.1 Lock 和 synchronized 的区别3.2 ReentrantLock 和 synchronized 的区别 4、CAS4.1 CAS 执行流程4.2 ABA问题 5、AQS&…

2024最火的情感短视频素材在哪下载?这里有几个素材网站可以下载

在这个看似无边无际的短视频海洋中&#xff0c;我就像那个手握罗盘、脚踏破旧木筏的勇敢航海家&#xff0c;时刻准备着发现新大陆。而我的罗盘&#xff0c;就是那些能够指引我找到珍稀素材的网站。让我带你领略一下我的航海日记吧。九才素材网&#xff1a; 九才素材网提供了丰…

大数据dolphinscheduler 本地容器化安装

Minio 容器安装 docker run -p 9000:9000 -p 9090:9090 --name minio -d -e "MINIO_ACCESS_KEYminioadmin" -e "MINIO_SECRET_KEYminioadmin" -v D:\SF\DOCKER\minio\data:/data -v D:\SF\DOCKER\minio\config:/root/.minio minio/minio server /da…

全国电影(广州)交易会暨第25届全国优秀影片推介会盛大召开

4月10日&#xff0c;全国电影&#xff08;广州&#xff09;交易会暨第25届全国优秀影片推介会在广州增城召开。作为2024年第一场电影全行业会议&#xff0c;该会议受到行业内外广泛关注和响应&#xff0c;被视为新一年度电影市场“晴雨表”和“风向标”。会议以“聚合电影行业内…

利用Python的Pyttsx3库实现离线文字转语音(TTS)功能

项目中需要一个语言模块&#xff0c;之前用微软的TTS其实挺好用的&#xff0c;但是不开源&#xff0c;离线也不好整&#xff0c;打算找个轻量化的&#xff0c;然后发现&#xff0c;Python里Pyttsx3库已经能完美实现我的需求了 Pyttsx3 Pyttsx3是一个Python库&#xff0c;用于…

【面试题】细说mysql中的各种锁

前言 作为一名IT从业人员&#xff0c;无论你是开发&#xff0c;测试还是运维&#xff0c;在面试的过程中&#xff0c;我们经常会被数据库&#xff0c;数据库中最经常被问到就是MySql。当面试官问MySql的时候经常会问道一个问题&#xff0c;”MySQL中有哪些锁&#xff1f;“当我…

简述Kafka的高可靠性

什么叫可靠性&#xff1f; 大家都知道&#xff0c;系统架构有三高&#xff1a;「高性能、高并发和高可用」&#xff0c;三者的重要性不言而喻。 对于任意系统&#xff0c;想要同时满足三高都是一件非常困难的事情&#xff0c;大型业务系统或者传统中间件都会搭建复杂的架构来…

day05-java面向对象(上)

5.1 面向对象编程 5.1.1 类和对象 1、什么是类 类是一类具有相同特性的事物的抽象描述&#xff0c;是一组相关属性和行为的集合。 属性&#xff1a;就是该事物的状态信息。 行为&#xff1a;就是在你这个程序中&#xff0c;该状态信息要做什么操作&#xff0c;或者基于事物…