ZABBIX安装简要说明

蓝色为你需要注意下的,红色基本为你需要输入的命令行

cat部分会进行VIM编辑 重点部分也用颜色标识了。

  1. 先安装zabbix

  2. 安装数据库mysql

  3. 导入zabbix 数据库初始文件。

  4. 配置相关文件,和启动相关服务。

ps:改了php相关文件,一定要重启httpd。


[root@zabbix-server cache]# cat /etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

[root@zabbix-server cache]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

Retrieving http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

warning: /var/tmp/rpm-tmp.AYeSQ4: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:zabbix-release-3.2-1.el7         ################################# [100%]

[root@zabbix-server cache]# yum install zabbix-server-mysql zabbix-web-mysql

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.zju.edu.cn

 * extras: mirrors.163.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package zabbix-server-mysql.x86_64 0:3.2.1-1.el7 will be installed

--> Processing Dependency: fping for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

--> Processing Dependency: libiksemel.so.3()(64bit) for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

--> Processing Dependency: libnetsnmp.so.31()(64bit) for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

--> Processing Dependency: libOpenIPMIposix.so.0()(64bit) for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

--> Processing Dependency: libodbc.so.2()(64bit) for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

--> Processing Dependency: libOpenIPMI.so.0()(64bit) for package: zabbix-server-mysql-3.2.1-1.el7.x86_64

---> Package zabbix-web-mysql.noarch 0:3.2.1-1.el7 will be installed

--> Processing Dependency: zabbix-web = 3.2.1-1.el7 for package: zabbix-web-mysql-3.2.1-1.el7.noarch

--> Processing Dependency: php-mysql for package: zabbix-web-mysql-3.2.1-1.el7.noarch

--> Running transaction check

---> Package OpenIPMI-libs.x86_64 0:2.0.19-11.el7 will be installed

--> Processing Dependency: OpenIPMI-modalias = 2.0.19-11.el7 for package: OpenIPMI-libs-2.0.19-11.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 net-snmp-libs.x86_64 1:5.7.2-24.el7_2.1 will be installed

---> Package php-mysql.x86_64 0:5.4.16-36.3.el7_2 will be installed

--> Processing Dependency: php-pdo(x86-64) = 5.4.16-36.3.el7_2 for package: php-mysql-5.4.16-36.3.el7_2.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:3.2.1-1.el7 will be installed

--> Processing Dependency: php >= 5.4 for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: php-gd for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: php-mbstring for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: dejavu-sans-fonts for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: php-bcmath for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: httpd for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: php-ldap for package: zabbix-web-3.2.1-1.el7.noarch

--> Processing Dependency: php-xml for package: zabbix-web-3.2.1-1.el7.noarch

--> Running transaction check

---> Package OpenIPMI-modalias.x86_64 0:2.0.19-11.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-40.el7.centos.4 will be installed

--> Processing Dependency: httpd-tools = 2.4.6-40.el7.centos.4 for package: httpd-2.4.6-40.el7.centos.4.x86_64

--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.centos.4.x86_64

---> Package libtool-ltdl.x86_64 0:2.4.2-21.el7_2 will be installed

---> Package php.x86_64 0:5.4.16-36.3.el7_2 will be installed

--> Processing Dependency: php-common(x86-64) = 5.4.16-36.3.el7_2 for package: php-5.4.16-36.3.el7_2.x86_64

--> Processing Dependency: php-cli(x86-64) = 5.4.16-36.3.el7_2 for package: php-5.4.16-36.3.el7_2.x86_64

---> Package php-bcmath.x86_64 0:5.4.16-36.3.el7_2 will be installed

---> Package php-gd.x86_64 0:5.4.16-36.3.el7_2 will be installed

--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: php-gd-5.4.16-36.3.el7_2.x86_64

--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-36.3.el7_2.x86_64

--> Processing Dependency: libpng15.so.15()(64bit) for package: php-gd-5.4.16-36.3.el7_2.x86_64

--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.16-36.3.el7_2.x86_64

--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.4.16-36.3.el7_2.x86_64

---> Package php-ldap.x86_64 0:5.4.16-36.3.el7_2 will be installed

---> Package php-mbstring.x86_64 0:5.4.16-36.3.el7_2 will be installed

---> Package php-pdo.x86_64 0:5.4.16-36.3.el7_2 will be installed

---> Package php-xml.x86_64 0:5.4.16-36.3.el7_2 will be installed

--> Running transaction check

---> 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-40.el7.centos.4 will be installed

---> Package libX11.x86_64 0:1.6.3-2.el7 will be installed

--> Processing Dependency: libX11-common >= 1.6.3-2.el7 for package: libX11-1.6.3-2.el7.x86_64

--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.3-2.el7.x86_64

---> Package libXpm.x86_64 0:3.5.11-3.el7 will be installed

---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed

---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed

---> Package php-cli.x86_64 0:5.4.16-36.3.el7_2 will be installed

---> Package php-common.x86_64 0:5.4.16-36.3.el7_2 will be installed

--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-36.3.el7_2.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.3-2.el7 will be installed

---> Package libxcb.x86_64 0:1.11-4.el7 will be installed

--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.11-4.el7.x86_64

---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed

--> 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-server-mysql                   x86_64               3.2.1-1.el7                         zabbix                             1.8 M

 zabbix-web-mysql                      noarch               3.2.1-1.el7                         zabbix                             5.1 k

Installing for dependencies:

 OpenIPMI-libs                         x86_64               2.0.19-11.el7                       base                               501 k

 OpenIPMI-modalias                     x86_64               2.0.19-11.el7                       base                                15 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-40.el7.centos.4               updates                            2.7 M

 httpd-tools                           x86_64               2.4.6-40.el7.centos.4               updates                             83 k

 iksemel                               x86_64               1.4-2.el7.centos                    zabbix-non-supported                49 k

 libX11                                x86_64               1.6.3-2.el7                         base                               605 k

 libX11-common                         noarch               1.6.3-2.el7                         base                               162 k

 libXau                                x86_64               1.0.8-2.1.el7                       base                                29 k

 libXpm                                x86_64               3.5.11-3.el7                        base                                54 k

 libpng                                x86_64               2:1.5.13-7.el7_2                    updates                            213 k

 libtool-ltdl                          x86_64               2.4.2-21.el7_2                      updates                             49 k

 libxcb                                x86_64               1.11-4.el7                          base                               189 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-24.el7_2.1                  updates                            747 k

 php                                   x86_64               5.4.16-36.3.el7_2                   updates                            1.4 M

 php-bcmath                            x86_64               5.4.16-36.3.el7_2                   updates                             56 k

 php-cli                               x86_64               5.4.16-36.3.el7_2                   updates                            2.7 M

 php-common                            x86_64               5.4.16-36.3.el7_2                   updates                            563 k

 php-gd                                x86_64               5.4.16-36.3.el7_2                   updates                            126 k

 php-ldap                              x86_64               5.4.16-36.3.el7_2                   updates                             51 k

 php-mbstring                          x86_64               5.4.16-36.3.el7_2                   updates                            504 k

 php-mysql                             x86_64               5.4.16-36.3.el7_2                   updates                            100 k

 php-pdo                               x86_64               5.4.16-36.3.el7_2                   updates                             97 k

 php-xml                               x86_64               5.4.16-36.3.el7_2                   updates                            124 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               3.2.1-1.el7                         zabbix                             3.6 M

 

Transaction Summary

=========================================================================================================================================

Install  2 Packages (+32 Dependent packages)

 

Total size: 19 M

Installed size: 80 M

Is this ok [y/d/N]: y

Downloading packages:

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

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-3.2-1.el7.noarch (installed)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

Is this ok [y/N]: y

warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-web-3.2.1-1.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY

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-3.2-1.el7.noarch (installed)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Installing : 1:net-snmp-libs-5.7.2-24.el7_2.1.x86_64                                                                              1/34

  Installing : libzip-0.10.1-8.el7.x86_64                                                                                           2/34

  Installing : php-common-5.4.16-36.3.el7_2.x86_64                                                                                  3/34

  Installing : php-pdo-5.4.16-36.3.el7_2.x86_64                                                                                     4/34

  Installing : php-mysql-5.4.16-36.3.el7_2.x86_64                                                                                   5/34

  Installing : php-ldap-5.4.16-36.3.el7_2.x86_64                                                                                    6/34

  Installing : php-xml-5.4.16-36.3.el7_2.x86_64                                                                                     7/34

  Installing : php-cli-5.4.16-36.3.el7_2.x86_64                                                                                     8/34

  Installing : php-mbstring-5.4.16-36.3.el7_2.x86_64                                                                                9/34

  Installing : php-bcmath-5.4.16-36.3.el7_2.x86_64                                                                                 10/34

  Installing : httpd-tools-2.4.6-40.el7.centos.4.x86_64                                                                            11/34

  Installing : libXau-1.0.8-2.1.el7.x86_64                                                                                         12/34

  Installing : libxcb-1.11-4.el7.x86_64                                                                                            13/34

  Installing : libtool-ltdl-2.4.2-21.el7_2.x86_64                                                                                  14/34

  Installing : unixODBC-2.3.1-11.el7.x86_64                                                                                        15/34

  Installing : OpenIPMI-modalias-2.0.19-11.el7.x86_64                                                                              16/34

  Installing : OpenIPMI-libs-2.0.19-11.el7.x86_64                                                                                  17/34

  Installing : fontpackages-filesystem-1.44-8.el7.noarch                                                                           18/34

  Installing : dejavu-fonts-common-2.33-6.el7.noarch                                                                               19/34

  Installing : dejavu-sans-fonts-2.33-6.el7.noarch                                                                                 20/34

  Installing : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                      21/34

  Installing : iksemel-1.4-2.el7.centos.x86_64                                                                                     22/34

  Installing : mailcap-2.1.41-2.el7.noarch                                                                                         23/34

  Installing : httpd-2.4.6-40.el7.centos.4.x86_64                                                                                  24/34

  Installing : php-5.4.16-36.3.el7_2.x86_64                                                                                        25/34

  Installing : libX11-common-1.6.3-2.el7.noarch                                                                                    26/34

  Installing : libX11-1.6.3-2.el7.x86_64                                                                                           27/34

  Installing : t1lib-5.1.2-14.el7.x86_64                                                                                           28/34

  Installing : libXpm-3.5.11-3.el7.x86_64                                                                                          29/34

  Installing : php-gd-5.4.16-36.3.el7_2.x86_64                                                                                     30/34

  Installing : zabbix-web-mysql-3.2.1-1.el7.noarch                                                                                 31/34

  Installing : zabbix-web-3.2.1-1.el7.noarch                                                                                       32/34

  Installing : fping-3.10-1.el7.x86_64                                                                                             33/34

  Installing : zabbix-server-mysql-3.2.1-1.el7.x86_64                                                                              34/34

  Verifying  : fping-3.10-1.el7.x86_64                                                                                              1/34

  Verifying  : libX11-common-1.6.3-2.el7.noarch                                                                                     2/34

  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                          3/34

  Verifying  : iksemel-1.4-2.el7.centos.x86_64                                                                                      4/34

  Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                                                                                       5/34

  Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                                                                            6/34

  Verifying  : httpd-2.4.6-40.el7.centos.4.x86_64                                                                                   7/34

  Verifying  : OpenIPMI-libs-2.0.19-11.el7.x86_64                                                                                   8/34

  Verifying  : zabbix-web-3.2.1-1.el7.noarch                                                                                        9/34

  Verifying  : php-common-5.4.16-36.3.el7_2.x86_64                                                                                 10/34

  Verifying  : php-pdo-5.4.16-36.3.el7_2.x86_64                                                                                    11/34

  Verifying  : libX11-1.6.3-2.el7.x86_64                                                                                           12/34

  Verifying  : dejavu-fonts-common-2.33-6.el7.noarch                                                                               13/34

  Verifying  : t1lib-5.1.2-14.el7.x86_64                                                                                           14/34

  Verifying  : php-mysql-5.4.16-36.3.el7_2.x86_64                                                                                  15/34

  Verifying  : OpenIPMI-modalias-2.0.19-11.el7.x86_64                                                                              16/34

  Verifying  : zabbix-web-mysql-3.2.1-1.el7.noarch                                                                                 17/34

  Verifying  : php-ldap-5.4.16-36.3.el7_2.x86_64                                                                                   18/34

  Verifying  : zabbix-server-mysql-3.2.1-1.el7.x86_64                                                                              19/34

  Verifying  : php-xml-5.4.16-36.3.el7_2.x86_64                                                                                    20/34

  Verifying  : libtool-ltdl-2.4.2-21.el7_2.x86_64                                                                                  21/34

  Verifying  : php-5.4.16-36.3.el7_2.x86_64                                                                                        22/34

  Verifying  : unixODBC-2.3.1-11.el7.x86_64                                                                                        23/34

  Verifying  : php-cli-5.4.16-36.3.el7_2.x86_64                                                                                    24/34

  Verifying  : libXpm-3.5.11-3.el7.x86_64                                                                                          25/34

  Verifying  : dejavu-sans-fonts-2.33-6.el7.noarch                                                                                 26/34

  Verifying  : libXau-1.0.8-2.1.el7.x86_64                                                                                         27/34

  Verifying  : httpd-tools-2.4.6-40.el7.centos.4.x86_64                                                                            28/34

  Verifying  : php-gd-5.4.16-36.3.el7_2.x86_64                                                                                     29/34

  Verifying  : php-mbstring-5.4.16-36.3.el7_2.x86_64                                                                               30/34

  Verifying  : php-bcmath-5.4.16-36.3.el7_2.x86_64                                                                                 31/34

  Verifying  : libzip-0.10.1-8.el7.x86_64                                                                                          32/34

  Verifying  : 1:net-snmp-libs-5.7.2-24.el7_2.1.x86_64                                                                             33/34

  Verifying  : libxcb-1.11-4.el7.x86_64                                                                                            34/34

 

Installed:

  zabbix-server-mysql.x86_64 0:3.2.1-1.el7                             zabbix-web-mysql.noarch 0:3.2.1-1.el7                           

 

Dependency Installed:

  OpenIPMI-libs.x86_64 0:2.0.19-11.el7        OpenIPMI-modalias.x86_64 0:2.0.19-11.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-40.el7.centos.4        httpd-tools.x86_64 0:2.4.6-40.el7.centos.4      iksemel.x86_64 0:1.4-2.el7.centos         

  libX11.x86_64 0:1.6.3-2.el7                 libX11-common.noarch 0:1.6.3-2.el7              libXau.x86_64 0:1.0.8-2.1.el7             

  libXpm.x86_64 0:3.5.11-3.el7                libpng.x86_64 2:1.5.13-7.el7_2                  libtool-ltdl.x86_64 0:2.4.2-21.el7_2      

  libxcb.x86_64 0:1.11-4.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-24.el7_2.1     php.x86_64 0:5.4.16-36.3.el7_2                  php-bcmath.x86_64 0:5.4.16-36.3.el7_2     

  php-cli.x86_64 0:5.4.16-36.3.el7_2          php-common.x86_64 0:5.4.16-36.3.el7_2           php-gd.x86_64 0:5.4.16-36.3.el7_2         

  php-ldap.x86_64 0:5.4.16-36.3.el7_2         php-mbstring.x86_64 0:5.4.16-36.3.el7_2         php-mysql.x86_64 0:5.4.16-36.3.el7_2      

  php-pdo.x86_64 0:5.4.16-36.3.el7_2          php-xml.x86_64 0:5.4.16-36.3.el7_2              t1lib.x86_64 0:5.1.2-14.el7               

  unixODBC.x86_64 0:2.3.1-11.el7              zabbix-web.noarch 0:3.2.1-1.el7               

 

Complete!

>>尝试进入数据库,发现没有安装,下面就是安装和解压zabbix的步骤

[root@zabbix-server cache]# mysql -uroot -p

-bash: mysql: command not found

[root@zabbix-server cache]# mysqld -uroot -p

-bash: mysqld: command not found

[root@zabbix-server cache]#

[root@zabbix-server cache]#

[root@zabbix-server cache]#

[root@zabbix-server cache]#

[root@zabbix-server cache]# yum install wget

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.zju.edu.cn

 * extras: mirrors.163.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package wget.x86_64 0:1.14-10.el7_0.1 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

=========================================================================================================================================

 Package                      Arch                           Version                                  Repository                    Size

=========================================================================================================================================

Installing:

 wget                         x86_64                         1.14-10.el7_0.1                          base                         545 k

 

Transaction Summary

=========================================================================================================================================

Install  1 Package

 

Total size: 545 k

Installed size: 2.0 M

Is this ok [y/d/N]: y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : wget-1.14-10.el7_0.1.x86_64                                                                                           1/1

  Verifying  : wget-1.14-10.el7_0.1.x86_64                                                                                           1/1

 

Installed:

  wget.x86_64 0:1.14-10.el7_0.1                                                                                                         

 

Complete!

>>添加mysql源

[root@zabbix-server cache]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

--2016-12-01 06:27:17--  http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Resolving repo.mysql.com (repo.mysql.com)... 23.49.6.178

Connecting to repo.mysql.com (repo.mysql.com)|23.49.6.178|:80... 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       4.13KB/s   in 1.5s  

 

2016-12-01 06:27:24 (4.13 KB/s) - ‘mysql-community-release-el7-5.noarch.rpm’ saved [6140/6140]

 >>确认包

[root@zabbix-server cache]# ls

httpd  ldconfig  man  mysql-community-release-el7-5.noarch.rpm  yum 

[root@zabbix-server cache]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-release-el7-5    ################################# [100%]

[root@zabbix-server cache]# yum install mysql-community-server

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.zju.edu.cn

 * extras: mirrors.163.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:5.6.34-2.el7 will be installed

--> Processing Dependency: mysql-community-common(x86-64) = 5.6.34-2.el7 for package: mysql-community-server-5.6.34-2.el7.x86_64

--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.34-2.el7.x86_64

--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.34-2.el7.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.6.34-2.el7 will be installed

--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.34-2.el7.x86_64

---> Package mysql-community-common.x86_64 0:5.6.34-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

--> 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.34-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.34-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.34-2.el7                     mysql56-community                  59 M

Installing for dependencies:

 mysql-community-client                  x86_64                 5.6.34-2.el7                     mysql56-community                  19 M

 mysql-community-common                  x86_64                 5.6.34-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-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 (+8 Dependent packages)

 

Total size: 82 M

Is this ok [y/d/N]: y

Downloading packages:

warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-server-5.6.34-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

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

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Installing : mysql-community-common-5.6.34-2.el7.x86_64                                                                           1/11

  Installing : mysql-community-libs-5.6.34-2.el7.x86_64                                                                             2/11

  Installing : mysql-community-client-5.6.34-2.el7.x86_64                                                                           3/11

  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                           4/11

  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                          5/11

  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                                  6/11

  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                                    7/11

  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                                      8/11

  Installing : perl-DBI-1.627-4.el7.x86_64                                                                                          9/11

  Installing : mysql-community-server-5.6.34-2.el7.x86_64                                                                          10/11

  Erasing    : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                           11/11

  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                    1/11

  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                  2/11

  Verifying  : mysql-community-server-5.6.34-2.el7.x86_64                                                                           3/11

  Verifying  : mysql-community-client-5.6.34-2.el7.x86_64                                                                           4/11

  Verifying  : mysql-community-libs-5.6.34-2.el7.x86_64                                                                             5/11

  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                          6/11

  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                          7/11

  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                           8/11

  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                      9/11

  Verifying  : mysql-community-common-5.6.34-2.el7.x86_64                                                                          10/11

  Verifying  : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                           11/11

 

Installed:

  mysql-community-libs.x86_64 0:5.6.34-2.el7                         mysql-community-server.x86_64 0:5.6.34-2.el7                       

 

Dependency Installed:

  mysql-community-client.x86_64 0:5.6.34-2.el7 mysql-community-common.x86_64 0:5.6.34-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-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@zabbix-server cache]# systemctl enable mysqld

[root@zabbix-server cache]# systemctl start mysqld

>>默认貌似是进不了数据库的,于是我干脆直接初始化数据库

[root@zabbix-server cache]# mysql_secure_installation

 

 

 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

 

In order to log into MySQL to secure it, we'll need the current

password for the root user.  If you've just installed MySQL, 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 MySQL

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 MySQL installation has an anonymous user, allowing anyone

to log into MySQL 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, MySQL 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...

ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist

 ... Failed!  Not critical, keep moving...

 - 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!

 

 

 

 

All done!  If you've completed all of the above steps, your MySQL

installation should now be secure.

 

Thanks for using MySQL!

 

 

Cleaning up...

[root@zabbix-server cache]# mysql -uroot -p

Enter password: 输入你设置的密码

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 13

Server version: 5.6.34 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, 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)

 >>这里设置了数据库的密码也是后面web中需要用的。

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

Query OK, 0 rows affected (0.00 sec)

 

mysql> quit;

Bye

>>导入数据库

[root@zabbix-server cache]# cd /usr/share/doc/zabbix-server-mysql-3.2.1/

[root@zabbix-server zabbix-server-mysql-3.2.1]# ls

AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README

[root@zabbix-server zabbix-server-mysql-3.2.1]# zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uzabbix -p zabbix

Enter password:

ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)

[root@zabbix-server zabbix-server-mysql-3.2.1]# zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uzabbix -p zabbix

Enter password:

[root@zabbix-server zabbix-server-mysql-3.2.1]# systemctl start zabbix-server

>>以下为VIM需要变更的地方,注释的都删除即可。

[root@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/zabbix/zabbix_server.conf | grep DBHost

### Option: DBHost

#DBHost=localhost

[root@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/zabbix/zabbix_server.conf | grep DBNam

### Option: DBName

# DBName=

DBName=zabbix

[root@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/zabbix/zabbix_server.conf | grep DBUser

#        For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.

### Option: DBUser

# DBUser=

DBUser=zabbix

[root@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/zabbix/zabbix_server.conf | grep DBPassword

#        For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.

### Option: DBPassword

#DBPassword=

[root@zabbix-server zabbix-server-mysql-3.2.1]# vim /etc/zabbix/zabbix_server.conf

[root@zabbix-server zabbix-server-mysql-3.2.1]# systemctl start zabbix-server

[root@zabbix-server zabbix-server-mysql-3.2.1]# 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@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/php.ini | grep date.timezone

; http://php.net/date.timezone

;date.timezone =

[root@zabbix-server zabbix-server-mysql-3.2.1]# vim /etc/php.ini

[root@zabbix-server zabbix-server-mysql-3.2.1]# cat /etc/php.ini | grep date.timezone

; http://php.net/date.timezone

date.timezone = Asia/Shanghai

[root@zabbix-server zabbix-server-mysql-3.2.1]# systemctl start httpd

[root@zabbix-server zabbix-server-mysql-3.2.1]#  systemctl enable httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@zabbix-server zabbix-server-mysql-3.2.1]# systemctl stop firewalld

[root@zabbix-server zabbix-server-mysql-3.2.1]# systemctl restart httpd

 

图片什么的我就不上传了,基本就是你设置中的密码  

初始化配置中 所有项都必须通过,改了配置一定要重启httpd