Zabbix4.x 安装
1. 安装¶
IP地址 | 角色 | 主机名 |
---|---|---|
192.168.5.100 | zabbix server,agent | master01 |
zabbix server 和agent在一个机器上
安装脚本
-------------------------- zabbix server ---------------------------------------------- # centos 7 添加阿里云镜像 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum install epel-release # 安装常用的开发组件 yum groups install "Development Tools" yum groups info "Development Tools" #增加Zabbix镜像源 rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm # 关闭SElinux 和防火墙 systemctl stop firewalld.service systemctl disable firewalld.service # 安装Zabbix Server和Frontend yum install zabbix-server-mysql -y yum install zabbix-web-mysql -y # 安装MySQL yum install mariadb-server -y systemctl start mariadb.service systemctl status mariadb.service mysql_secure_installation # 创建数据库 mysql -uroot -p create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; # 导入数据结构 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@findsec123 zabbix # 配置Zabbix Server vim /etc/zabbix/zabbix_server.conf cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.ori systemctl restart zabbix-server.service systemctl status zabbix-server.service more /var/log/zabbix/zabbix_server.log 配置Zabbix frontend cp /etc/php.ini /etc/php.ini.ori vim /etc/php.ini max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 max_input_vars = 10000 always_populate_raw_post_data = -1 date.timezone = Asia/Shanghai 启动httpd systemctl start httpd.service systemctl status httpd.service http://192.168.5.100/zabbix/setup.php 默认账号和密码 账号: Admin 密码: zabbix -------------------------- zabbix agent ---------------------------------------------- 安装Zabbix Agent yum install zabbix-agent systemctl start zabbix-agent.service
zabbix server详细步骤
[root@master01 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2019-06-06 11:02:28-- http://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 61.155.190.120, 61.155.190.115, 61.177.173.224, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|61.155.190.120|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2523 (2.5K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’ 100%[=================================================================>] 2,523 --.-K/s in 0s 2019-06-06 11:02:28 (163 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523] [root@master01 ~]# yum install epel-release Loaded plugins: fastestmirror Determining fastest mirrors epel/x86_64/metalink | 8.1 kB 00:00:00 * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.al iyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not re solve host: mirrors.cloud.aliyuncs.com; Unknown error"Trying other mirror. base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 5.3 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): extras/7/x86_64/primary_db | 200 kB 00:00:00 (2/4): updates/7/x86_64/primary_db | 5.0 MB 00:00:00 (3/4): epel/x86_64/updateinfo | 974 kB 00:01:30 (4/4): epel/x86_64/primary_db | 6.7 MB 00:03:28 Package epel-release-7-11.noarch already installed and latest version Nothing to do [root@master01 ~]# rpm -ivh 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.Jvo2C3: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-4.0-1.el7 ################################# [100%] [root@master01 ~]# systemctl stop firewalld.service [root@master01 ~]# systemctl disable firewalld.service [root@master01 ~]# yum install zabbix-server-mysql Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 951 B 00:00:00 zabbix/x86_64/primary_db | 72 kB 00:00:00 zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00 zabbix-non-supported 4/4 Resolving Dependencies --> Running transaction check ---> Package zabbix-server-mysql.x86_64 0:4.0.9-2.el7 will be installed --> Processing Dependency: fping for package: zabbix-server-mysql-4.0.9-2.el7.x86_64 --> Processing Dependency: libiksemel.so.3()(64bit) for package: zabbix-server-mysql-4.0.9-2.el7.x86_64 --> Processing Dependency: libOpenIPMIposix.so.0()(64bit) for package: zabbix-server-mysql-4.0.9-2.el7.x86_64 --> Processing Dependency: libOpenIPMI.so.0()(64bit) for package: zabbix-server-mysql-4.0.9-2.el7.x86_64 --> 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-4.el7 will be installed ---> Package iksemel.x86_64 0:1.4-2.el7.centos will be installed --> Processing Dependency: libgnutls.so.28(GNUTLS_1_4)(64bit) for package: iksemel-1.4-2.el7.centos.x86_64 --> Processing Dependency: libgnutls.so.28()(64bit) for package: iksemel-1.4-2.el7.centos.x86_64 --> Running transaction check ---> Package OpenIPMI-modalias.x86_64 0:2.0.23-2.el7 will be installed ---> Package gnutls.x86_64 0:3.3.29-9.el7_6 will be installed --> Processing Dependency: trousers >= 0.3.11.2 for package: gnutls-3.3.29-9.el7_6.x86_64 --> Processing Dependency: libnettle.so.4()(64bit) for package: gnutls-3.3.29-9.el7_6.x86_64 --> Processing Dependency: libhogweed.so.2()(64bit) for package: gnutls-3.3.29-9.el7_6.x86_64 --> Running transaction check ---> Package nettle.x86_64 0:2.7.1-8.el7 will be installed ---> Package trousers.x86_64 0:0.3.14-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================ Installing: zabbix-server-mysql x86_64 4.0.9-2.el7 zabbix 2.1 M 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 fping x86_64 3.10-4.el7 epel 46 k gnutls x86_64 3.3.29-9.el7_6 updates 680 k iksemel x86_64 1.4-2.el7.centos zabbix-non-supported 49 k nettle x86_64 2.7.1-8.el7 base 327 k trousers x86_64 0.3.14-2.el7 base 289 k Transaction Summary ============================================================================================================================================================================ Install 1 Package (+7 Dependent packages) Total download size: 4.0 M Installed size: 10 M Is this ok [y/d/N]: y Downloading packages: (1/8): OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm | 16 kB 00:00:00 (2/8): fping-3.10-4.el7.x86_64.rpm | 46 kB 00:00:00 (3/8): nettle-2.7.1-8.el7.x86_64.rpm | 327 kB 00:00:00 (4/8): OpenIPMI-libs-2.0.23-2.el7.x86_64.rpm | 521 kB 00:00:00 (5/8): trousers-0.3.14-2.el7.x86_64.rpm | 289 kB 00:00:00 warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/iksemel-1.4-2.el7.centos.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY.2 MB 00:00:08 ETA Public key for iksemel-1.4-2.el7.centos.x86_64.rpm is not installed (6/8): iksemel-1.4-2.el7.centos.x86_64.rpm | 49 kB 00:00:00 (7/8): gnutls-3.3.29-9.el7_6.x86_64.rpm | 680 kB 00:00:05 zabbix-server-mysql-4.0.9-2.el FAILED =========================== ] 379 B/s | 1.9 MB 01:35:56 ETA http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-server-mysql-4.0.9-2.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-ser ver-mysql-4.0.9-2.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')Trying other mirror. warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-server-mysql-4.0.9-2.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEYs | 4.0 MB 00:00:00 ETA Public key for zabbix-server-mysql-4.0.9-2.el7.x86_64.rpm is not installed (8/8): zabbix-server-mysql-4.0.9-2.el7.x86_64.rpm | 2.1 MB 00:00:04 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 103 kB/s | 4.0 MB 00:00:39 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 Is this ok [y/N]: y 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 Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : fping-3.10-4.el7.x86_64 1/8 Installing : nettle-2.7.1-8.el7.x86_64 2/8 Installing : OpenIPMI-modalias-2.0.23-2.el7.x86_64 3/8 Installing : OpenIPMI-libs-2.0.23-2.el7.x86_64 4/8 Installing : trousers-0.3.14-2.el7.x86_64 5/8 Installing : gnutls-3.3.29-9.el7_6.x86_64 6/8 Installing : iksemel-1.4-2.el7.centos.x86_64 7/8 Installing : zabbix-server-mysql-4.0.9-2.el7.x86_64 8/8 sed: can't read /etc/sysconfig/ipmi: No such file or directory Verifying : trousers-0.3.14-2.el7.x86_64 1/8 Verifying : OpenIPMI-libs-2.0.23-2.el7.x86_64 2/8 Verifying : OpenIPMI-modalias-2.0.23-2.el7.x86_64 3/8 Verifying : iksemel-1.4-2.el7.centos.x86_64 4/8 Verifying : zabbix-server-mysql-4.0.9-2.el7.x86_64 5/8 Verifying : nettle-2.7.1-8.el7.x86_64 6/8 Verifying : fping-3.10-4.el7.x86_64 7/8 Verifying : gnutls-3.3.29-9.el7_6.x86_64 8/8 Installed: zabbix-server-mysql.x86_64 0:4.0.9-2.el7 Dependency Installed: OpenIPMI-libs.x86_64 0:2.0.23-2.el7 OpenIPMI-modalias.x86_64 0:2.0.23-2.el7 fping.x86_64 0:3.10-4.el7 gnutls.x86_64 0:3.3.29-9.el7_6 iksemel.x86_64 0:1.4-2.el7.centos nettle.x86_64 0:2.7.1-8.el7 trousers.x86_64 0:0.3.14-2.el7 Complete! [root@master01 ~]# yum install zabbix-web-mysql -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package zabbix-web-mysql.noarch 0:4.0.9-2.el7 will be installed --> Processing Dependency: zabbix-web = 4.0.9-2.el7 for package: zabbix-web-mysql-4.0.9-2.el7.noarch --> Processing Dependency: php-mysql for package: zabbix-web-mysql-4.0.9-2.el7.noarch --> Running transaction check ---> 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 zabbix-web.noarch 0:4.0.9-2.el7 will be installed --> Processing Dependency: php >= 5.4 for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: httpd for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: php-gd for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: php-mbstring for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: php-bcmath for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: php-ldap for package: zabbix-web-4.0.9-2.el7.noarch --> Processing Dependency: php-xml for package: zabbix-web-4.0.9-2.el7.noarch --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-89.el7.centos will be installed --> Processing Dependency: httpd-tools = 2.4.6-89.el7.centos for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-89.el7.centos.x86_64 ---> 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 ---> 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: libt1.so.5()(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 --> 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 httpd-tools.x86_64 0:2.4.6-89.el7.centos will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed ---> 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 libzip.x86_64 0:0.10.1-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Installing: zabbix-web-mysql noarch 4.0.9-2.el7 zabbix 8.4 k Installing for dependencies: 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 httpd x86_64 2.4.6-89.el7.centos updates 2.7 M httpd-tools x86_64 2.4.6-89.el7.centos updates 90 k libzip x86_64 0.10.1-8.el7 base 48 k mailcap noarch 2.1.41-2.el7 base 31 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 zabbix-web noarch 4.0.9-2.el7 zabbix 2.8 M Transaction Summary =========================================================================================================== Install 1 Package (+18 Dependent packages) Total download size: 12 M Installed size: 46 M Downloading packages: (1/19): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00 (2/19): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:00:00 (3/19): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00 (4/19): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00 (5/19): httpd-tools-2.4.6-89.el7.centos.x86_64.rpm | 90 kB 00:00:00 (6/19): httpd-2.4.6-89.el7.centos.x86_64.rpm | 2.7 MB 00:00:00 (7/19): php-bcmath-5.4.16-46.el7.x86_64.rpm | 58 kB 00:00:00 (8/19): php-5.4.16-46.el7.x86_64.rpm | 1.4 MB 00:00:00 (9/19): php-common-5.4.16-46.el7.x86_64.rpm | 565 kB 00:00:00 (10/19): php-gd-5.4.16-46.el7.x86_64.rpm | 128 kB 00:00:00 (11/19): php-ldap-5.4.16-46.el7.x86_64.rpm | 53 kB 00:00:00 (12/19): php-cli-5.4.16-46.el7.x86_64.rpm | 2.7 MB 00:00:00 (13/19): php-mbstring-5.4.16-46.el7.x86_64.rpm | 505 kB 00:00:00 (14/19): php-mysql-5.4.16-46.el7.x86_64.rpm | 101 kB 00:00:00 (15/19): php-pdo-5.4.16-46.el7.x86_64.rpm | 99 kB 00:00:00 (16/19): php-xml-5.4.16-46.el7.x86_64.rpm | 126 kB 00:00:00 (17/19): t1lib-5.1.2-14.el7.x86_64.rpm | 166 kB 00:00:00 (18/19): zabbix-web-mysql-4.0.9-2.el7.noarch.rpm | 8.4 kB 00:00:00 (19/19): zabbix-web-4.0.9-2.el7.noarch.rpm | 2.8 MB 00:00:04 ----------------------------------------------------------------------------------------------------------- Total 2.0 MB/s | 12 MB 00:00:05 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : apr-1.4.8-3.el7_4.1.x86_64 1/19 Installing : apr-util-1.5.2-6.el7.x86_64 2/19 Installing : httpd-tools-2.4.6-89.el7.centos.x86_64 3/19 Installing : libzip-0.10.1-8.el7.x86_64 4/19 Installing : php-common-5.4.16-46.el7.x86_64 5/19 Installing : php-cli-5.4.16-46.el7.x86_64 6/19 Installing : php-pdo-5.4.16-46.el7.x86_64 7/19 Installing : php-mysql-5.4.16-46.el7.x86_64 8/19 Installing : php-mbstring-5.4.16-46.el7.x86_64 9/19 Installing : php-xml-5.4.16-46.el7.x86_64 10/19 Installing : php-bcmath-5.4.16-46.el7.x86_64 11/19 Installing : php-ldap-5.4.16-46.el7.x86_64 12/19 Installing : mailcap-2.1.41-2.el7.noarch 13/19 Installing : httpd-2.4.6-89.el7.centos.x86_64 14/19 Installing : php-5.4.16-46.el7.x86_64 15/19 Installing : t1lib-5.1.2-14.el7.x86_64 16/19 Installing : php-gd-5.4.16-46.el7.x86_64 17/19 Installing : zabbix-web-mysql-4.0.9-2.el7.noarch 18/19 Installing : zabbix-web-4.0.9-2.el7.noarch 19/19 Verifying : httpd-tools-2.4.6-89.el7.centos.x86_64 1/19 Verifying : zabbix-web-4.0.9-2.el7.noarch 2/19 Verifying : t1lib-5.1.2-14.el7.x86_64 3/19 Verifying : mailcap-2.1.41-2.el7.noarch 4/19 Verifying : php-cli-5.4.16-46.el7.x86_64 5/19 Verifying : zabbix-web-mysql-4.0.9-2.el7.noarch 6/19 Verifying : php-mysql-5.4.16-46.el7.x86_64 7/19 Verifying : php-pdo-5.4.16-46.el7.x86_64 8/19 Verifying : php-gd-5.4.16-46.el7.x86_64 9/19 Verifying : php-mbstring-5.4.16-46.el7.x86_64 10/19 Verifying : apr-util-1.5.2-6.el7.x86_64 11/19 Verifying : libzip-0.10.1-8.el7.x86_64 12/19 Verifying : httpd-2.4.6-89.el7.centos.x86_64 13/19 Verifying : php-5.4.16-46.el7.x86_64 14/19 Verifying : php-common-5.4.16-46.el7.x86_64 15/19 Verifying : php-xml-5.4.16-46.el7.x86_64 16/19 Verifying : apr-1.4.8-3.el7_4.1.x86_64 17/19 Verifying : php-bcmath-5.4.16-46.el7.x86_64 18/19 Verifying : php-ldap-5.4.16-46.el7.x86_64 19/19 Installed: zabbix-web-mysql.noarch 0:4.0.9-2.el7 Dependency Installed: apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd.x86_64 0:2.4.6-89.el7.centos httpd-tools.x86_64 0:2.4.6-89.el7.centos libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.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 zabbix-web.noarch 0:4.0.9-2.el7 Complete! [root@master01 ~]# yum install mariadb-server -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package mariadb-server.x86_64 1:5.5.60-1.el7_5 will be installed --> Processing Dependency: mariadb(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-server-5.5.60-1.el7_5.x86_64 --> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.60-1.el7_5.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.60-1.el7_5.x86_64 --> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.60-1.el7_5.x86_64 --> Running transaction check ---> Package mariadb.x86_64 1:5.5.60-1.el7_5 will be installed ---> Package perl-DBD-MySQL.x86_64 0:4.023-6.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 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: mariadb-server x86_64 1:5.5.60-1.el7_5 base 11 M Installing for dependencies: mariadb x86_64 1:5.5.60-1.el7_5 base 8.9 M 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-DBD-MySQL x86_64 4.023-6.el7 base 140 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 1 Package (+8 Dependent packages) Total download size: 21 M Installed size: 110 M Downloading packages: (1/9): mariadb-server-5.5.60-1.el7_5.x86_64.rpm | 11 MB 00:00:01 (2/9): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00 (3/9): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00 (4/9): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00 (5/9): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00 (6/9): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00 (7/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00 (8/9): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00 (9/9): mariadb-5.5.60-1.el7_5.x86_64.rpm | 8.9 MB 00:00:02 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 8.5 MB/s | 21 MB 00:00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/9 Installing : 1:mariadb-5.5.60-1.el7_5.x86_64 2/9 Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/9 Installing : perl-IO-Compress-2.061-2.el7.noarch 4/9 Installing : perl-Net-Daemon-0.48-5.el7.noarch 5/9 Installing : perl-PlRPC-0.2020-14.el7.noarch 6/9 Installing : perl-DBI-1.627-4.el7.x86_64 7/9 Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 8/9 Installing : 1:mariadb-server-5.5.60-1.el7_5.x86_64 9/9 Verifying : 1:mariadb-server-5.5.60-1.el7_5.x86_64 1/9 Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/9 Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 3/9 Verifying : perl-IO-Compress-2.061-2.el7.noarch 4/9 Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 5/9 Verifying : 1:mariadb-5.5.60-1.el7_5.x86_64 6/9 Verifying : perl-DBI-1.627-4.el7.x86_64 7/9 Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 8/9 Verifying : perl-PlRPC-0.2020-14.el7.noarch 9/9 Installed: mariadb-server.x86_64 1:5.5.60-1.el7_5 Dependency Installed: mariadb.x86_64 1:5.5.60-1.el7_5 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.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 Complete! [root@master01 ~]# systemctl start mariadb.service [root@master01 ~]# systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2019-06-06 11:16:08 CST; 1s ago Process: 25228 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 25140 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS) Main PID: 25227 (mysqld_safe) Tasks: 20 Memory: 101.7M CGroup: /system.slice/mariadb.service ├─25227 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─25389 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/... Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: MySQL manual for more instructions. Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: Please report any problems at http://mariadb.org/jira Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: The latest information about MariaDB is available at http://mariadb.org/. Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: You can find additional information about the MySQL part at: Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: http://dev.mysql.com Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: Consider joining MariaDB's strong and vibrant community: Jun 06 11:16:05 master01 mariadb-prepare-db-dir[25140]: https://mariadb.org/get-involved/ Jun 06 11:16:05 master01 mysqld_safe[25227]: 190606 11:16:05 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. Jun 06 11:16:05 master01 mysqld_safe[25227]: 190606 11:16:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Jun 06 11:16:08 master01 systemd[1]: Started MariaDB database server. 初始化mysql [root@master01 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] n ... skipping. By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! [root@master01 ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 7 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]> Bye [root@master01 ~]# [root@master01 ~]# MariaDB [(none)]> -bash: syntax error near unexpected token `(' [root@master01 ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@findsec123 zabbix 检查表是否导入OK [root@master01 ~]# !mysql mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]> use zabbix; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [zabbix]> show tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery | | application_prototype | | application_template | | applications | | auditlog | | auditlog_details | | autoreg_host | | conditions | | config | | 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.00 sec) 表初始化OK了。 [root@master01 ~]# cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.ori [root@master01 ~]# vim /etc/zabbix/zabbix_server.conf [root@master01 ~]# diff /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.ori 91c91 < DBHost=localhost --- > # DBHost=localhost 124c124 < DBPassword=zabbix@findsec123 --- > # DBPassword= [root@master01 ~]# systemctl restart zabbix-server.service [root@master01 ~]# systemctl status zabbix-server.service ● zabbix-server.service - Zabbix Server Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2019-06-06 11:30:41 CST; 5s ago Process: 28063 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS) Main PID: 28065 (zabbix_server) Tasks: 34 Memory: 22.7M CGroup: /system.slice/zabbix-server.service ├─28065 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf ├─28070 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes] ├─28071 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes] ├─28072 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.001545 s... ├─28074 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000859 sec, idle 5 sec] ├─28076 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000958 sec, idle 60 se... ├─28077 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.00004... ├─28079 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.00004... ├─28081 /usr/sbin/zabbix_server: history syncer #3 [processed 1 values, 1 triggers in 0.03489... ├─28083 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.00004... ├─28084 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.001678 sec, idle ... ├─28086 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000044 s... ├─28087 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000041 sec, idle 1 sec]... ├─28088 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.001321 sec, idle 5 se... ├─28089 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000045 sec, idle 1 sec] ├─28090 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000045 sec, idle 1 sec] ├─28092 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000053 sec, idle 1 sec] ├─28093 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000045 sec, idle 1 sec] ├─28094 /usr/sbin/zabbix_server: poller #5 [got 1 values in 0.000180 sec, idle 1 sec] ├─28095 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000055 sec, idle 5 ... ├─28096 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for conn... ├─28097 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for conn... ├─28098 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for conn... ├─28099 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for conn... ├─28100 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for conn... ├─28101 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000036 sec, idle 5 sec] ├─28102 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.009757 sec... ├─28103 /usr/sbin/zabbix_server: alerter #1 started ├─28104 /usr/sbin/zabbix_server: alerter #2 started ├─28106 /usr/sbin/zabbix_server: alerter #3 started ├─28107 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 5 values, idle... ├─28108 /usr/sbin/zabbix_server: preprocessing worker #1 started ├─28109 /usr/sbin/zabbix_server: preprocessing worker #2 started └─28110 /usr/sbin/zabbix_server: preprocessing worker #3 started Jun 06 11:30:41 master01 systemd[1]: Starting Zabbix Server... Jun 06 11:30:41 master01 systemd[1]: Started Zabbix Server. 修改php文件 [root@master01 ~]# cp /etc/php.ini /etc/php.ini.ori [root@master01 ~]# vim /etc/php.ini [root@master01 ~]# diff /etc/php.ini /etc/php.ini.ori 394c394 < max_input_time = 300 --- > max_input_time = 60 401c401 < max_input_vars = 10000 --- > ; max_input_vars = 1000 672c672 < post_max_size = 16M --- > post_max_size = 8M 698c698 < always_populate_raw_post_data = -1 --- > ;always_populate_raw_post_data = On 878c878 < date.timezone = Asia/Shanghai --- > ;date.timezone =
2. web界面¶
命令安装,配置好以后,开始登陆web端设置。







