關閉selinux和firewalld
關閉selinux開機自啟
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #改成disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
關閉selinux
[root@localhost ~]# setenforce 0
檢查selinux狀態
[root@localhost ~]# getenforce
Permissive
關閉firewalld并且關閉開機自啟
[root@localhost ~]# systemctl disable --now firewalld
檢查firewalld狀態
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
3月 31 17:10:35 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
3月 31 17:10:35 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'beyond-scope' is not supported by the kerne...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type...ime.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'failed-policy' is not supported by the kern...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP typ...ime.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'reject-route' is not supported by the kerne...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type...ime.
3月 31 09:53:05 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
3月 31 09:53:07 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
安裝web服務、php依賴包、mariadb資料庫、zabbix軟體包
安裝httpd服務
[root@localhost ~]# yum install httpd
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴關系
--> 正在檢查事務
---> 軟體包 httpd.x86_64.0.2.4.6-97.el7.centos 將被 安裝
--> 正在處理依賴關系 httpd-tools = 2.4.6-97.el7.centos,它被軟體包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在處理依賴關系 /etc/mime.types,它被軟體包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在處理依賴關系 libaprutil-1.so.0()(64bit),它被軟體包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在處理依賴關系 libapr-1.so.0()(64bit),它被軟體包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在檢查事務
---> 軟體包 apr.x86_64.0.1.4.8-7.el7 將被 安裝
---> 軟體包 apr-util.x86_64.0.1.5.2-6.el7 將被 安裝
---> 軟體包 httpd-tools.x86_64.0.2.4.6-97.el7.centos 將被 安裝
---> 軟體包 mailcap.noarch.0.2.1.41-2.el7 將被 安裝
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
httpd x86_64 2.4.6-97.el7.centos updates 2.7 M
為依賴而安裝:
apr x86_64 1.4.8-7.el7 base 104 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-97.el7.centos updates 93 k
mailcap noarch 2.1.41-2.el7 base 31 k
事務概要
=============================================================================================================================
安裝 1 軟體包 (+4 依賴軟體包)
總下載量:3.0 M
安裝大小:10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(2/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(3/5): apr-1.4.8-7.el7.x86_64.rpm | 104 kB 00:00:00
(4/5): httpd-tools-2.4.6-97.el7.centos.x86_64.rpm | 93 kB 00:00:00
(5/5): httpd-2.4.6-97.el7.centos.x86_64.rpm | 2.7 MB 00:00:06
-----------------------------------------------------------------------------------------------------------------------------
總計 506 kB/s | 3.0 MB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : apr-1.4.8-7.el7.x86_64 1/5
正在安裝 : apr-util-1.5.2-6.el7.x86_64 2/5
正在安裝 : httpd-tools-2.4.6-97.el7.centos.x86_64 3/5
正在安裝 : mailcap-2.1.41-2.el7.noarch 4/5
正在安裝 : httpd-2.4.6-97.el7.centos.x86_64 5/5
驗證中 : httpd-2.4.6-97.el7.centos.x86_64 1/5
驗證中 : apr-1.4.8-7.el7.x86_64 2/5
驗證中 : mailcap-2.1.41-2.el7.noarch 3/5
驗證中 : httpd-tools-2.4.6-97.el7.centos.x86_64 4/5
驗證中 : apr-util-1.5.2-6.el7.x86_64 5/5
已安裝:
httpd.x86_64 0:2.4.6-97.el7.centos
作為依賴被安裝:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-97.el7.centos
mailcap.noarch 0:2.1.41-2.el7
完畢!
安裝php-fpm php-mysql php-cli
建議使用較低版本的php安裝包,過高的php版本可能會在后續配置中產生報錯
[root@localhost ~]# yum list php
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
可安裝的軟體包
php.x86_64 5.4.16-48.el7 bas
安裝php-fpm php-mysql php-cli
[root@localhost yum.repos.d]# yum install php-fpm php-mysql php-cli
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴關系
--> 正在檢查事務
---> 軟體包 php-cli.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在處理依賴關系 php-common(x86-64) = 5.4.16-48.el7,它被軟體包 php-cli-5.4.16-48.el7.x86_64 需要
---> 軟體包 php-fpm.x86_64.0.5.4.16-48.el7 將被 安裝
---> 軟體包 php-mysql.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在處理依賴關系 php-pdo(x86-64) = 5.4.16-48.el7,它被軟體包 php-mysql-5.4.16-48.el7.x86_64 需要
--> 正在檢查事務
---> 軟體包 php-common.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在處理依賴關系 libzip.so.2()(64bit),它被軟體包 php-common-5.4.16-48.el7.x86_64 需要
---> 軟體包 php-pdo.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在檢查事務
---> 軟體包 libzip.x86_64.0.0.10.1-8.el7 將被 安裝
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
php-cli x86_64 5.4.16-48.el7 base 2.7 M
php-fpm x86_64 5.4.16-48.el7 base 1.4 M
php-mysql x86_64 5.4.16-48.el7 base 102 k
為依賴而安裝:
libzip x86_64 0.10.1-8.el7 base 48 k
php-common x86_64 5.4.16-48.el7 base 565 k
php-pdo x86_64 5.4.16-48.el7 base 99 k
事務概要
=============================================================================================================================
安裝 3 軟體包 (+3 依賴軟體包)
總下載量:5.0 M
安裝大小:18 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:00:00
(2/6): php-common-5.4.16-48.el7.x86_64.rpm | 565 kB 00:00:00
(3/6): php-cli-5.4.16-48.el7.x86_64.rpm | 2.7 MB 00:00:02
(4/6): php-mysql-5.4.16-48.el7.x86_64.rpm | 102 kB 00:00:00
(5/6): php-pdo-5.4.16-48.el7.x86_64.rpm | 99 kB 00:00:00
(6/6): php-fpm-5.4.16-48.el7.x86_64.rpm | 1.4 MB 00:00:02
-----------------------------------------------------------------------------------------------------------------------------
總計 1.6 MB/s | 5.0 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : libzip-0.10.1-8.el7.x86_64 1/6
正在安裝 : php-common-5.4.16-48.el7.x86_64 2/6
正在安裝 : php-pdo-5.4.16-48.el7.x86_64 3/6
正在安裝 : php-mysql-5.4.16-48.el7.x86_64 4/6
正在安裝 : php-fpm-5.4.16-48.el7.x86_64 5/6
正在安裝 : php-cli-5.4.16-48.el7.x86_64 6/6
驗證中 : php-fpm-5.4.16-48.el7.x86_64 1/6
驗證中 : php-cli-5.4.16-48.el7.x86_64 2/6
驗證中 : php-pdo-5.4.16-48.el7.x86_64 3/6
驗證中 : php-mysql-5.4.16-48.el7.x86_64 4/6
驗證中 : libzip-0.10.1-8.el7.x86_64 5/6
驗證中 : php-common-5.4.16-48.el7.x86_64 6/6
已安裝:
php-cli.x86_64 0:5.4.16-48.el7 php-fpm.x86_64 0:5.4.16-48.el7 php-mysql.x86_64 0:5.4.16-48.el7
作為依賴被安裝:
libzip.x86_64 0:0.10.1-8.el7 php-common.x86_64 0:5.4.16-48.el7 php-pdo.x86_64 0:5.4.16-48.el7
完畢!
安裝mariadb-serv mariadb
安裝mariadb-server
[root@localhost ~]# yum install mariadb-server
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴關系
--> 正在檢查事務
---> 軟體包 mariadb-server.x86_64.1.5.5.68-1.el7 將被 安裝
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
mariadb-server x86_64 1:5.5.68-1.el7 base 11 M
事務概要
=============================================================================================================================
安裝 1 軟體包
總下載量:11 M
安裝大小:58 M
Is this ok [y/d/N]: y
Downloading packages:
mariadb-server-5.5.68-1.el7.x86_64.rpm | 11 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : 1:mariadb-server-5.5.68-1.el7.x86_64 1/1
驗證中 : 1:mariadb-server-5.5.68-1.el7.x86_64 1/1
已安裝:
mariadb-server.x86_64 1:5.5.68-1.el7
完畢!
安裝mariadb-client
[root@localhost ~]# yum install mariadb
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
沒有可用軟體包 mariadb-serve,
正在解決依賴關系
--> 正在檢查事務
---> 軟體包 mariadb.x86_64.1.5.5.68-1.el7 將被 安裝
--> 正在處理依賴關系 mariadb-libs(x86-64) = 1:5.5.68-1.el7,它被軟體包 1:mariadb-5.5.68-1.el7.x86_64 需要
--> 正在檢查事務
---> 軟體包 mariadb-libs.x86_64.1.5.5.56-2.el7 將被 升級
---> 軟體包 mariadb-libs.x86_64.1.5.5.68-1.el7 將被 更新
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
mariadb x86_64 1:5.5.68-1.el7 base 8.8 M
為依賴而更新:
mariadb-libs x86_64 1:5.5.68-1.el7 base 760 k
事務概要
=============================================================================================================================
安裝 1 軟體包
升級 ( 1 依賴軟體包)
總下載量:9.5 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/2): mariadb-libs-5.5.68-1.el7.x86_64.rpm | 760 kB 00:00:00
(2/2): mariadb-5.5.68-1.el7.x86_64.rpm | 8.8 MB 00:00:01
-----------------------------------------------------------------------------------------------------------------------------
總計 4.9 MB/s | 9.5 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : 1:mariadb-libs-5.5.68-1.el7.x86_64 1/3
正在安裝 : 1:mariadb-5.5.68-1.el7.x86_64 2/3
清理 : 1:mariadb-libs-5.5.56-2.el7.x86_64 3/3
驗證中 : 1:mariadb-libs-5.5.68-1.el7.x86_64 1/3
驗證中 : 1:mariadb-5.5.68-1.el7.x86_64 2/3
驗證中 : 1:mariadb-libs-5.5.56-2.el7.x86_64 3/3
已安裝:
mariadb.x86_64 1:5.5.68-1.el7
作為依賴被升級:
mariadb-libs.x86_64 1:5.5.68-1.el7
完畢!
安裝zabbix軟體包
官方下載地址中有各種作業系統和各種版本的安裝包以及安裝方法
zabbix官方軟體包下載地址
我這里的環境是CentOS7系統
安裝軟體包
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
建立元資料快取
yum clean all
yum makecache
安裝zabbix-server-mysql zabbix-web-msyql zabbix-agent
[root@localhost ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: hkg.mirror.rackspace.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴關系
--> 正在檢查事務
---> 軟體包 zabbix-agent.x86_64.0.4.0.30-1.el7 將被 安裝
---> 軟體包 zabbix-server-mysql.x86_64.0.4.0.30-1.el7 將被 安裝
--> 正在處理依賴關系 fping,它被軟體包 zabbix-server-mysql-4.0.30-1.el7.x86_64 需要
--> 正在處理依賴關系 libOpenIPMIposix.so.0()(64bit),它被軟體包 zabbix-server-mysql-4.0.30-1.el7.x86_64 需要
--> 正在處理依賴關系 libiksemel.so.3()(64bit),它被軟體包 zabbix-server-mysql-4.0.30-1.el7.x86_64 需要
--> 正在處理依賴關系 libOpenIPMI.so.0()(64bit),它被軟體包 zabbix-server-mysql-4.0.30-1.el7.x86_64 需要
--> 正在處理依賴關系 libodbc.so.2()(64bit),它被軟體包 zabbix-server-mysql-4.0.30-1.el7.x86_64 需要
---> 軟體包 zabbix-web-mysql.noarch.0.4.0.30-1.el7 將被 安裝
--> 正在處理依賴關系 zabbix-web = 4.0.30-1.el7,它被軟體包 zabbix-web-mysql-4.0.30-1.el7.noarch 需要
--> 正在檢查事務
---> 軟體包 OpenIPMI-libs.x86_64.0.2.0.27-1.el7 將被 安裝
--> 正在處理依賴關系 OpenIPMI-modalias = 2.0.27-1.el7,它被軟體包 OpenIPMI-libs-2.0.27-1.el7.x86_64 需要
---> 軟體包 fping.x86_64.0.3.10-4.el7 將被 安裝
---> 軟體包 iksemel.x86_64.0.1.4-2.el7.centos 將被 安裝
---> 軟體包 unixODBC.x86_64.0.2.3.1-14.el7 將被 安裝
---> 軟體包 zabbix-web.noarch.0.4.0.30-1.el7 將被 安裝
--> 正在處理依賴關系 php >= 5.4,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在處理依賴關系 php-gd,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在處理依賴關系 php-mbstring,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在處理依賴關系 php-bcmath,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在處理依賴關系 php-ldap,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在處理依賴關系 php-xml,它被軟體包 zabbix-web-4.0.30-1.el7.noarch 需要
--> 正在檢查事務
---> 軟體包 OpenIPMI-modalias.x86_64.0.2.0.27-1.el7 將被 安裝
--> 正在處理依賴關系 OpenIPMI,它被軟體包 OpenIPMI-modalias-2.0.27-1.el7.x86_64 需要
---> 軟體包 php.x86_64.0.5.4.16-48.el7 將被 安裝
---> 軟體包 php-bcmath.x86_64.0.5.4.16-48.el7 將被 安裝
---> 軟體包 php-gd.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在處理依賴關系 libt1.so.5()(64bit),它被軟體包 php-gd-5.4.16-48.el7.x86_64 需要
---> 軟體包 php-ldap.x86_64.0.5.4.16-48.el7 將被 安裝
---> 軟體包 php-mbstring.x86_64.0.5.4.16-48.el7 將被 安裝
---> 軟體包 php-xml.x86_64.0.5.4.16-48.el7 將被 安裝
--> 正在檢查事務
---> 軟體包 OpenIPMI.x86_64.0.2.0.27-1.el7 將被 安裝
---> 軟體包 t1lib.x86_64.0.5.1.2-14.el7 將被 安裝
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
zabbix-agent x86_64 4.0.30-1.el7 zabbix 428 k
zabbix-server-mysql x86_64 4.0.30-1.el7 zabbix 2.2 M
zabbix-web-mysql noarch 4.0.30-1.el7 zabbix 11 k
為依賴而安裝:
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.10-4.el7 epel 46 k
iksemel x86_64 1.4-2.el7.centos zabbix-non-supported 49 k
php x86_64 5.4.16-48.el7 base 1.4 M
php-bcmath x86_64 5.4.16-48.el7 base 58 k
php-gd x86_64 5.4.16-48.el7 base 128 k
php-ldap x86_64 5.4.16-48.el7 base 53 k
php-mbstring x86_64 5.4.16-48.el7 base 506 k
php-xml x86_64 5.4.16-48.el7 base 126 k
t1lib x86_64 5.1.2-14.el7 base 166 k
unixODBC x86_64 2.3.1-14.el7 base 413 k
zabbix-web noarch 4.0.30-1.el7 zabbix 2.9 M
事務概要
=============================================================================================================================
安裝 3 軟體包 (+14 依賴軟體包)
總下載量:9.1 M
安裝大小:34 M
Is this ok [y/d/N]: y
Downloading packages:
(1/17): OpenIPMI-2.0.27-1.el7.x86_64.rpm | 243 kB 00:00:00
(2/17): OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm | 16 kB 00:00:00
(3/17): OpenIPMI-libs-2.0.27-1.el7.x86_64.rpm | 523 kB 00:00:00
(4/17): php-bcmath-5.4.16-48.el7.x86_64.rpm | 58 kB 00:00:00
(5/17): php-5.4.16-48.el7.x86_64.rpm | 1.4 MB 00:00:00
(6/17): php-ldap-5.4.16-48.el7.x86_64.rpm | 53 kB 00:00:00
(7/17): php-gd-5.4.16-48.el7.x86_64.rpm | 128 kB 00:00:00
(8/17): php-mbstring-5.4.16-48.el7.x86_64.rpm | 506 kB 00:00:00
(9/17): t1lib-5.1.2-14.el7.x86_64.rpm | 166 kB 00:00:00
(10/17): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00
(11/17): php-xml-5.4.16-48.el7.x86_64.rpm | 126 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
iksemel-1.4-2.el7.centos.x86_64.rpm 的公鑰尚未安裝
(12/17): iksemel-1.4-2.el7.centos.x86_64.rpm | 49 kB 00:00:02
warning: /var/cache/yum/x86_64/7/epel/packages/fping-3.10-4.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
fping-3.10-4.el7.x86_64.rpm 的公鑰尚未安裝
(13/17): fping-3.10-4.el7.x86_64.rpm | 46 kB 00:00:06
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-4.0.30-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
zabbix-agent-4.0.30-1.el7.x86_64.rpm 的公鑰尚未安裝
(14/17): zabbix-agent-4.0.30-1.el7.x86_64.rpm | 428 kB 00:00:23
(15/17): zabbix-server-mysql-4.0.30-1.el7.x86_64.rpm | 2.2 MB 00:01:14
(16/17): zabbix-web-mysql-4.0.30-1.el7.noarch.rpm | 11 kB 00:00:00
(17/17): zabbix-web-4.0.30-1.el7.noarch.rpm | 2.9 MB 00:01:34
-----------------------------------------------------------------------------------------------------------------------------
總計 78 kB/s | 9.1 MB 00:01:59
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 檢索密鑰
匯入 GPG key 0xA14FE591:
用戶ID : "Zabbix LLC <packager@zabbix.com>"
指紋 : a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
軟體包 : zabbix-release-4.0-2.el7.noarch (installed)
來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
是否繼續?[y/N]:y
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 檢索密鑰
匯入 GPG key 0x79EA5ED4:
用戶ID : "Zabbix SIA <packager@zabbix.com>"
指紋 : fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4
軟體包 : zabbix-release-4.0-2.el7.noarch (installed)
來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
是否繼續?[y/N]:y
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 檢索密鑰
匯入 GPG key 0x352C64E5:
用戶ID : "Fedora EPEL (7) <epel@fedoraproject.org>"
指紋 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
軟體包 : epel-release-7-11.noarch (@extras)
來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
是否繼續?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 資料庫已被非 yum 程式修改,
正在安裝 : OpenIPMI-libs-2.0.27-1.el7.x86_64 1/17
正在安裝 : OpenIPMI-2.0.27-1.el7.x86_64 2/17
正在安裝 : OpenIPMI-modalias-2.0.27-1.el7.x86_64 3/17
正在安裝 : fping-3.10-4.el7.x86_64 4/17
正在安裝 : php-5.4.16-48.el7.x86_64 5/17
正在安裝 : unixODBC-2.3.1-14.el7.x86_64 6/17
正在安裝 : iksemel-1.4-2.el7.centos.x86_64 7/17
正在安裝 : php-bcmath-5.4.16-48.el7.x86_64 8/17
正在安裝 : t1lib-5.1.2-14.el7.x86_64 9/17
正在安裝 : php-gd-5.4.16-48.el7.x86_64 10/17
正在安裝 : php-ldap-5.4.16-48.el7.x86_64 11/17
正在安裝 : php-mbstring-5.4.16-48.el7.x86_64 12/17
正在安裝 : php-xml-5.4.16-48.el7.x86_64 13/17
正在安裝 : zabbix-web-mysql-4.0.30-1.el7.noarch 14/17
正在安裝 : zabbix-web-4.0.30-1.el7.noarch 15/17
正在安裝 : zabbix-server-mysql-4.0.30-1.el7.x86_64 16/17
正在安裝 : zabbix-agent-4.0.30-1.el7.x86_64 17/17
WARNING: ipmi_devintf module isn't available.
WARNING: ipmi_msghandler module isn't available.
驗證中 : php-xml-5.4.16-48.el7.x86_64 1/17
驗證中 : php-mbstring-5.4.16-48.el7.x86_64 2/17
驗證中 : zabbix-web-mysql-4.0.30-1.el7.noarch 3/17
驗證中 : php-ldap-5.4.16-48.el7.x86_64 4/17
驗證中 : zabbix-server-mysql-4.0.30-1.el7.x86_64 5/17
驗證中 : zabbix-web-4.0.30-1.el7.noarch 6/17
驗證中 : t1lib-5.1.2-14.el7.x86_64 7/17
驗證中 : OpenIPMI-2.0.27-1.el7.x86_64 8/17
驗證中 : php-bcmath-5.4.16-48.el7.x86_64 9/17
驗證中 : iksemel-1.4-2.el7.centos.x86_64 10/17
驗證中 : php-gd-5.4.16-48.el7.x86_64 11/17
驗證中 : unixODBC-2.3.1-14.el7.x86_64 12/17
驗證中 : zabbix-agent-4.0.30-1.el7.x86_64 13/17
驗證中 : OpenIPMI-libs-2.0.27-1.el7.x86_64 14/17
驗證中 : php-5.4.16-48.el7.x86_64 15/17
驗證中 : fping-3.10-4.el7.x86_64 16/17
驗證中 : OpenIPMI-modalias-2.0.27-1.el7.x86_64 17/17
已安裝:
zabbix-agent.x86_64 0:4.0.30-1.el7 zabbix-server-mysql.x86_64 0:4.0.30-1.el7 zabbix-web-mysql.noarch 0:4.0.30-1.el7
作為依賴被安裝:
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.10-4.el7 iksemel.x86_64 0:1.4-2.el7.centos php.x86_64 0:5.4.16-48.el7
php-bcmath.x86_64 0:5.4.16-48.el7 php-gd.x86_64 0:5.4.16-48.el7 php-ldap.x86_64 0:5.4.16-48.el7
php-mbstring.x86_64 0:5.4.16-48.el7 php-xml.x86_64 0:5.4.16-48.el7 t1lib.x86_64 0:5.1.2-14.el7
unixODBC.x86_64 0:2.3.1-14.el7 zabbix-web.noarch 0:4.0.30-1.el7
創建zabbix server資料庫
啟動mariadb服務器并設定為開機自啟
[root@localhost ~]# systemctl enable --now mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
進入mariadb服務器
即使沒有做資料庫初始化,也可以通過mysql命令以root用戶身份進入mairadb服務器
[root@localhost ~]# 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)]>
創建zabbix資料庫并設定為utf-8的字符集
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
#這里一定要設定字符集為utf-8,否則后續在web前端頁面配置程序中會報錯
給zabbix用戶賦與所有權限并設定密碼
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '用戶密碼';
Query OK, 0 rows affected (0.00 sec)
重繪權限并退出
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
將zabbix-server軟體包中的資料庫檔案匯入到zabbix資料庫中
[root@localhost ~]# zcat /usr/share/doc/zabbix-server*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
修改組態檔
主要的組態檔:
zabbix-server.conf /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<設定的zabbix資料庫密碼>
zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
這兩個引數分別為zabbix資料收集的被動模式和主動模式
php.ini /etc/php.ini
date.timezone = Asia/Shanghai
取消注釋,修改引數的值為Asia/Shanghai
啟動服務
啟動httpd
[root@localhost ~]# systemctl enable --now httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-03-31 13:43:24 CST; 9s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 54484 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─54484 /usr/sbin/httpd -DFOREGROUND
├─54486 /usr/sbin/httpd -DFOREGROUND
├─54487 /usr/sbin/httpd -DFOREGROUND
├─54488 /usr/sbin/httpd -DFOREGROUND
├─54489 /usr/sbin/httpd -DFOREGROUND
└─54490 /usr/sbin/httpd -DFOREGROUND
3月 31 13:43:24 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
3月 31 13:43:24 localhost.localdomain httpd[54484]: AH00558: httpd: Could not reliably determine the server's fully ...ssage
3月 31 13:43:24 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
啟動mariadb
[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-03-31 12:58:49 CST; 45min ago
Main PID: 53302 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─53302 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─53467 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-...
3月 31 12:58:46 localhost.localdomain systemd[1]: Starting MariaDB database server...
3月 31 12:58:46 localhost.localdomain mariadb-prepare-db-dir[53267]: Database MariaDB is probably initialized in /var/...ne.
3月 31 12:58:46 localhost.localdomain mariadb-prepare-db-dir[53267]: If this is not the case, make sure the /var/lib/m...ir.
3月 31 12:58:47 localhost.localdomain mysqld_safe[53302]: 210331 12:58:47 mysqld_safe Logging to '/var/log/mariadb/ma...og'.
3月 31 12:58:47 localhost.localdomain mysqld_safe[53302]: 210331 12:58:47 mysqld_safe Starting mysqld daemon with dat...ysql
3月 31 12:58:49 localhost.localdomain systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
啟動php-fpm
[root@localhost ~]# systemctl enable --now php-fpm
[root@localhost ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-03-31 13:40:36 CST; 5min ago
Main PID: 54421 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/php-fpm.service
├─54421 php-fpm: master process (/etc/php-fpm.conf)
├─54423 php-fpm: pool www
├─54424 php-fpm: pool www
├─54425 php-fpm: pool www
├─54426 php-fpm: pool www
└─54427 php-fpm: pool www
3月 31 13:40:36 localhost.localdomain systemd[1]: Starting The PHP FastCGI Process Manager...
3月 31 13:40:36 localhost.localdomain systemd[1]: Started The PHP FastCGI Process Manager.
啟動zabbix-server
[root@localhost ~]# systemctl enable --now zabbix-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@localhost ~]# systemctl status zabbix-server.service
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-03-31 13:46:38 CST; 11s ago
Process: 54621 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 54623 (zabbix_server)
CGroup: /system.slice/zabbix-server.service
├─54623 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
├─54628 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.010837 sec, idle 60 sec]
├─54637 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
├─54638 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.000784 sec, idle 21 sec]
├─54639 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000376 sec, idle 5 sec]
├─54641 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.002074 sec, idle 60 sec]
├─54643 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000056 sec, idle 1 sec]...
├─54644 /usr/sbin/zabbix_server: history syncer #2 [processed 3 values, 3 triggers in 0.012321 sec, idle 1 sec]...
├─54645 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000071 sec, idle 1 sec]...
├─54646 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000061 sec, idle 1 sec]...
├─54648 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000980 sec, idle 3 sec]
├─54651 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000031 sec, idle 5 sec]
├─54652 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000069 sec, idle 1 sec]
├─54653 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.001299 sec, idle 5 sec]
├─54655 /usr/sbin/zabbix_server: poller #1 [got 1 values in 0.000116 sec, idle 1 sec]
├─54656 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000031 sec, idle 1 sec]
├─54657 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000290 sec, idle 1 sec]
├─54659 /usr/sbin/zabbix_server: poller #4 [got 1 values in 0.000265 sec, idle 1 sec]
├─54660 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000298 sec, idle 1 sec]
├─54661 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000028 sec, idle 5 sec]
├─54662 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
├─54663 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
├─54664 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
├─54665 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
├─54666 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
├─54667 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000018 sec, idle 5 sec]
├─54668 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.009721 sec during 5.009796 s...
├─54669 /usr/sbin/zabbix_server: alerter #1 started
├─54670 /usr/sbin/zabbix_server: alerter #2 started
├─54671 /usr/sbin/zabbix_server: alerter #3 started
├─54673 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 7 values, idle 5.004362 sec duri...
├─54674 /usr/sbin/zabbix_server: preprocessing worker #1 started
├─54676 /usr/sbin/zabbix_server: preprocessing worker #2 started
└─54679 /usr/sbin/zabbix_server: preprocessing worker #3 started
3月 31 13:46:38 localhost.localdomain systemd[1]: Starting Zabbix Server...
3月 31 13:46:38 localhost.localdomain systemd[1]: Started Zabbix Server.
啟動zabbix-agent
[root@localhost ~]# systemctl enable --now zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@localhost ~]# systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2021-03-31 13:48:05 CST; 8s ago
Process: 54767 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 54769 (zabbix_agentd)
CGroup: /system.slice/zabbix-agent.service
├─54769 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─54770 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─54771 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─54772 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─54773 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─54774 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
3月 31 13:48:05 localhost.localdomain systemd[1]: Starting Zabbix Agent...
3月 31 13:48:05 localhost.localdomain systemd[1]: Started Zabbix Agent.
查看各服務的監聽埠
tcp6 0 0 :::10050 :::* LISTEN 54769/zabbix_agentd
tcp6 0 0 :::10051 :::* LISTEN 54623/zabbix_server
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 53467/mysqld
tcp6 0 0 :::80 :::* LISTEN 54484/httpd
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 54421/php-fpm: mast
進入前端頁面配置
打開瀏覽器搜索:IP地址/zabbix

如果你在訪問程序中遇到了這樣的報錯:
Not Found The requested URL /zabbix was not found on this server.
這個問題的解決辦法是
打開/etc/httpd/conf/httpd.conf檔案
查找這個欄位,取消該欄位的注釋
LoadModule rewrite_module modules/mod_rewrite.so
如果組態檔中沒有就加上
配置php相關引數

這里的相關引數與之前的/etc/httpd/conf.d/zabbix.conf組態檔對應
關聯資料庫

Password這一欄填寫zabbix資料庫密碼
在這個頁面可能遇見的錯誤

這是由于zabbix資料庫字符集不是utf-8的型別,即使修改為了utf-8型別它還是會這樣報錯

這個問題解決辦法是將原有的資料庫洗掉,重新創建資料庫同時設定為utf-8的字符集
create database zabbix character set utf8 collate utf8_bin;
完成配置后即可登錄

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/271540.html
標籤:其他
上一篇:Linux作業系統安裝與環境搭建
下一篇:Linux系統配置ssh登錄
