运维监控-基于yum的方式部署Zabbix Server 4.0 版本

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

              运维监控-基于yum的方式部署Zabbix Server 4.0 版本

                                       作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

一.如何选择zabbix版本

1>.打开zabbix官方网址(https://www.zabbix.com/

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

2>.查看zabbix版本的生命周期(https://www.zabbix.com/life_cycle_and_release_policy

  如下图所示,如果还在使用zabbix2.2版本的小伙伴应该尽量往zabbix3.0 LTS或者zabbix4.0 LTS版本迁移。因为到今年年底,估计zabbix将停止对zabbix2.2版本的技术支持了!

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

3>.选择zabbix版本

   看完上述官方的介绍,大家可以选择zabbix3.0也可以选择zabbix4.0。无论选择哪个版本,使用方法都大同小异。博主推荐部署比较新的版本,

  安装文档参考:https://www.zabbix.com/documentation/4.0/manual/installation

  关于zabbix 4.0新特性的可参考:https://www.zabbix.com/documentation/4.0/manual/introduction/whatsnew400

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

  如上图所示关于zabbix部署文档如下(其实你打卡网页自己根据操作平台选择即可):

    zabbix3.0的部署文档可参考:https://www.zabbix.com/download?zabbix=3.0&os_distribution=centos&os_version=7&db=mysql

      zabbix4.0的部署文档可参考:https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql

二.部署zabbix4.0.0服务器

1>.安装zabbix的yum源

[root@node101 ~]# ll /etc/yum.repos.d/
total 28
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.CJNNNd: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-1.el7         ################################# [100%]
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# ll /etc/yum.repos.d/
total 32
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
-rw-r--r--. 1 root root  410 Oct  2 00:34 zabbix.repo        #发现没有,就是多出来这个yum配置文件!
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

2>.将官方yum源的地址改为阿里云的地址

[root@node101 ~]# grep keepcache /etc/yum.conf 
keepcache=0
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# sed -i 's#keepcache=0#keepcache=1#g'   /etc/yum.conf 
[root@node101 ~]# 
[root@node101 ~]# grep keepcache /etc/yum.conf 
keepcache=1
[root@node101 ~]# 
[root@node101 ~]# sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf      #我们把安装zabbix的安装包保存起来,方便以后制作局域网的yum仓库
[root@node101 ~]# cat /etc/yum.repos.d/zabbix.repo         #这个源是官方地址,服务器在国外存放者,下载的时候速度可能会有点慢!
[zabbix]                                  #这个是zabbix模块
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]                          #这个是zabbix的基础支持模块
name=Zabbix Official Repository non-supported - $basearch 
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# cat /etc/yum.repos.d/zabbix.repo 
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/          #这里我们换成阿里云的镜像,目的就是为了在下载的时候速度稍微快一点
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch 
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/        #换了上面的zabbix安装源地址,其组件地址也要记得换哟!
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[root@node101 ~]# 
[root@node101 ~]# yum list | grep zabbix                          #我们查看一下zabbix的源是否存在,我们仔细看一下,发现有zabbix4.0的安装包了!
zabbix-release.noarch                       4.0-1.el7                  installed
fping.x86_64                                3.10-1.el7                 zabbix-non-supported
iksemel.x86_64                              1.4-2.el7.centos           zabbix-non-supported
iksemel-devel.x86_64                        1.4-2.el7.centos           zabbix-non-supported
iksemel-utils.x86_64                        1.4-2.el7.centos           zabbix-non-supported
pcp-export-pcp2zabbix.x86_64                4.1.0-5.el7_6              updates  
pcp-export-zabbix-agent.x86_64              4.1.0-5.el7_6              updates  
zabbix-agent.x86_64                         4.0.4-1.el7                zabbix   
zabbix-get.x86_64                           4.0.4-1.el7                zabbix   
zabbix-java-gateway.x86_64                  4.0.4-1.el7                zabbix   
zabbix-proxy-mysql.x86_64                   4.0.4-1.el7                zabbix   
zabbix-proxy-pgsql.x86_64                   4.0.4-1.el7                zabbix   
zabbix-proxy-sqlite3.x86_64                 4.0.4-1.el7                zabbix   
zabbix-sender.x86_64                        4.0.4-1.el7                zabbix   
zabbix-server-mysql.x86_64                  4.0.4-1.el7                zabbix   
zabbix-server-pgsql.x86_64                  4.0.4-1.el7                zabbix   
zabbix-web.noarch                           4.0.4-1.el7                zabbix   
zabbix-web-japanese.noarch                  4.0.4-1.el7                zabbix   
zabbix-web-mysql.noarch                     4.0.4-1.el7                zabbix   
zabbix-web-pgsql.noarch                     4.0.4-1.el7                zabbix   
[root@node101 ~]# 
[root@node101 ~]# cat /etc/yum.repos.d/zabbix.repo

3>.安装Zabbix服务器,前端,代理

[root@node101 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
Loaded plugins: fastestmirror
base                                                                                                            | 3.6 kB  00:00:00     
extras                                                                                                          | 3.4 kB  00:00:00     
updates                                                                                                         | 3.4 kB  00:00:00     
zabbix                                                                                                          | 2.9 kB  00:00:00     
zabbix-non-supported                                                                                            |  951 B  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.nwsuaf.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:4.0.4-1.el7 will be installed
---> Package zabbix-server-mysql.x86_64 0:4.0.4-1.el7 will be installed
--> Processing Dependency: fping for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libnetsnmp.so.31()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libiksemel.so.3()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libOpenIPMIposix.so.0()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libevent-2.0.so.5()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libOpenIPMI.so.0()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
--> Processing Dependency: libodbc.so.2()(64bit) for package: zabbix-server-mysql-4.0.4-1.el7.x86_64
---> Package zabbix-web-mysql.noarch 0:4.0.4-1.el7 will be installed
--> Processing Dependency: zabbix-web = 4.0.4-1.el7 for package: zabbix-web-mysql-4.0.4-1.el7.noarch
--> Processing Dependency: php-mysql for package: zabbix-web-mysql-4.0.4-1.el7.noarch
--> Running transaction check
---> Package OpenIPMI-libs.x86_64 0:2.0.23-2.el7 will be installed
--> Processing Dependency: OpenIPMI-modalias = 2.0.23-2.el7 for package: OpenIPMI-libs-2.0.23-2.el7.x86_64
---> Package fping.x86_64 0:3.10-1.el7 will be installed
---> Package iksemel.x86_64 0:1.4-2.el7.centos will be installed
---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed
---> Package net-snmp-libs.x86_64 1:5.7.2-37.el7 will be installed
---> Package php-mysql.x86_64 0:5.4.16-46.el7 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-46.el7 for package: php-mysql-5.4.16-46.el7.x86_64
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-11.el7.x86_64
---> Package zabbix-web.noarch 0:4.0.4-1.el7 will be installed
--> Processing Dependency: php >= 5.4 for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: httpd for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: php-gd for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: php-mbstring for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: dejavu-sans-fonts for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: php-bcmath for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: php-ldap for package: zabbix-web-4.0.4-1.el7.noarch
--> Processing Dependency: php-xml for package: zabbix-web-4.0.4-1.el7.noarch
--> Running transaction check
---> Package OpenIPMI-modalias.x86_64 0:2.0.23-2.el7 will be installed
---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
---> Package httpd.x86_64 0:2.4.6-88.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-88.el7.centos for package: httpd-2.4.6-88.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-88.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-88.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-88.el7.centos.x86_64
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package php.x86_64 0:5.4.16-46.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: php-5.4.16-46.el7.x86_64
---> Package php-bcmath.x86_64 0:5.4.16-46.el7 will be installed
---> Package php-gd.x86_64 0:5.4.16-46.el7 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.16-46.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.4.16-46.el7.x86_64
---> Package php-ldap.x86_64 0:5.4.16-46.el7 will be installed
---> Package php-mbstring.x86_64 0:5.4.16-46.el7 will be installed
---> Package php-pdo.x86_64 0:5.4.16-46.el7 will be installed
---> Package php-xml.x86_64 0:5.4.16-46.el7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.16-46.el7.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: dejavu-fonts-common-2.33-6.el7.noarch
---> Package httpd-tools.x86_64 0:2.4.6-88.el7.centos will be installed
---> Package libX11.x86_64 0:1.6.5-2.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.5-2.el7 for package: libX11-1.6.5-2.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-2.el7.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-6.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
---> Package openssl-libs.x86_64 1:1.0.1e-42.el7.9 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-42.el7.9 for package: 1:openssl-1.0.1e-42.el7.9.x86_64
---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be an update
---> Package php-cli.x86_64 0:5.4.16-46.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-46.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-46.el7.x86_64
---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed
--> Running transaction check
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package libX11-common.noarch 0:1.6.5-2.el7 will be installed
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package openssl.x86_64 1:1.0.1e-42.el7.9 will be updated
---> Package openssl.x86_64 1:1.0.2k-16.el7 will be an update
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
 Package                               Arch                 Version                           Repository                          Size
=======================================================================================================================================
Installing:
 zabbix-agent                          x86_64               4.0.4-1.el7                       zabbix                             388 k
 zabbix-server-mysql                   x86_64               4.0.4-1.el7                       zabbix                             2.1 M
 zabbix-web-mysql                      noarch               4.0.4-1.el7                       zabbix                             8.0 k
Installing for dependencies:
 OpenIPMI-libs                         x86_64               2.0.23-2.el7                      base                               521 k
 OpenIPMI-modalias                     x86_64               2.0.23-2.el7                      base                                16 k
 apr                                   x86_64               1.4.8-3.el7_4.1                   base                               103 k
 apr-util                              x86_64               1.5.2-6.el7                       base                                92 k
 dejavu-fonts-common                   noarch               2.33-6.el7                        base                                64 k
 dejavu-sans-fonts                     noarch               2.33-6.el7                        base                               1.4 M
 fontpackages-filesystem               noarch               1.44-8.el7                        base                               9.9 k
 fping                                 x86_64               3.10-1.el7                        zabbix-non-supported                40 k
 httpd                                 x86_64               2.4.6-88.el7.centos               base                               2.7 M
 httpd-tools                           x86_64               2.4.6-88.el7.centos               base                                90 k
 iksemel                               x86_64               1.4-2.el7.centos                  zabbix-non-supported                49 k
 libX11                                x86_64               1.6.5-2.el7                       base                               606 k
 libX11-common                         noarch               1.6.5-2.el7                       base                               164 k
 libXau                                x86_64               1.0.8-2.1.el7                     base                                29 k
 libXpm                                x86_64               3.5.12-1.el7                      base                                55 k
 libevent                              x86_64               2.0.21-4.el7                      base                               214 k
 libjpeg-turbo                         x86_64               1.2.90-6.el7                      base                               134 k
 libpng                                x86_64               2:1.5.13-7.el7_2                  base                               213 k
 libtool-ltdl                          x86_64               2.4.2-22.el7_3                    base                                49 k
 libxcb                                x86_64               1.13-1.el7                        base                               214 k
 libxslt                               x86_64               1.1.28-5.el7                      base                               242 k
 libzip                                x86_64               0.10.1-8.el7                      base                                48 k
 mailcap                               noarch               2.1.41-2.el7                      base                                31 k
 net-snmp-libs                         x86_64               1:5.7.2-37.el7                    base                               749 k
 php                                   x86_64               5.4.16-46.el7                     base                               1.4 M
 php-bcmath                            x86_64               5.4.16-46.el7                     base                                58 k
 php-cli                               x86_64               5.4.16-46.el7                     base                               2.7 M
 php-common                            x86_64               5.4.16-46.el7                     base                               565 k
 php-gd                                x86_64               5.4.16-46.el7                     base                               128 k
 php-ldap                              x86_64               5.4.16-46.el7                     base                                53 k
 php-mbstring                          x86_64               5.4.16-46.el7                     base                               505 k
 php-mysql                             x86_64               5.4.16-46.el7                     base                               101 k
 php-pdo                               x86_64               5.4.16-46.el7                     base                                99 k
 php-xml                               x86_64               5.4.16-46.el7                     base                               126 k
 t1lib                                 x86_64               5.1.2-14.el7                      base                               166 k
 unixODBC                              x86_64               2.3.1-11.el7                      base                               413 k
 zabbix-web                            noarch               4.0.4-1.el7                       zabbix                             2.8 M
Updating for dependencies:
 openssl                               x86_64               1:1.0.2k-16.el7                   base                               493 k
 openssl-libs                          x86_64               1:1.0.2k-16.el7                   base                               1.2 M

Transaction Summary
=======================================================================================================================================
Install  3 Packages (+37 Dependent packages)
Upgrade             (  2 Dependent packages)

Total download size: 21 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/base/packages/OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm is not installed
(1/42): OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm                                                               |  16 kB  00:00:00     
apr-util-1.5.2-6.el7.x86_64.rp FAILED                                          
http://mirror.lzu.edu.cn/centos/7.6.1810/os/x86_64/Packages/apr-util-1.5.2-6.el7.x86_64.rpm: [Errno 14] curl#56 - "Recv failure: Connection reset by peer"
Trying other mirror.
(2/42): dejavu-fonts-common-2.33-6.el7.noarch.rpm                                                               |  64 kB  00:00:00     
(3/42): OpenIPMI-libs-2.0.23-2.el7.x86_64.rpm                                                                   | 521 kB  00:00:00     
(4/42): apr-1.4.8-3.el7_4.1.x86_64.rpm                                                                          | 103 kB  00:00:00     
(5/42): httpd-tools-2.4.6-88.el7.centos.x86_64.rpm                                                              |  90 kB  00:00:00     
(6/42): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                           | 9.9 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/fping-3.10-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Public key for fping-3.10-1.el7.x86_64.rpm is not installed
(7/42): fping-3.10-1.el7.x86_64.rpm                                                                             |  40 kB  00:00:00     
(8/42): libX11-common-1.6.5-2.el7.noarch.rpm                                                                    | 164 kB  00:00:00     
(9/42): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                         |  29 kB  00:00:00     
(10/42): libXpm-3.5.12-1.el7.x86_64.rpm                                                                         |  55 kB  00:00:00     
(11/42): iksemel-1.4-2.el7.centos.x86_64.rpm                                                                    |  49 kB  00:00:00     
(12/42): libevent-2.0.21-4.el7.x86_64.rpm                                                                       | 214 kB  00:00:00     
(13/42): libX11-1.6.5-2.el7.x86_64.rpm                                                                          | 606 kB  00:00:00     
(14/42): libpng-1.5.13-7.el7_2.x86_64.rpm                                                                       | 213 kB  00:00:00     
(15/42): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm                                                                 |  49 kB  00:00:00     
(16/42): libxcb-1.13-1.el7.x86_64.rpm                                                                           | 214 kB  00:00:00     
(17/42): libzip-0.10.1-8.el7.x86_64.rpm                                                                         |  48 kB  00:00:00     
(18/42): mailcap-2.1.41-2.el7.noarch.rpm                                                                        |  31 kB  00:00:00     
(19/42): libxslt-1.1.28-5.el7.x86_64.rpm                                                                        | 242 kB  00:00:00     
(20/42): net-snmp-libs-5.7.2-37.el7.x86_64.rpm                                                                  | 749 kB  00:00:00     
(21/42): openssl-1.0.2k-16.el7.x86_64.rpm                                                                       | 493 kB  00:00:00     
(22/42): openssl-libs-1.0.2k-16.el7.x86_64.rpm                                                                  | 1.2 MB  00:00:00     
(23/42): php-bcmath-5.4.16-46.el7.x86_64.rpm                                                                    |  58 kB  00:00:00     
(24/42): httpd-2.4.6-88.el7.centos.x86_64.rpm                                                                   | 2.7 MB  00:00:01     
(25/42): php-cli-5.4.16-46.el7.x86_64.rpm                                                                       | 2.7 MB  00:00:00     
(26/42): php-gd-5.4.16-46.el7.x86_64.rpm                                                                        | 128 kB  00:00:00     
(27/42): libjpeg-turbo-1.2.90-6.el7.x86_64.rpm                                                                  | 134 kB  00:00:01     
(28/42): php-ldap-5.4.16-46.el7.x86_64.rpm                                                                      |  53 kB  00:00:00     
(29/42): php-mbstring-5.4.16-46.el7.x86_64.rpm                                                                  | 505 kB  00:00:00     
(30/42): php-5.4.16-46.el7.x86_64.rpm                                                                           | 1.4 MB  00:00:00     
(31/42): php-mysql-5.4.16-46.el7.x86_64.rpm                                                                     | 101 kB  00:00:00     
(32/42): php-pdo-5.4.16-46.el7.x86_64.rpm                                                                       |  99 kB  00:00:00     
(33/42): php-xml-5.4.16-46.el7.x86_64.rpm                                                                       | 126 kB  00:00:00     
(34/42): t1lib-5.1.2-14.el7.x86_64.rpm                                                                          | 166 kB  00:00:00     
(35/42): php-common-5.4.16-46.el7.x86_64.rpm                                                                    | 565 kB  00:00:00     
(36/42): unixODBC-2.3.1-11.el7.x86_64.rpm                                                                       | 413 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-4.0.4-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Public key for zabbix-agent-4.0.4-1.el7.x86_64.rpm is not installed
(37/42): zabbix-agent-4.0.4-1.el7.x86_64.rpm                                                                    | 388 kB  00:00:00     
(38/42): zabbix-server-mysql-4.0.4-1.el7.x86_64.rpm                                                             | 2.1 MB  00:00:01     
(39/42): apr-util-1.5.2-6.el7.x86_64.rpm                                                                        |  92 kB  00:00:00     
(40/42): zabbix-web-mysql-4.0.4-1.el7.noarch.rpm                                                                | 8.0 kB  00:00:00     
(41/42): zabbix-web-4.0.4-1.el7.noarch.rpm                                                                      | 2.8 MB  00:00:01     
(42/42): dejavu-sans-fonts-2.33-6.el7.noarch.rpm                                                                | 1.4 MB  00:00:36     
---------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  587 kB/s |  21 MB  00:00:36     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
Importing GPG key 0x79EA5ED4:
 Userid     : "Zabbix SIA <packager@zabbix.com>"
 Fingerprint: fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4
 Package    : zabbix-release-4.0-1.el7.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Importing GPG key 0xA14FE591:
 Userid     : "Zabbix LLC <packager@zabbix.com>"
 Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
 Package    : zabbix-release-4.0-1.el7.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Updating   : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                1/44 
  Installing : apr-1.4.8-3.el7_4.1.x86_64                                                                                         2/44 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                        3/44 
  Installing : httpd-tools-2.4.6-88.el7.centos.x86_64                                                                             4/44 
  Installing : 1:net-snmp-libs-5.7.2-37.el7.x86_64                                                                                5/44 
  Installing : libevent-2.0.21-4.el7.x86_64                                                                                       6/44 
  Installing : libzip-0.10.1-8.el7.x86_64                                                                                         7/44 
  Installing : php-common-5.4.16-46.el7.x86_64                                                                                    8/44 
  Installing : php-ldap-5.4.16-46.el7.x86_64                                                                                      9/44 
  Installing : php-bcmath-5.4.16-46.el7.x86_64                                                                                   10/44 
  Installing : php-pdo-5.4.16-46.el7.x86_64                                                                                      11/44 
  Installing : php-mysql-5.4.16-46.el7.x86_64                                                                                    12/44 
  Installing : php-mbstring-5.4.16-46.el7.x86_64                                                                                 13/44 
  Installing : php-cli-5.4.16-46.el7.x86_64                                                                                      14/44 
  Installing : libXau-1.0.8-2.1.el7.x86_64                                                                                       15/44 
  Installing : libxcb-1.13-1.el7.x86_64                                                                                          16/44 
  Installing : iksemel-1.4-2.el7.centos.x86_64                                                                                   17/44 
  Installing : libX11-common-1.6.5-2.el7.noarch                                                                                  18/44 
  Installing : libX11-1.6.5-2.el7.x86_64                                                                                         19/44 
  Installing : libXpm-3.5.12-1.el7.x86_64                                                                                        20/44 
  Installing : t1lib-5.1.2-14.el7.x86_64                                                                                         21/44 
  Installing : libxslt-1.1.28-5.el7.x86_64                                                                                       22/44 
  Installing : php-xml-5.4.16-46.el7.x86_64                                                                                      23/44 
  Installing : libjpeg-turbo-1.2.90-6.el7.x86_64                                                                                 24/44 
  Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                25/44 
  Installing : unixODBC-2.3.1-11.el7.x86_64                                                                                      26/44 
  Installing : fontpackages-filesystem-1.44-8.el7.noarch                                                                         27/44 
  Installing : dejavu-fonts-common-2.33-6.el7.noarch                                                                             28/44 
  Installing : dejavu-sans-fonts-2.33-6.el7.noarch                                                                               29/44 
  Installing : OpenIPMI-modalias-2.0.23-2.el7.x86_64                                                                             30/44 
  Installing : OpenIPMI-libs-2.0.23-2.el7.x86_64                                                                                 31/44 
  Installing : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                    32/44 
  Installing : php-gd-5.4.16-46.el7.x86_64                                                                                       33/44 
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                       34/44 
  Installing : httpd-2.4.6-88.el7.centos.x86_64                                                                                  35/44 
  Installing : php-5.4.16-46.el7.x86_64                                                                                          36/44 
  Installing : zabbix-web-mysql-4.0.4-1.el7.noarch                                                                               37/44 
  Installing : zabbix-web-4.0.4-1.el7.noarch                                                                                     38/44 
  Installing : fping-3.10-1.el7.x86_64                                                                                           39/44 
  Installing : zabbix-server-mysql-4.0.4-1.el7.x86_64                                                                            40/44 
  Updating   : 1:openssl-1.0.2k-16.el7.x86_64                                                                                    41/44 
  Installing : zabbix-agent-4.0.4-1.el7.x86_64                                                                                   42/44 
  Cleanup    : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                  43/44 
  Cleanup    : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                             44/44 
sed: can't read /etc/sysconfig/ipmi: No such file or directory
  Verifying  : fping-3.10-1.el7.x86_64                                                                                            1/44 
  Verifying  : zabbix-server-mysql-4.0.4-1.el7.x86_64                                                                             2/44 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                        3/44 
  Verifying  : php-mysql-5.4.16-46.el7.x86_64                                                                                     4/44 
  Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                     5/44 
  Verifying  : OpenIPMI-modalias-2.0.23-2.el7.x86_64                                                                              6/44 
  Verifying  : php-xml-5.4.16-46.el7.x86_64                                                                                       7/44 
  Verifying  : php-ldap-5.4.16-46.el7.x86_64                                                                                      8/44 
  Verifying  : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                                9/44 
  Verifying  : 1:net-snmp-libs-5.7.2-37.el7.x86_64                                                                               10/44 
  Verifying  : OpenIPMI-libs-2.0.23-2.el7.x86_64                                                                                 11/44 
  Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                                                                         12/44 
  Verifying  : httpd-tools-2.4.6-88.el7.centos.x86_64                                                                            13/44 
  Verifying  : dejavu-fonts-common-2.33-6.el7.noarch                                                                             14/44 
  Verifying  : zabbix-web-4.0.4-1.el7.noarch                                                                                     15/44 
  Verifying  : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                16/44 
  Verifying  : libxcb-1.13-1.el7.x86_64                                                                                          17/44 
  Verifying  : libjpeg-turbo-1.2.90-6.el7.x86_64                                                                                 18/44 
  Verifying  : unixODBC-2.3.1-11.el7.x86_64                                                                                      19/44 
  Verifying  : libXpm-3.5.12-1.el7.x86_64                                                                                        20/44 
  Verifying  : 1:openssl-1.0.2k-16.el7.x86_64                                                                                    21/44 
  Verifying  : t1lib-5.1.2-14.el7.x86_64                                                                                         22/44 
  Verifying  : libxslt-1.1.28-5.el7.x86_64                                                                                       23/44 
  Verifying  : zabbix-web-mysql-4.0.4-1.el7.noarch                                                                               24/44 
  Verifying  : libevent-2.0.21-4.el7.x86_64                                                                                      25/44 
  Verifying  : php-bcmath-5.4.16-46.el7.x86_64                                                                                   26/44 
  Verifying  : php-pdo-5.4.16-46.el7.x86_64                                                                                      27/44 
  Verifying  : php-gd-5.4.16-46.el7.x86_64                                                                                       28/44 
  Verifying  : dejavu-sans-fonts-2.33-6.el7.noarch                                                                               29/44 
  Verifying  : php-mbstring-5.4.16-46.el7.x86_64                                                                                 30/44 
  Verifying  : httpd-2.4.6-88.el7.centos.x86_64                                                                                  31/44 
  Verifying  : libX11-1.6.5-2.el7.x86_64                                                                                         32/44 
  Verifying  : apr-1.4.8-3.el7_4.1.x86_64                                                                                        33/44 
  Verifying  : zabbix-agent-4.0.4-1.el7.x86_64                                                                                   34/44 
  Verifying  : libX11-common-1.6.5-2.el7.noarch                                                                                  35/44 
  Verifying  : iksemel-1.4-2.el7.centos.x86_64                                                                                   36/44 
  Verifying  : libXau-1.0.8-2.1.el7.x86_64                                                                                       37/44 
  Verifying  : php-cli-5.4.16-46.el7.x86_64                                                                                      38/44 
  Verifying  : libzip-0.10.1-8.el7.x86_64                                                                                        39/44 
  Verifying  : php-5.4.16-46.el7.x86_64                                                                                          40/44 
  Verifying  : php-common-5.4.16-46.el7.x86_64                                                                                   41/44 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                       42/44 
  Verifying  : 1:openssl-libs-1.0.1e-42.el7.9.x86_64                                                                             43/44 
  Verifying  : 1:openssl-1.0.1e-42.el7.9.x86_64                                                                                  44/44 

Installed:
  zabbix-agent.x86_64 0:4.0.4-1.el7        zabbix-server-mysql.x86_64 0:4.0.4-1.el7        zabbix-web-mysql.noarch 0:4.0.4-1.el7       

Dependency Installed:
  OpenIPMI-libs.x86_64 0:2.0.23-2.el7             OpenIPMI-modalias.x86_64 0:2.0.23-2.el7     apr.x86_64 0:1.4.8-3.el7_4.1             
  apr-util.x86_64 0:1.5.2-6.el7                   dejavu-fonts-common.noarch 0:2.33-6.el7     dejavu-sans-fonts.noarch 0:2.33-6.el7    
  fontpackages-filesystem.noarch 0:1.44-8.el7     fping.x86_64 0:3.10-1.el7                   httpd.x86_64 0:2.4.6-88.el7.centos       
  httpd-tools.x86_64 0:2.4.6-88.el7.centos        iksemel.x86_64 0:1.4-2.el7.centos           libX11.x86_64 0:1.6.5-2.el7              
  libX11-common.noarch 0:1.6.5-2.el7              libXau.x86_64 0:1.0.8-2.1.el7               libXpm.x86_64 0:3.5.12-1.el7             
  libevent.x86_64 0:2.0.21-4.el7                  libjpeg-turbo.x86_64 0:1.2.90-6.el7         libpng.x86_64 2:1.5.13-7.el7_2           
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3            libxcb.x86_64 0:1.13-1.el7                  libxslt.x86_64 0:1.1.28-5.el7            
  libzip.x86_64 0:0.10.1-8.el7                    mailcap.noarch 0:2.1.41-2.el7               net-snmp-libs.x86_64 1:5.7.2-37.el7      
  php.x86_64 0:5.4.16-46.el7                      php-bcmath.x86_64 0:5.4.16-46.el7           php-cli.x86_64 0:5.4.16-46.el7           
  php-common.x86_64 0:5.4.16-46.el7               php-gd.x86_64 0:5.4.16-46.el7               php-ldap.x86_64 0:5.4.16-46.el7          
  php-mbstring.x86_64 0:5.4.16-46.el7             php-mysql.x86_64 0:5.4.16-46.el7            php-pdo.x86_64 0:5.4.16-46.el7           
  php-xml.x86_64 0:5.4.16-46.el7                  t1lib.x86_64 0:5.1.2-14.el7                 unixODBC.x86_64 0:2.3.1-11.el7           
  zabbix-web.noarch 0:4.0.4-1.el7                

Dependency Updated:
  openssl.x86_64 1:1.0.2k-16.el7                                  openssl-libs.x86_64 1:1.0.2k-16.el7                                 

Complete!
[root@node101 ~]# 
[root@node101 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

4>.安装mysql数据库

[root@node101 ~]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.nwsuaf.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
 Package                      Arch                           Version                                Repository                    Size
=======================================================================================================================================
Installing:
 wget                         x86_64                         1.14-18.el7                            base                         547 k

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

Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7.x86_64.rpm                                                                                     | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-18.el7.x86_64                                                                                             1/1 
  Verifying  : wget-1.14-18.el7.x86_64                                                                                             1/1 

Installed:
  wget.x86_64 0:1.14-18.el7                                                                                                            

Complete!
[root@node101 ~]# 
[root@node101 ~]# yum -y install wget                                    #安装下载工具
[root@node101 ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
--2018-12-07 12:43:29--  http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://101.96.8.156/dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [following]
--2018-12-07 12:43:29--  http://101.96.8.156/dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Connecting to 101.96.8.156:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [following]
--2018-12-07 12:43:33--  https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm [following]
--2018-12-07 12:43:34--  https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.51.209.162
Connecting to repo.mysql.com (repo.mysql.com)|23.51.209.162|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6140 (6.0K) [application/x-redhat-package-manager]
Saving to: ‘mysql-community-release-el7-5.noarch.rpm’

100%[===========================================================================>] 6,140       --.-K/s   in 0s      

2018-12-07 12:43:34 (666 MB/s) - ‘mysql-community-release-el7-5.noarch.rpm’ saved [6140/6140]

[root@node101 ~]# 
[root@node101 ~]# ll
total 9621676
-rwxrwxrwx. 1 root root 1760430816 Dec  5 23:01 ambari-2.6.0.0-centos7.tar.gz
-rwxr-xr-x. 1 root root 7020369101 Dec  6 10:24 HDP-2.6.3.0-centos7-rpm.tar.gz
-rwxr-xr-x. 1 root root  880016614 Dec  6 10:24 HDP-UTILS-1.1.0.21-centos7.tar.gz
-rw-r--r--. 1 root root  191753373 Dec  5 15:32 jdk-8u191-linux-x64.tar.gz
-rw-r--r--  1 root root       6140 Nov 12  2015 mysql-community-release-el7-5.noarch.rpm
[root@node101 ~]# 
[root@node101 ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm      #下载mysql yum源
[root@node101 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm                   #安装mysql的yum源
[root@node101 ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.42-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.42-2.el7 for package: mysql-community-server-5.6.42-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.42-2.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.42-2.el7.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.42-2.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.42-2.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.42-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.42-2.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be obsoleted
---> Package mysql-community-libs.x86_64 0:5.6.42-2.el7 will be obsoleting
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================
 Package                            Arch              Version                     Repository                    Size
=====================================================================================================================
Installing:
 mysql-community-libs               x86_64            5.6.42-2.el7                mysql56-community            2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.44-2.el7.centos
 mysql-community-server             x86_64            5.6.42-2.el7                mysql56-community             59 M
Installing for dependencies:
 mysql-community-client             x86_64            5.6.42-2.el7                mysql56-community             20 M
 mysql-community-common             x86_64            5.6.42-2.el7                mysql56-community            257 k
 perl-Compress-Raw-Bzip2            x86_64            2.061-3.el7                 base                          32 k
 perl-Compress-Raw-Zlib             x86_64            1:2.061-4.el7               base                          57 k
 perl-DBI                           x86_64            1.627-4.el7                 base                         802 k
 perl-Data-Dumper                   x86_64            2.145-3.el7                 base                          47 k
 perl-IO-Compress                   noarch            2.061-2.el7                 base                         260 k
 perl-Net-Daemon                    noarch            0.48-5.el7                  base                          51 k
 perl-PlRPC                         noarch            0.2020-14.el7               base                          36 k

Transaction Summary
=====================================================================================================================
Install  2 Packages (+9 Dependent packages)

Total download size: 82 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.42-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.6.42-2.el7.x86_64.rpm is not installed
(1/11): mysql-community-common-5.6.42-2.el7.x86_64.rpm                                        | 257 kB  00:00:00     
(2/11): mysql-community-libs-5.6.42-2.el7.x86_64.rpm                                          | 2.0 MB  00:00:07     
(3/11): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                         |  57 kB  00:00:00     
(4/11): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                               |  47 kB  00:00:00     
(5/11): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                        |  32 kB  00:00:00     
(6/11): perl-IO-Compress-2.061-2.el7.noarch.rpm                                               | 260 kB  00:00:00     
(7/11): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                 |  51 kB  00:00:00     
(8/11): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                   |  36 kB  00:00:00     
(9/11): perl-DBI-1.627-4.el7.x86_64.rpm                                                       | 802 kB  00:00:03     
(10/11): mysql-community-client-5.6.42-2.el7.x86_64.rpm                                       |  20 MB  00:00:27     
(11/11): mysql-community-server-5.6.42-2.el7.x86_64.rpm                                       |  59 MB  00:01:27     
---------------------------------------------------------------------------------------------------------------------
Total                                                                                884 kB/s |  82 MB  00:01:35     
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql-community-release-el7-5.noarch (installed)
 From       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                              1/12 
  Installing : mysql-community-common-5.6.42-2.el7.x86_64                                                       2/12 
  Installing : mysql-community-libs-5.6.42-2.el7.x86_64                                                         3/12 
  Installing : mysql-community-client-5.6.42-2.el7.x86_64                                                       4/12 
  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                       5/12 
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                      6/12 
  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                              7/12 
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                8/12 
  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                  9/12 
  Installing : perl-DBI-1.627-4.el7.x86_64                                                                     10/12 
  Installing : mysql-community-server-5.6.42-2.el7.x86_64                                                      11/12 
  Erasing    : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                       12/12 
  Verifying  : mysql-community-libs-5.6.42-2.el7.x86_64                                                         1/12 
  Verifying  : mysql-community-common-5.6.42-2.el7.x86_64                                                       2/12 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                3/12 
  Verifying  : mysql-community-server-5.6.42-2.el7.x86_64                                                       4/12 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                              5/12 
  Verifying  : mysql-community-client-5.6.42-2.el7.x86_64                                                       6/12 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                              7/12 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                      8/12 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                      9/12 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                      10/12 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                 11/12 
  Verifying  : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                       12/12 

Installed:
  mysql-community-libs.x86_64 0:5.6.42-2.el7               mysql-community-server.x86_64 0:5.6.42-2.el7              

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.42-2.el7              mysql-community-common.x86_64 0:5.6.42-2.el7             
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7              perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7              
  perl-DBI.x86_64 0:1.627-4.el7                             perl-Data-Dumper.x86_64 0:2.145-3.el7                    
  perl-IO-Compress.noarch 0:2.061-2.el7                     perl-Net-Daemon.noarch 0:0.48-5.el7                      
  perl-PlRPC.noarch 0:0.2020-14.el7                        

Replaced:
  mariadb-libs.x86_64 1:5.5.44-2.el7.centos                                                                          

Complete!
[root@node101 ~]# 
[root@node101 ~]# yum -y install mysql-community-server                          #安装mysql
[root@node101 ~]# systemctl enable mysqld                                            
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mysqld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[root@node101 ~]# 
[root@node101 ~]# systemctl enable mysqld                                  #设置开机自启动
[root@node101 ~]# systemctl start mysqld 
[root@node101 ~]# 
[root@node101 ~]# systemctl start mysqld                                  #启动MySQL
[root@node101 ~]# systemctl status mysqld
● mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-12-07 13:08:13 CST; 1min 42s ago
  Process: 3542 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 3482 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 3541 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ├─3541 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─3708 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lo...

Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: /usr/bin/mysql_secure_installation
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: which will also give you the option of removing the test
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: databases and anonymous user created by default.  This is
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: strongly recommended for production servers.
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: See the manual for more instructions.
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: Please report any problems at http://bugs.mysql.com/
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysql-systemd-start[3482]: The latest information about MySQL is available on the web at
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysqld_safe[3541]: 181207 13:08:12 mysqld_safe Logging to '/var/log/mysqld.log'.
Dec 07 13:08:12 node101.yinzhengjie.org.cn mysqld_safe[3541]: 181207 13:08:12 mysqld_safe Starting mysqld daemon with database...mysql
Dec 07 13:08:13 node101.yinzhengjie.org.cn systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@node101 ~]# 
[root@node101 ~]# systemctl status mysqld                                #查看Mysqld的运行状态

5>.为MySQL设置管理员密码并创建初始数据库

[root@node101 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.6.43 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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> 
mysql> 
mysql> 
mysql> 
mysql> set password for 'root'@'localhost' = password('yinzhengjie');
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'172.30.1.10%' identified by 'yinzhengjie';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@node101 ~]# 
[root@node101 ~]# mysql -uroot -pyinzhengjie
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 5
Server version: 5.6.43 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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 utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

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

mysql> quit
Bye
[root@node101 ~]# 
[root@node101 ~]# 

6>.导入初始架构和数据。系统将提示您输入新创建的密码。

[root@node101 ~]# rpm -ql zabbix-server-mysql
/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
/usr/lib/systemd/system/zabbix-server.service
/usr/lib/tmpfiles.d/zabbix-server.conf
/usr/lib/zabbix/alertscripts
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_server_mysql
/usr/share/doc/zabbix-server-mysql-4.0.4
/usr/share/doc/zabbix-server-mysql-4.0.4/AUTHORS
/usr/share/doc/zabbix-server-mysql-4.0.4/COPYING
/usr/share/doc/zabbix-server-mysql-4.0.4/ChangeLog
/usr/share/doc/zabbix-server-mysql-4.0.4/NEWS
/usr/share/doc/zabbix-server-mysql-4.0.4/README
/usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz
/usr/share/man/man8/zabbix_server.8.gz
/var/log/zabbix
/var/run/zabbix
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:       #这个密码是你之前授权的用户时指定的,不建议大家在命令行输入,因为可以通过history命令查看到MySQL数据库的密码。
[root@node101 ~]# 
[root@node101 ~]# mysql -uroot -pyinzhengjie
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 7
Server version: 5.6.43 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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> 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
mysql> 
mysql> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| 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             |
| 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               |
| items                      |
| items_applications         |
| maintenance_tag            |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| mappings                   |
| media                      |
| media_type                 |
| 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               |
+----------------------------+
144 rows in set (0.01 sec)

mysql> quit
Bye
[root@node101 ~]# 
[root@node101 ~]# 
我们可以登录MySQL服务器查看zabbix数据库是否生成了相应的表结构([root@node101 ~]# mysql -uroot -pyinzhengjie)

7>.修改http的配置文件并启动服务(需要关闭防火墙)

[root@node101 ~]# 
[root@node101 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.`date +%F`
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# grep '#ServerName www.example.com:80' /etc/httpd/conf/httpd.conf
#ServerName www.example.com:80
[root@node101 ~]# 
[root@node101 ~]# sed -i 's@#ServerName www.example.com:80@ServerName 127.0.0.1:80@' /etc/httpd/conf/httpd.conf
[root@node101 ~]# 
[root@node101 ~]# grep '127.0.0.1:80' /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
[root@node101 ~]# 
[root@node101 ~]# sed -i 's@#ServerName www.example.com:80@ServerName 127.0.0.1:80@' /etc/httpd/conf/httpd.conf
[root@node101 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@node101 ~]# 
[root@node101 ~]# systemctl start httpd
[root@node101 ~]# 
[root@node101 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-02-14 07:24:58 PST; 4s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 12426 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─12426 /usr/sbin/httpd -DFOREGROUND
           ├─12427 /usr/sbin/httpd -DFOREGROUND
           ├─12428 /usr/sbin/httpd -DFOREGROUND
           ├─12429 /usr/sbin/httpd -DFOREGROUND
           ├─12430 /usr/sbin/httpd -DFOREGROUND
           └─12431 /usr/sbin/httpd -DFOREGROUND

Feb 14 07:24:58 node101.yinzhengjie.org.cn systemd[1]: Starting The Apache HTTP Server...
Feb 14 07:24:58 node101.yinzhengjie.org.cn systemd[1]: Started The Apache HTTP Server.
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# ss -ntl
State       Recv-Q Send-Q                      Local Address:Port                                     Peer Address:Port              
LISTEN      0      128                                     *:22                                                  *:*                  
LISTEN      0      100                             127.0.0.1:25                                                  *:*                  
LISTEN      0      80                                     :::3306                                               :::*                  
LISTEN      0      128                                    :::80                                                 :::*                  
LISTEN      0      128                                    :::22                                                 :::*                  
LISTEN      0      100                                   ::1:25                                                 :::*                  
[root@node101 ~]# 
[root@node101 ~]# systemctl start httpd                      #启动Web服务器
[root@node101 ~]# systemctl stop firewalld
[root@node101 ~]# 
[root@node101 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-02-14 07:26:29 PST; 42s ago
 Main PID: 766 (code=exited, status=0/SUCCESS)

Feb 14 06:04:09 node101.yinzhengjie.org.cn systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 14 06:04:11 node101.yinzhengjie.org.cn systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 14 07:26:28 node101.yinzhengjie.org.cn systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 14 07:26:29 node101.yinzhengjie.org.cn systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@node101 ~]# 
[root@node101 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@node101 ~]# 
[root@node101 ~]# systemctl stop firewalld                    #关闭防火墙

  启动服务后,然后我们就可以访问到zabbix的Web界面啦,如下,我们可以根据想到进行安装:

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

三.安装zabbix的Web前端

1>.根据向导,会出现以下界面

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

2>.修改zabbix的配置文件并重启http服务,上述的报错就会解决

[root@node101 ~]# ll /etc/httpd/conf.d/
total 24
-rw-r--r--. 1 root root 2926 Nov  4 17:47 autoindex.conf
-rw-r--r--. 1 root root  691 Oct 30 12:33 php.conf
-rw-r--r--. 1 root root  366 Nov  4 17:47 README
-rw-r--r--. 1 root root 1252 Oct 30 08:00 userdir.conf
-rw-r--r--. 1 root root  824 Oct 30 08:00 welcome.conf
-rw-r--r--. 1 root root  870 Feb 14 07:38 zabbix.conf
[root@node101 ~]# 
[root@node101 ~]# cat /etc/httpd/conf.d/zabbix.conf 
#
# Zabbix monitoring system php web frontend
#

Alias /zabbix /usr/share/zabbix

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted

    <IfModule mod_php5.c>
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai        #注意,我修改了这一行内容,我把时区改成了亚洲/上海
    </IfModule>
</Directory>

<Directory "/usr/share/zabbix/conf">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/app">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/local">
    Require all denied
</Directory>
[root@node101 ~]# 
[root@node101 ~]# 
修改zabbix的配置文件([root@node101 ~]# cat /etc/httpd/conf.d/zabbix.conf )
[root@node101 ~]# 
[root@node101 ~]# systemctl restart httpd
[root@node101 ~]# 
[root@node101 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-02-14 07:41:59 PST; 18s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 12565 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 12570 (httpd)
   Status: "Total requests: 3; Current requests/sec: 0.333; Current traffic: 4.6KB/sec"
   CGroup: /system.slice/httpd.service
           ├─12570 /usr/sbin/httpd -DFOREGROUND
           ├─12571 /usr/sbin/httpd -DFOREGROUND
           ├─12572 /usr/sbin/httpd -DFOREGROUND
           ├─12573 /usr/sbin/httpd -DFOREGROUND
           ├─12574 /usr/sbin/httpd -DFOREGROUND
           ├─12575 /usr/sbin/httpd -DFOREGROUND
           └─12576 /usr/sbin/httpd -DFOREGROUND

Feb 14 07:41:59 node101.yinzhengjie.org.cn systemd[1]: Starting The Apache HTTP Server...
Feb 14 07:41:59 node101.yinzhengjie.org.cn systemd[1]: Started The Apache HTTP Server.
[root@node101 ~]# 
[root@node101 ~]# ss -utl
Netid State      Recv-Q Send-Q                  Local Address:Port                                   Peer Address:Port                
udp   UNCONN     0      0                           127.0.0.1:323                                               *:*                    
udp   UNCONN     0      0                                 ::1:323                                              :::*                    
tcp   LISTEN     0      128                                 *:ssh                                               *:*                    
tcp   LISTEN     0      100                         127.0.0.1:smtp                                              *:*                    
tcp   LISTEN     0      80                                 :::mysql                                            :::*                    
tcp   LISTEN     0      128                                :::http                                             :::*                    
tcp   LISTEN     0      128                                :::ssh                                              :::*                    
tcp   LISTEN     0      100                               ::1:smtp                                             :::*                    
[root@node101 ~]# 
[root@node101 ~]# systemctl restart httpd

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

3>.配置数据库

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

4>.为zabbix服务器配置一个名称

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

5>.确认安装完毕

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

6>.点击完成(注意这个“/etc/zabbix/web/zabbix.conf.php”配置文件,当你需要迁移数据库时,就得修改该配置文件哟!)

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

7>.登录zabbix服务器

  默认的用户名和密码官方文档说明:https://www.zabbix.com/documentation/4.0/manual/quickstart/login

 运维监控-基于yum的方式部署Zabbix Server 4.0 版本

8>.登录成功

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

四.启动zabbix-server和zabbix-agent

1>.修改zabbix的配置文件

[root@node101 ~]# cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.`date +%F`
[root@node101 ~]# 
[root@node101 ~]# grep DBHost /etc/zabbix/zabbix_server.conf                    #这个是数据库的主机地址,默认是本机,咱们可以不修改。
### Option: DBHost
# DBHost=localhost
[root@node101 ~]# 
[root@node101 ~]# grep DBName /etc/zabbix/zabbix_server.conf | grep -v ^#             #修改zabbix的数据库
DBName=zabbix
[root@node101 ~]# 
[root@node101 ~]# grep 'DBUser' /etc/zabbix/zabbix_server.conf | grep -v ^#            #修改数据库的用户名
DBUser=zabbix
[root@node101 ~]# 
[root@node101 ~]# grep 'DBPassword' /etc/zabbix/zabbix_server.conf | grep -v ^#          #修改数据库的密码
DBPassword=yinzhengjie
[root@node101 ~]# 

2>.启动zabbix-server服务

[root@node101 ~]# systemctl start zabbix-server          #启动该服务,需要等待一段时间
[root@node101 ~]#
[root@node101 ~]# systemctl status zabbix-server         #查看该服务的状态
● zabbix-server.service - Zabbix Server
   Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-02-14 08:24:02 PST; 13s ago
  Process: 15995 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=1/FAILURE)
  Process: 16000 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
 Main PID: 16002 (zabbix_server)
   CGroup: /system.slice/zabbix-server.service
           ├─16002 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
           ├─16003 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]
           ├─16004 /usr/sbin/zabbix_server: alerter #1 started
           ├─16005 /usr/sbin/zabbix_server: alerter #2 started
           ├─16006 /usr/sbin/zabbix_server: alerter #3 started
           ├─16007 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
           ├─16008 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.000621 sec, idle 59 sec]
           ├─16009 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000489 sec, idle 5 sec]
           ├─16010 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000370 sec, idle 60 sec]
           ├─16011 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000024 sec, idle 1 sec]
           ├─16012 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.000030 sec, idle 1 sec]
           ├─16013 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000031 sec, idle 1 sec]
           ├─16014 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000021 sec, idle 1 sec]
           ├─16015 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000745 sec, idle 3 sec]
           ├─16016 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000047 sec, idle 5 sec]
           ├─16017 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000008 sec, idle 1 sec]
           ├─16018 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.000336 sec, idle 5 sec]
           ├─16019 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000027 sec, idle 1 sec]
           ├─16020 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000024 sec, idle 1 sec]
           ├─16021 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000032 sec, idle 1 sec]
           ├─16022 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000030 sec, idle 1 sec]
           ├─16023 /usr/sbin/zabbix_server: poller #5 [got 1 values in 0.000662 sec, idle 1 sec]
           ├─16024 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000006 sec, idle 5 sec]
           ├─16025 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000334 sec, waiting for connection]
           ├─16026 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
           ├─16027 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
           ├─16028 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
           ├─16029 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
           ├─16030 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000047 sec, idle 5 sec]
           ├─16031 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.010040 sec during 5.010134 sec]
           ├─16032 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 2 values, idle 5.006215 sec during 5.00636...
           ├─16033 /usr/sbin/zabbix_server: preprocessing worker #1 started
           ├─16034 /usr/sbin/zabbix_server: preprocessing worker #2 started
           └─16035 /usr/sbin/zabbix_server: preprocessing worker #3 started

Feb 14 08:24:02 node101.yinzhengjie.org.cn systemd[1]: Starting Zabbix Server...
Feb 14 08:24:02 node101.yinzhengjie.org.cn systemd[1]: PID file /run/zabbix/zabbix_server.pid not readable (yet?) after start.
Feb 14 08:24:02 node101.yinzhengjie.org.cn systemd[1]: Started Zabbix Server.
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# netstat -ntl | grep 10051      #查看服务的端口是否存在
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN     
tcp6       0      0 :::10051                :::*                    LISTEN     
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# 
[root@node101 ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@node101 ~]# 
[root@node101 ~]# systemctl start zabbix-server                #启动该服务,需要等待一段时间

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

3>.编辑zabbix-agent服务

[root@node101 ~]# cp /etc/zabbix/zabbix_agentd.conf  /etc/zabbix/zabbix_agentd.conf.`date +%F`
[root@node101 ~]# 
[root@node101 ~]# grep Server= /etc/zabbix/zabbix_agentd.conf |  grep -v ^#              #这里指定谁可以来这台agent获取数据
Server=127.0.0.1
[root@node101 ~]# 
[root@node101 ~]# grep ServerActive= /etc/zabbix/zabbix_agentd.conf |  grep -v ^#           #和上面的功能类似,这里可以指定多台服务器来本地取数据
ServerActive=127.0.0.1
[root@node101 ~]# 
[root@node101 ~]# grep Hostname /etc/zabbix/zabbix_agentd.conf |  grep -v ^#              #指定服务器的主机名,我们可以不指定,如果没有指定的话默认就会用系统的主机名称。
Hostname=Zabbix server
[root@node101 ~]# 

4>.启动zabbix-agent服务

[root@node101 ~]# systemctl start zabbix-agent
[root@node101 ~]# 
[root@node101 ~]# systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
   Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-02-14 08:20:57 PST; 22min ago
 Main PID: 15226 (zabbix_agentd)
   CGroup: /system.slice/zabbix-agent.service
           ├─15226 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
           ├─15227 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
           ├─15228 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
           ├─15229 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
           ├─15230 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
           └─15231 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Feb 14 08:20:57 node101.yinzhengjie.org.cn systemd[1]: Starting Zabbix Agent...
Feb 14 08:20:57 node101.yinzhengjie.org.cn systemd[1]: PID file /run/zabbix/zabbix_agentd.pid not readable (yet?) after start.
Feb 14 08:20:57 node101.yinzhengjie.org.cn systemd[1]: Started Zabbix Agent.
Feb 14 08:42:57 node101.yinzhengjie.org.cn systemd[1]: Started Zabbix Agent.
[root@node101 ~]# 
[root@node101 ~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@node101 ~]# 
[root@node101 ~]# ss -ntl | grep 10050
LISTEN     0      128          *:10050                    *:*                  
LISTEN     0      128         :::10050                   :::*                  
[root@node101 ~]# 
[root@node101 ~]# 

5>.查看zabbix的web界面

[root@node101 ~]# tail -10f /var/log/zabbix/zabbix_server.log 
 16035:20190214:082402.623 server #33 started [preprocessing worker #3]
 16034:20190214:082402.626 server #32 started [preprocessing worker #2]
 16033:20190214:082402.664 server #31 started [preprocessing worker #1]
 16023:20190214:082407.590 enabling Zabbix agent checks on host "Zabbix server": host became available
 16014:20190214:082442.610 item "Zabbix server:zabbix[process,ipmi poller,avg,busy]" became not supported: No "ipmi poller" processes started.
 16011:20190214:082443.611 item "Zabbix server:zabbix[process,java poller,avg,busy]" became not supported: No "java poller" processes started.
 16013:20190214:082448.616 item "Zabbix server:zabbix[process,ipmi manager,avg,busy]" became not supported: No "ipmi manager" processes started.
 16013:20190214:082448.616 item "Zabbix server:zabbix[process,snmp trapper,avg,busy]" became not supported: No "snmp trapper" processes started.
 16011:20190214:082449.617 item "Zabbix server:zabbix[process,vmware collector,avg,busy]" became not supported: No "vmware collector" processes started.
 16014:20190214:082456.627 item "Zabbix server:zabbix[vmware,buffer,pused]" became not supported: No "vmware collector" processes started.
[root@node101 ~]# tail -10f /var/log/zabbix/zabbix_server.log              #查看zabbix-server的日志

运维监控-基于yum的方式部署Zabbix Server 4.0 版本

相关推荐