在lamp上安装zabbix监控

在lamp上安装zabbix监控

一、部署lamp架构,并测试

1、下载centos和epel源

os-vault-8.5.2111.repo
--2022-09-01 10:56:00--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 58.42.55.241, 58.42.55.238, 58.42.55.236, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|58.42.55.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Ba 100%[========================================>]   2.44K  --.-KB/s    in 0.008s

2022-09-01 10:56:00 (293 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                 508 kB/s | 4.6 MB     00:09
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                20 kB/s |  10 kB     00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                            344 kB/s | 8.4 MB     00:25
epel-release-latest-8.noarch.rpm                                             52 kB/s |  24 kB     00:00
Dependencies resolved.
============================================================================================================
 Package                    Architecture         Version                   Repository                  Size
============================================================================================================
Installing:
 epel-release               noarch               8-17.el8                  @commandline                24 k

Transaction Summary
============================================================================================================
Install  1 Package

Total size: 24 k
Installed size: 34 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                    1/1
  Installing       : epel-release-8-17.el8.noarch                                                       1/1
  Running scriptlet: epel-release-8-17.el8.noarch                                                       1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.

  Verifying        : epel-release-8-17.el8.noarch                                                       1/1

Installed:
  epel-release-8-17.el8.noarch

Complete!
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  epel-modular.repo  epel.repo  epel-testing-modular.repo  epel-testing.repo

//将 repo 配置中的地址替换为阿里云镜像站地址
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]#

2、安装httpd

[root@localhost ~]# yum  -y  install  httpd
Extra Packages for Enterprise Linux 8 - x86_64                              364 kB/s |  13 MB     00:35
Extra Packages for Enterprise Linux Modular 8 - x86_64                      186 kB/s | 734 kB     00:03
Last metadata expiration check: 0:00:02 ago on Thu 01 Sep 2022 11:01:05 AM CST.
Dependencies resolved.
============================================================================================================
 Package                  Architecture Version                                        Repository       Size
============================================================================================================
Installing:
 httpd                    x86_64       2.4.37-43.module_el8.5.0+1022+b541f3b1         AppStream       1.4 M
Installing dependencies:
 apr                      x86_64       1.6.3-12.el8                                   AppStream       129 k
 apr-util                 x86_64       1.6.1-6.el8                                    AppStream       105 k
 centos-logos-httpd       noarch       85.8-2.el8                                     base             75 k
 httpd-filesystem         noarch       2.4.37-43.module_el8.5.0+1022+b541f3b1         AppStream        39 k
 httpd-tools              x86_64       2.4.37-43.module_el8.5.0+1022+b541f3b1         AppStream       107 k
 mod_http2                x86_64       1.15.7-3.module_el8.4.0+778+c970deab           AppStream       154 k
Installing weak dependencies:
 apr-util-bdb             x86_64       1.6.1-6.el8                                    AppStream        25 k
 apr-util-openssl         x86_64       1.6.1-6.el8                                    AppStream        27 k
Enabling module streams:
 httpd                                 2.4

Transaction Summary
============================================================================================================
Install  9 Packages

Total download size: 2.1 M
Installed size: 5.6 M
Downloading Packages:
(1/9): centos-logos-httpd-85.8-2.el8.noarch.rpm                             123 kB/s |  75 kB     00:00
(2/9): apr-util-1.6.1-6.el8.x86_64.rpm                                      138 kB/s | 105 kB     00:00
(3/9): apr-1.6.3-12.el8.x86_64.rpm                                          169 kB/s | 129 kB     00:00
(4/9): apr-util-bdb-1.6.1-6.el8.x86_64.rpm                                  105 kB/s |  25 kB     00:00
(5/9): apr-util-openssl-1.6.1-6.el8.x86_64.rpm                              103 kB/s |  27 kB     00:00
(6/9): httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch.rpm   108 kB/s |  39 kB     00:00
(7/9): httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64.rpm        182 kB/s | 107 kB     00:00
(8/9): mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64.rpm            168 kB/s | 154 kB     00:00
(9/9): httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64.rpm              224 kB/s | 1.4 MB     00:06
------------------------------------------------------------------------------------------------------------
Total                                                                       293 kB/s | 2.1 MB     00:07
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                    1/1
  Installing       : apr-1.6.3-12.el8.x86_64                                                            1/9
  Running scriptlet: apr-1.6.3-12.el8.x86_64                                                            1/9
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                                                    2/9
  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                                                3/9
  Installing       : apr-util-1.6.1-6.el8.x86_64                                                        4/9
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64                                                        4/9
  Installing       : httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                          5/9
  Running scriptlet: httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                     6/9
  Installing       : httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                     6/9
  Installing       : centos-logos-httpd-85.8-2.el8.noarch                                               7/9
  Installing       : mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64                              8/9
  Installing       : httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                9/9
  Running scriptlet: httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                9/9
  Verifying        : centos-logos-httpd-85.8-2.el8.noarch                                               1/9
  Verifying        : apr-1.6.3-12.el8.x86_64                                                            2/9
  Verifying        : apr-util-1.6.1-6.el8.x86_64                                                        3/9
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64                                                    4/9
  Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64                                                5/9
  Verifying        : httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                6/9
  Verifying        : httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                     7/9
  Verifying        : httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                          8/9
  Verifying        : mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64                              9/9

Installed:
  apr-1.6.3-12.el8.x86_64
  apr-util-1.6.1-6.el8.x86_64
  apr-util-bdb-1.6.1-6.el8.x86_64
  apr-util-openssl-1.6.1-6.el8.x86_64
  centos-logos-httpd-85.8-2.el8.noarch
  httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64
  httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch
  httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64
  mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64

Complete!

3、安装php,如果安装php出现下面这种报错说明安装的包有冲突,在命令后面接–allowerasing就可以解决报错

[root@localhost ~]# yum -y install php-xml.x86_64  php-json.x86_64  php-mysqlnd.x86_64  php-common.x86_64  php-fpm.x86_64  php-bcmath.x86_64  php-cli.x86_64  php.x86_64  php-gd.x86_64  php-pdo.x86_64  php-devel.x86_64
Last metadata expiration check: 0:01:55 ago on Thu 01 Sep 2022 11:01:05 AM CST.
Error:
 Problem: package libtool-2.4.6-25.el8.x86_64 requires gcc(major) = 8, but none of the providers can be installed
  - package gcc-8.5.0-3.el8.x86_64 requires glibc-devel >= 2.2.90-12, but none of the providers can be installed
  - package gcc-8.5.0-4.el8_5.x86_64 requires glibc-devel >= 2.2.90-12, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libpthread.so.0, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libdl.so.2, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libm.so.6, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libresolv.so.2, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires librt.so.1, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libutil.so.1, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libBrokenLocale.so.1, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libanl.so.1, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.i686 requires libthread_db.so.1, but none of the providers can be installed
  - package glibc-devel-2.28-164.el8.x86_64 requires glibc = 2.28-164.el8, but none of the providers can be installed
  - glibc-2.28-164.el8.i686 has inferior architecture
  - cannot install both glibc-2.28-164.el8.x86_64 and glibc-2.28-189.el8.x86_64
  - package php-devel-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 requires libtool, but none of the providers can be installed
  - package glibc-gconv-extra-2.28-189.el8.x86_64 requires glibc(x86-64) = 2.28-189.el8, but none of the providers can be installed
  - conflicting requests
  - problem with installed package glibc-gconv-extra-2.28-189.el8.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

[root@localhost ~]# yum -y install php-xml.x86_64  php-json.x86_64  php-mysqlnd.x86_64  php-common.x86_64  php-fpm.x86_64  php-bcmath.x86_64  php-cli.x86_64  php.x86_64  php-gd.x86_64  php-pdo.x86_64  php-devel.x86_64 --allowerasing
Last metadata expiration check: 0:02:08 ago on Thu 01 Sep 2022 11:01:05 AM CST.
Dependencies resolved.

4、安装mariadb

[root@localhost ~]# yum -y install mariadb-server mariadb
Last metadata expiration check: 0:06:38 ago on Thu 01 Sep 2022 11:01:05 AM CST.
Dependencies resolved.
============================================================================================================
 Package                        Arch       Version                                      Repository     Size
============================================================================================================
Installing:
 mariadb                        x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream     6.0 M
 mariadb-server                 x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream      16 M
Installing dependencies:
 mariadb-common                 x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream      64 k
 mariadb-connector-c            x86_64     3.1.11-2.el8_3                               AppStream     200 k
 mariadb-connector-c-config     noarch     3.1.11-2.el8_3                               AppStream      15 k
 mariadb-errmsg                 x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream     234 k
 perl-DBD-MySQL                 x86_64     4.046-3.module_el8.3.0+419+c2dec72b          AppStream     156 k
Installing weak dependencies:
 mariadb-backup                 x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream     6.1 M
 mariadb-gssapi-server          x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream      51 k
 mariadb-server-utils           x86_64     3:10.3.28-1.module_el8.3.0+757+d382997d      AppStream     1.1 M
Enabling module streams:
 mariadb                                   10.3
 perl-DBD-MySQL                            4.046

Transaction Summary
============================================================================================================
Install  10 Packages

Total download size: 30 M
Installed size: 153 M
Downloading Packages:
(1/10): mariadb-common-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm     132 kB/s |  64 kB     00:00
(2/10): mariadb-connector-c-3.1.11-2.el8_3.x86_64.rpm                       245 kB/s | 200 kB     00:00
(3/10): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm                 88 kB/s |  15 kB     00:00
(4/10): mariadb-errmsg-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm     280 kB/s | 234 kB     00:00
(5/10): mariadb-gssapi-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64. 160 kB/s |  51 kB     00:00
(6/10): mariadb-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm            299 kB/s | 6.0 MB     00:20
(7/10): mariadb-backup-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm     274 kB/s | 6.1 MB     00:22
(8/10): perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64.rpm       225 kB/s | 156 kB     00:00
(9/10): mariadb-server-utils-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.r 275 kB/s | 1.1 MB     00:04
(10/10): mariadb-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm    301 kB/s |  16 MB     00:54
------------------------------------------------------------------------------------------------------------
Total                                                                       535 kB/s |  30 MB     00:57
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                    1/1
  Installing       : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                  1/10
  Installing       : mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     2/10
  Installing       : mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     3/10
  Installing       : perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64                         4/10
  Installing       : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                         5/10
  Installing       : mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     6/10
  Installing       : mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64              7/10
  Installing       : mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64               8/10
  Running scriptlet: mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     9/10
  Installing       : mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     9/10
  Running scriptlet: mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     9/10
  Installing       : mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                           10/10
  Running scriptlet: mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                           10/10
  Verifying        : mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                            1/10
  Verifying        : mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     2/10
  Verifying        : mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     3/10
  Verifying        : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                         4/10
  Verifying        : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                  5/10
  Verifying        : mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     6/10
  Verifying        : mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64              7/10
  Verifying        : mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                     8/10
  Verifying        : mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64               9/10
  Verifying        : perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64                        10/10

Installed:
  mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-connector-c-3.1.11-2.el8_3.x86_64
  mariadb-connector-c-config-3.1.11-2.el8_3.noarch
  mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64
  perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64

Complete!

5、设置数据库服务

[root@localhost ~]# systemctl  restart  mariadb
[root@localhost ~]# systemctl  enable  mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

6、设置httpd服务

[root@localhost ~]#  vim /etc/httpd/conf/httpd.conf
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

7、测试php页面


[root@localhost ~]# vim /etc/php.ini
; http://php.net/date.timezone   
;date.timezone = Asia/Shanghai    //找到下面这行把地点设置为上海
[root@localhost ~]#  vim /var/www/html/index.php
[root@localhost ~]# cat /var/www/html/index.php
<?php
        phpinfo();
?>

8、验证
首先关闭防火墙

[root@localhost ~]# systemctl stop firewalld.service

在这里插入图片描述

二、部署zabbix监控软件


[root@localhost ~]# vim  /etc/yum.repos.d/zabbix.repo
[root@localhost ~]# cat  /etc/yum.repos.d/zabbix.repo
[aliyun]
name=aliyun
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/8/x86_64/
enable=1
gpgcheck=0
[qinghua]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/8/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

2、安装

[root@localhost ~]# dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
aliyun                                                                      108 kB/s | 115 kB     00:01
Zabbix Official Repository - x86_64                                          41 kB/s | 115 kB     00:02
Dependencies resolved.
============================================================================================================
 Package                   Architecture Version                                       Repository       Size
============================================================================================================
Installing:
 zabbix-agent              x86_64       4.4.10-1.el8                                  aliyun          447 k
 zabbix-apache-conf        noarch       4.4.10-1.el8                                  aliyun          234 k
 zabbix-server-mysql       x86_64       4.4.10-1.el8                                  aliyun          2.5 M
 zabbix-web-mysql          noarch       4.4.10-1.el8                                  aliyun           15 k
Installing dependencies:
 OpenIPMI-libs             x86_64       2.0.31-3.el8                                  base            509 k
 fping                     x86_64       4.2-2.el8                                     epel             43 k
 php-ldap                  x86_64       7.2.24-1.module_el8.2.0+313+b04d0a66          AppStream        79 k
 php-mbstring              x86_64       7.2.24-1.module_el8.2.0+313+b04d0a66          AppStream       580 k
 unixODBC                  x86_64       2.3.7-1.el8                                   AppStream       458 k
 zabbix-web                noarch       4.4.10-1.el8                                  aliyun          2.9 M

Transaction Summary
============================================================================================================
Install  10 Packages

Total download size: 7.8 M
Installed size: 32 M
Downloading Packages:
(1/10): php-ldap-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64.rpm            103 kB/s |  79 kB     00:00
(2/10): OpenIPMI-libs-2.0.31-3.el8.x86_64.rpm                               259 kB/s | 509 kB     00:01
(3/10): fping-4.2-2.el8.x86_64.rpm                                          109 kB/s |  43 kB     00:00
(4/10): php-mbstring-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64.rpm        244 kB/s | 580 kB     00:02
(5/10): unixODBC-2.3.7-1.el8.x86_64.rpm                                     218 kB/s | 458 kB     00:02
(6/10): zabbix-apache-conf-4.4.10-1.el8.noarch.rpm                          267 kB/s | 234 kB     00:00
(7/10): zabbix-agent-4.4.10-1.el8.x86_64.rpm                                312 kB/s | 447 kB     00:01
(8/10): zabbix-web-mysql-4.4.10-1.el8.noarch.rpm                            102 kB/s |  15 kB     00:00
(9/10): zabbix-server-mysql-4.4.10-1.el8.x86_64.rpm                         372 kB/s | 2.5 MB     00:06
(10/10): zabbix-web-4.4.10-1.el8.noarch.rpm                                 363 kB/s | 2.9 MB     00:08
------------------------------------------------------------------------------------------------------------
Total                                                                       690 kB/s | 7.8 MB     00:11
Extra Packages for Enterprise Linux 8 - x86_64                              1.6 MB/s | 1.6 kB     00:00
Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <epel@fedoraproject.org>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                    1/1
  Installing       : fping-4.2-2.el8.x86_64                                                            1/10
  Installing       : unixODBC-2.3.7-1.el8.x86_64                                                       2/10
  Running scriptlet: unixODBC-2.3.7-1.el8.x86_64                                                       2/10
  Installing       : php-mbstring-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64                          3/10
  Installing       : php-ldap-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64                              4/10
  Installing       : zabbix-apache-conf-4.4.10-1.el8.noarch                                            5/10
  Running scriptlet: zabbix-apache-conf-4.4.10-1.el8.noarch                                            5/10
  Installing       : zabbix-web-mysql-4.4.10-1.el8.noarch                                              6/10
  Installing       : zabbix-web-4.4.10-1.el8.noarch                                                    7/10
  Running scriptlet: zabbix-web-4.4.10-1.el8.noarch                                                    7/10
  Installing       : OpenIPMI-libs-2.0.31-3.el8.x86_64                                                 8/10
  Running scriptlet: zabbix-server-mysql-4.4.10-1.el8.x86_64                                           9/10
  Installing       : zabbix-server-mysql-4.4.10-1.el8.x86_64                                           9/10
  Running scriptlet: zabbix-server-mysql-4.4.10-1.el8.x86_64                                           9/10
  Running scriptlet: zabbix-agent-4.4.10-1.el8.x86_64                                                 10/10
  Installing       : zabbix-agent-4.4.10-1.el8.x86_64                                                 10/10
  Running scriptlet: zabbix-agent-4.4.10-1.el8.x86_64                                                 10/10
  Verifying        : OpenIPMI-libs-2.0.31-3.el8.x86_64                                                 1/10
  Verifying        : php-ldap-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64                              2/10
  Verifying        : php-mbstring-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64                          3/10
  Verifying        : unixODBC-2.3.7-1.el8.x86_64                                                       4/10
  Verifying        : fping-4.2-2.el8.x86_64                                                            5/10
  Verifying        : zabbix-agent-4.4.10-1.el8.x86_64                                                  6/10
  Verifying        : zabbix-apache-conf-4.4.10-1.el8.noarch                                            7/10
  Verifying        : zabbix-server-mysql-4.4.10-1.el8.x86_64                                           8/10
  Verifying        : zabbix-web-4.4.10-1.el8.noarch                                                    9/10
  Verifying        : zabbix-web-mysql-4.4.10-1.el8.noarch                                             10/10

Installed:
  OpenIPMI-libs-2.0.31-3.el8.x86_64
  fping-4.2-2.el8.x86_64
  php-ldap-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64
  php-mbstring-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64
  unixODBC-2.3.7-1.el8.x86_64
  zabbix-agent-4.4.10-1.el8.x86_64
  zabbix-apache-conf-4.4.10-1.el8.noarch
  zabbix-server-mysql-4.4.10-1.el8.x86_64
  zabbix-web-4.4.10-1.el8.noarch
  zabbix-web-mysql-4.4.10-1.el8.noarch

Complete!

3、配置数据库并导入zabbix表数据

[root@localhost ~]# mysql -u  root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>
MariaDB [(none)]> create  database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> grant all on zabbix.* to zabbix@'localhost' identified by 'redhat';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]>  flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> exit
Bye
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -predhat zabbix
[root@localhost ~]#

4、验证zabbix数据库数据

[root@localhost ~]# mysql -u  root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| config_autoreg_tls         |
| corr_condition             |
| corr_condition_group       |
| corr_condition_tag         |
| corr_condition_tagpair     |
| corr_condition_tagvalue    |
| corr_operation             |
| correlation                |
| dashboard                  |
| dashboard_user             |
| dashboard_usrgrp           |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| event_recovery             |
| event_suppress             |
| event_tag                  |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| host_tag                   |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| hstgrp                     |
| httpstep                   |
| httpstep_field             |
| httpstepitem               |
| httptest                   |
| httptest_field             |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| item_application_prototype |
| item_condition             |
| item_discovery             |
| item_preproc               |
| item_rtdata                |
| items                      |
| items_applications         |
| lld_macro_path             |
| maintenance_tag            |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| mappings                   |
| media                      |
| media_type                 |
| media_type_param           |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| problem                    |
| problem_tag                |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| rights                     |
| screen_user                |
| screen_usrgrp              |
| screens                    |
| screens_items              |
| scripts                    |
| service_alarms             |
| services                   |
| services_links             |
| services_times             |
| sessions                   |
| slides                     |
| slideshow_user             |
| slideshow_usrgrp           |
| slideshows                 |
| sysmap_element_trigger     |
| sysmap_element_url         |
| sysmap_shape               |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| tag_filter                 |
| task                       |
| task_acknowledge           |
| task_check_now             |
| task_close_problem         |
| task_remote_command        |
| task_remote_command_result |
| timeperiods                |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| trigger_tag                |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
| widget                     |
| widget_field               |
+----------------------------+
149 rows in set (0.001 sec)

MariaDB [zabbix]>

5、配置zabbix并启动服务

[root@server ~]# vim /etc/zabbix/zabbix_server.conf 
ListenPort=10051 
DBHost=localhost 
DBName=zabbix 
DBUser=zabbix 
DBPassword=redhat             #打开注释并修改连接mysql的密码,在124行 
DBSocket=/var/lib/mysql/mysql.sock 
ListenIP=0.0.0.0 
[root@localhost ~]# systemctl restart zabbix-server.service
[root@localhost ~]# systemctl enable zabbix-server.service
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service.
[root@localhost ~]# netstat -tulnp | grep 10051
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      1123209/zabbix_serv

6、配置httpd并启动服务

[root@localhost ~]#  systemctl restart httpd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost ~]#

7、浏览器访问http://192.168.181.159/zabbix
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

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

默认账号为Admin,密码为zabbix
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值