系统:CentOS7.9最小化安装;升级软件补丁;关闭SELinux和防火墙。
1、安装Zabbix存储库
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
[root@zabbix-server ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm Retrieving https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm warning: /var/tmp/rpm-tmp.3WQXLy: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-5.0-1.el7 ################################# [100%] [root@zabbix-server ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base epel extras updates zabbix zabbix-non-supported Cleaning up list of fastest mirrors
2、安装Zabbix服务器和代理:yum install zabbix-server-mysql zabbix-agent2
[root@zabbix-server ~]# yum install zabbix-server-mysql zabbix-agent2 Loaded plugins: fastestmirror Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 2.9 kB 00:00:00 (1/9): base/7/x86_64/group_gz | 153 kB 00:00:00 (2/9): epel/x86_64/group_gz | 96 kB 00:00:00 (3/9): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (4/9): extras/7/x86_64/primary_db | 243 kB 00:00:00 (5/9): zabbix-non-supported/x86_64/primary_db | 3.7 kB 00:00:00 ......此处省略...... ---> Package OpenIPMI-modalias.x86_64 0:2.0.27-1.el7 will be installed --> Processing Dependency: OpenIPMI for package: OpenIPMI-modalias-2.0.27-1.el7.x86_64 --> Running transaction check ---> Package OpenIPMI.x86_64 0:2.0.27-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================== Installing: zabbix-agent2 x86_64 5.0.18-1.el7 zabbix 4.9 M zabbix-server-mysql x86_64 5.0.18-1.el7 zabbix 3.2 M Installing for dependencies: OpenIPMI x86_64 2.0.27-1.el7 base 243 k OpenIPMI-libs x86_64 2.0.27-1.el7 base 523 k OpenIPMI-modalias x86_64 2.0.27-1.el7 base 16 k fping x86_64 3.16-1.el7 zabbix-non-supported 44 k libevent x86_64 2.0.21-4.el7 base 214 k net-snmp-libs x86_64 1:5.7.2-49.el7_9.1 updates 751 k unixODBC x86_64 2.3.1-14.el7 base 413 k Transaction Summary ===================================================================================================================================================================== Install 2 Packages (+7 Dependent packages) Total download size: 10 M Installed size: 30 M Is this ok [y/d/N]: y Downloading packages: (1/9): OpenIPMI-2.0.27-1.el7.x86_64.rpm | 243 kB 00:00:00 (2/9): OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm | 16 kB 00:00:00 (3/9): OpenIPMI-libs-2.0.27-1.el7.x86_64.rpm | 523 kB 00:00:00 (4/9): libevent-2.0.21-4.el7.x86_64.rpm | 214 kB 00:00:00 (5/9): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00 (6/9): net-snmp-libs-5.7.2-49.el7_9.1.x86_64.rpm | 751 kB 00:00:00 warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/fping-3.16-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY2.3 MB 00:02:29 ETA Public key for fping-3.16-1.el7.x86_64.rpm is not installed (7/9): fping-3.16-1.el7.x86_64.rpm | 44 kB 00:00:02 warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-server-mysql-5.0.18-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEYMB 00:00:24 ETA Public key for zabbix-server-mysql-5.0.18-1.el7.x86_64.rpm is not installed (8/9): zabbix-server-mysql-5.0.18-1.el7.x86_64.rpm | 3.2 MB 00:01:38 (9/9): zabbix-agent2-5.0.18-1.el7.x86_64.rpm | 4.9 MB 00:02:39 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 65 kB/s | 10 MB 00:02:39 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-5.0-1.el7.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 Is this ok [y/N]: y 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-5.0-1.el7.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 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-49.el7_9.1.x86_64 1/9 Installing : OpenIPMI-libs-2.0.27-1.el7.x86_64 2/9 Installing : OpenIPMI-2.0.27-1.el7.x86_64 3/9 ......此处省略...... Verifying : fping-3.16-1.el7.x86_64 8/9 Verifying : OpenIPMI-modalias-2.0.27-1.el7.x86_64 9/9 Installed: zabbix-agent2.x86_64 0:5.0.18-1.el7 zabbix-server-mysql.x86_64 0:5.0.18-1.el7 Dependency Installed: OpenIPMI.x86_64 0:2.0.27-1.el7 OpenIPMI-libs.x86_64 0:2.0.27-1.el7 OpenIPMI-modalias.x86_64 0:2.0.27-1.el7 fping.x86_64 0:3.16-1.el7 libevent.x86_64 0:2.0.21-4.el7 net-snmp-libs.x86_64 1:5.7.2-49.el7_9.1 unixODBC.x86_64 0:2.3.1-14.el7 Complete!
3、安装Zabbix前端:
a)启用红帽软件集合:yum install centos-release-scl
[root@zabbix-server ~]# yum install centos-release-scl Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package centos-release-scl.noarch 0:2-3.el7.centos will be installed --> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-3.el7.centos.noarch --> Running transaction check ---> Package centos-release-scl-rh.noarch 0:2-3.el7.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================== Installing: centos-release-scl noarch 2-3.el7.centos extras 12 k Installing for dependencies: centos-release-scl-rh noarch 2-3.el7.centos extras 12 k Transaction Summary ===================================================================================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 24 k Installed size: 39 k Is this ok [y/d/N]: y Downloading packages: (1/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00 (2/2): centos-release-scl-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 84 kB/s | 24 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : centos-release-scl-rh-2-3.el7.centos.noarch 1/2 Installing : centos-release-scl-2-3.el7.centos.noarch 2/2 Verifying : centos-release-scl-2-3.el7.centos.noarch 1/2 Verifying : centos-release-scl-rh-2-3.el7.centos.noarch 2/2 Installed: centos-release-scl.noarch 0:2-3.el7.centos Dependency Installed: centos-release-scl-rh.noarch 0:2-3.el7.centos Complete!
b)启用zabbix-frontend存储库:yum install yum-utils && yum-config-manager –enable zabbix-frontend
[root@zabbix-server ~]# yum install yum-utils && yum-config-manager --enable zabbix-frontend Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-sclo-rh: mirrors.163.com * centos-sclo-sclo: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com centos-sclo-rh | 3.0 kB 00:00:00 centos-sclo-sclo | 3.0 kB 00:00:00 (1/2): centos-sclo-sclo/x86_64/primary_db | 300 kB 00:00:00 (2/2): centos-sclo-rh/x86_64/primary_db | 3.3 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed --> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch --> Running transaction check ---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed --> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch --> Running transaction check ---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================== Installing: yum-utils noarch 1.1.31-54.el7_8 base 122 k Installing for dependencies: python-chardet noarch 2.2.1-3.el7 base 227 k python-kitchen noarch 1.1.1-5.el7 base 267 k Transaction Summary ===================================================================================================================================================================== Install 1 Package (+2 Dependent packages) Total download size: 616 k Installed size: 2.8 M Is this ok [y/d/N]: y Downloading packages: (1/3): python-kitchen-1.1.1-5.el7.noarch.rpm | 267 kB 00:00:00 (2/3): python-chardet-2.2.1-3.el7.noarch.rpm | 227 kB 00:00:00 (3/3): yum-utils-1.1.31-54.el7_8.noarch.rpm | 122 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 1.8 MB/s | 616 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-chardet-2.2.1-3.el7.noarch 1/3 Installing : python-kitchen-1.1.1-5.el7.noarch 2/3 Installing : yum-utils-1.1.31-54.el7_8.noarch 3/3 Verifying : python-kitchen-1.1.1-5.el7.noarch 1/3 Verifying : yum-utils-1.1.31-54.el7_8.noarch 2/3 Verifying : python-chardet-2.2.1-3.el7.noarch 3/3 Installed: yum-utils.noarch 0:1.1.31-54.el7_8 Dependency Installed: python-chardet.noarch 0:2.2.1-3.el7 python-kitchen.noarch 0:1.1.1-5.el7 Complete! Loaded plugins: fastestmirror ======================================================================= repo: zabbix-frontend ======================================================================= [zabbix-frontend] async = True bandwidth = 0 base_persistdir = /var/lib/yum/repos/x86_64/7 baseurl = http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/frontend cache = 0 cachedir = /var/cache/yum/x86_64/7/zabbix-frontend check_config_file_age = True compare_providers_priority = 80 cost = 1000 deltarpm_metadata_percentage = 100 deltarpm_percentage = enabled = 1 enablegroups = True exclude = failovermethod = priority ftp_disable_epsv = False gpgcadir = /var/lib/yum/repos/x86_64/7/zabbix-frontend/gpgcadir gpgcakey = gpgcheck = True gpgdir = /var/lib/yum/repos/x86_64/7/zabbix-frontend/gpgdir gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 hdrdir = /var/cache/yum/x86_64/7/zabbix-frontend/headers http_caching = all includepkgs = ip_resolve = keepalive = True keepcache = False mddownloadpolicy = sqlite mdpolicy = group:small mediaid = metadata_expire = 21600 metadata_expire_filter = read-only:present metalink = minrate = 0 mirrorlist = mirrorlist_expire = 86400 name = Zabbix Official Repository frontend - x86_64 old_base_cache_dir = password = persistdir = /var/lib/yum/repos/x86_64/7/zabbix-frontend pkgdir = /var/cache/yum/x86_64/7/zabbix-frontend/packages proxy = False proxy_dict = proxy_password = proxy_username = repo_gpgcheck = False retries = 10 skip_if_unavailable = False ssl_check_cert_permissions = True sslcacert = sslclientcert = sslclientkey = sslverify = True throttle = 0 timeout = 30.0 ui_id = zabbix-frontend/x86_64 ui_repoid_vars = releasever, basearch username =
c)安装Zabbix前端包:yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
[root@zabbix-server ~]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-sclo-rh: mirrors.ustc.edu.cn * centos-sclo-sclo: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com zabbix | 2.9 kB 00:00:00 zabbix-frontend | 2.9 kB 00:00:00 zabbix-non-supported | 2.9 kB 00:00:00 zabbix-frontend/x86_64/primary_db | 41 kB 00:00:01 Resolving Dependencies --> Running transaction check ---> Package zabbix-nginx-conf-scl.noarch 0:5.0.18-1.el7 will be installed --> Processing Dependency: zabbix-web-deps-scl = 5.0.18-1.el7 for package: zabbix-nginx-conf-scl-5.0.18-1.el7.noarch --> Processing Dependency: rh-nginx116-nginx for package: zabbix-nginx-conf-scl-5.0.18-1.el7.noarch ---> Package zabbix-web-mysql-scl.noarch 0:5.0.18-1.el7 will be installed ......此处省略...... ---> Package rh-php72-php-process.x86_64 0:7.2.24-1.el7 will be installed ---> Package rh-php72-php-zip.x86_64 0:7.2.24-1.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-nginx-conf-scl noarch 5.0.18-1.el7 zabbix-frontend 16 k zabbix-web-mysql-scl noarch 5.0.18-1.el7 zabbix-frontend 14 k Installing for dependencies: audit-libs-python x86_64 2.8.5-4.el7 base 76 k checkpolicy x86_64 2.5-8.el7 base 295 k dejavu-fonts-common noarch 2.33-6.el7 base 64 k dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M ......此处省略...... rh-php72-runtime x86_64 1-2.el7 centos-sclo-rh 1.1 M scl-utils x86_64 20130529-19.el7 base 24 k setools-libs x86_64 3.3.8-4.el7 base 620 k zabbix-web noarch 5.0.18-1.el7 zabbix-frontend 3.2 M zabbix-web-deps-scl noarch 5.0.18-1.el7 zabbix-frontend 16 k Transaction Summary ===================================================================================================================================================================== Install 2 Packages (+39 Dependent packages) Total download size: 16 M Installed size: 62 M Is this ok [y/d/N]: y Downloading packages: (1/41): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00:00 (2/41): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00:00 (3/41): dejavu-fonts-common-2.33-6.el7.noarch.rpm | 64 kB 00:00:00 (4/41): fontconfig-2.13.0-4.3.el7.x86_64.rpm | 254 kB 00:00:00 ......此处省略...... (39/41): zabbix-web-deps-scl-5.0.18-1.el7.noarch.rpm | 16 kB 00:00:00 (40/41): zabbix-web-mysql-scl-5.0.18-1.el7.noarch.rpm | 14 kB 00:00:00 (41/41): zabbix-web-5.0.18-1.el7.noarch.rpm | 3.2 MB 00:01:08 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 237 kB/s | 16 MB 00:01:11 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo Importing GPG key 0xF2EE9D55: Userid : "CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <security@centos.org>" Fingerprint: c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55 Package : centos-release-scl-rh-2-3.el7.centos.noarch (@extras) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : scl-utils-20130529-19.el7.x86_64 1/41 Installing : fontpackages-filesystem-1.44-8.el7.noarch 2/41 Installing : dejavu-fonts-common-2.33-6.el7.noarch 3/41 ......此处省略...... Verifying : rh-php72-php-cli-7.2.24-1.el7.x86_64 39/41 Verifying : 1:rh-php72-php-pear-1.10.5-1.el7.noarch 40/41 Verifying : libcgroup-0.41-21.el7.x86_64 41/41 Installed: zabbix-nginx-conf-scl.noarch 0:5.0.18-1.el7 zabbix-web-mysql-scl.noarch 0:5.0.18-1.el7 Dependency Installed: audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 gd.x86_64 0:2.0.35-27.el7_9 libX11.x86_64 0:1.6.7-4.el7_9 libX11-common.noarch 0:1.6.7-4.el7_9 libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.12-1.el7 libcgroup.x86_64 0:0.41-21.el7 libsemanage-python.x86_64 0:2.5-14.el7 libwebp.x86_64 0:0.3.0-10.el7_9 libxcb.x86_64 0:1.13-1.el7 policycoreutils-python.x86_64 0:2.5-34.el7 python-IPy.noarch 0:0.75-6.el7 rh-nginx116-nginx.x86_64 1:1.16.1-6.el7 rh-nginx116-runtime.x86_64 0:1.16-1.el7 rh-php72.x86_64 0:1-2.el7 rh-php72-php-bcmath.x86_64 0:7.2.24-1.el7 rh-php72-php-cli.x86_64 0:7.2.24-1.el7 rh-php72-php-common.x86_64 0:7.2.24-1.el7 rh-php72-php-fpm.x86_64 0:7.2.24-1.el7 rh-php72-php-gd.x86_64 0:7.2.24-1.el7 rh-php72-php-json.x86_64 0:7.2.24-1.el7 rh-php72-php-ldap.x86_64 0:7.2.24-1.el7 rh-php72-php-mbstring.x86_64 0:7.2.24-1.el7 rh-php72-php-mysqlnd.x86_64 0:7.2.24-1.el7 rh-php72-php-pdo.x86_64 0:7.2.24-1.el7 rh-php72-php-pear.noarch 1:1.10.5-1.el7 rh-php72-php-process.x86_64 0:7.2.24-1.el7 rh-php72-php-xml.x86_64 0:7.2.24-1.el7 rh-php72-php-zip.x86_64 0:7.2.24-1.el7 rh-php72-runtime.x86_64 0:1-2.el7 scl-utils.x86_64 0:20130529-19.el7 setools-libs.x86_64 0:3.3.8-4.el7 zabbix-web.noarch 0:5.0.18-1.el7 zabbix-web-deps-scl.noarch 0:5.0.18-1.el7 Complete!
4、安装数据库并配置相关数据库
a)安装Mariadb数据库:yum install mariadb mariadb-server
[root@zabbix-server ~]# yum install mariadb mariadb-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-sclo-rh: mirrors.163.com * centos-sclo-sclo: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed ---> Package mariadb-server.x86_64 1:5.5.68-1.el7 will be installed --> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.68-1.el7.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.68-1.el7.x86_64 ......此处省略...... ---> 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 x86_64 1:5.5.68-1.el7 base 8.8 M mariadb-server x86_64 1:5.5.68-1.el7 base 11 M Installing for dependencies: libaio x86_64 0.3.109-13.el7 base 24 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-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 2 Packages (+8 Dependent packages) Total download size: 21 M Installed size: 110 M Is this ok [y/d/N]: y Downloading packages: (1/10): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00 (2/10): mariadb-server-5.5.68-1.el7.x86_64.rpm | 11 MB 00:00:01 (3/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00 ......此处省略...... Verifying : perl-PlRPC-0.2020-14.el7.noarch 9/10 Verifying : perl-IO-Compress-2.061-2.el7.noarch 10/10 Installed: mariadb.x86_64 1:5.5.68-1.el7 mariadb-server.x86_64 1:5.5.68-1.el7 Dependency Installed: libaio.x86_64 0:0.3.109-13.el7 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!
b)启动数据库并配置为自启动模式:systemctl start mariadb.service && systemctl enable mariadb.service
[root@zabbix-server ~]# systemctl start mariadb.service && systemctl enable mariadb.service Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@zabbix-server ~]# systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-12-20 23:15:12 CST; 12s ago Main PID: 17045 (mysqld_safe) CGroup: /system.slice/mariadb.service ├─17045 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─17210 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid... Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: MySQL manual for more instructions. Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: Please report any problems at http://mariadb.org/jira Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: The latest information about MariaDB is available at http://mariadb.org/. Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: You can find additional information about the MySQL part at: Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: http://dev.mysql.com Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: Consider joining MariaDB's strong and vibrant community: Dec 20 23:15:10 zabbix-server mariadb-prepare-db-dir[16961]: https://mariadb.org/get-involved/ Dec 20 23:15:10 zabbix-server mysqld_safe[17045]: 211220 23:15:10 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. Dec 20 23:15:10 zabbix-server mysqld_safe[17045]: 211220 23:15:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Dec 20 23:15:12 zabbix-server systemd[1]: Started MariaDB database server.
c)创建Zabbix数据库:
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;
flush privileges;
[root@zabbix-server ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.68-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'; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> quit Bye
d)导入Zabbix数据:zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
e)配置zabbix服务端配置文件:vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
f)配置Zabbix前端Nginx:vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
listen 80;
server_name 192.168.26.51; #此处一般为配置域名,我这以IP地址演示;
g)配置Zabbix前端PHP:vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai
5、启动Zabbix服务端和客户端并加入自启动
systemctl restart zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm
[root@zabbix-server ~]# systemctl restart zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm [root@zabbix-server ~]# systemctl enable zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service. Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service. Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service. Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
6、访问Web界面安装并配置
a)Welcome:Next step即可
b)Check of pre-requisites:检测配置项目,全部OK后Next step即可;
c)Configure DB connection:数据库连接配置,按需配置无误后Next step即可;
d)Zabbix server details:服务器信息,按需定义Name(也可留空)后Next step即可;
e)Pre-installation summary:安装信息汇总,无误后Next step即可;
f)Install:安装,完成后提示相关配置文件已创建保存后Finish结束;
g)登录:默认账户Admin 默认密码zabbix