5

CentOS 部署Zabbix v5.0.6

 2 years ago
source link: https://www.opsit.cn/6586.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

0x01 什么是Zabbix

zabbix([`zæbiks])是一个基于WEB接口的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

zabbix由2部分构成,zabbix server与可选组件zabbix agent。

zabbix server可以通过SNMP,zabbix agent,ping,埠监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

0x02 如何部署?

基础环境准备

  1. #修改计算机名为zabbix
  2. [root@localhost]# hostnamectl set-hostname zabbix
  3. #查看系统版本
  4. [root@zabbix /]# cat /etc/redhat-release
  5. CentOS Linux release 7.4.1708 (Core)
  6. #修改网络配置 网卡编号以自己系统安装完成后显示为准,这边显示ens32
  7. [root@zabbix ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32
  8. TYPE=Ethernet
  9. PROXY_METHOD=none
  10. BROWSER_ONLY=no
  11. #BOOTPROTO=dhcp #直接在这改也可以,个人习惯问题,喜欢注释掉,另起写ip
  12. DEFROUTE=yes
  13. IPV4_FAILURE_FATAL=no
  14. IPV6INIT=yes
  15. IPV6_AUTOCONF=yes
  16. IPV6_DEFROUTE=yes
  17. IPV6_FAILURE_FATAL=no
  18. #IPV6_ADDR_GEN_MODE=stable-privacy #此行也注释掉
  19. NAME=ens32
  20. UUID=4f9c06a4-23a6-40a7-81d0-7c5010abb0ef
  21. DEVICE=ens32
  22. #ONBOOT=no #注释掉
  23. IPV6_PRIVACY=no
  24. BOOTPROTO=static #设置网卡静态IP模式
  25. ONBOOT=yes #开机启动
  26. IPADDR=172.16.252.100 #设置IP地址
  27. NETMASK=255.255.255.0 #设置子网掩码
  28. GATEWAY=172.16.252.2 #设置网关
  29. DNS1=223.5.5.5 #设置DNS地址
  30. #退出vi编辑模式,按esc,输入':wq!'保存退出
  31. #重启网卡
  32. [root@zabbix /]# systemctl restart network
  33. #查看网卡IP配置是否成功
  34. [root@zabbix /]# ifconfig ens32
  35. ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  36. inet 172.16.252.100 netmask 255.255.255.0 broadcast 172.16.252.255
  37. inet6 fe80::20c:29ff:fe13:39ff prefixlen 64 scopeid 0x20
  38. ether 00:0c:29:13:39:ff txqueuelen 1000 (Ethernet)
  39. RX packets 290 bytes 28350 (27.6 KiB)
  40. RX errors 0 dropped 0 overruns 0 frame 0
  41. TX packets 225 bytes 39888 (38.9 KiB)
  42. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  43. [root@zabbix /]# vi /etc/selinux/config #修改SElinux配置文件,永久关闭SElinux,重启生效
  44. # This file controls the state of SELinux on the system.
  45. # SELINUX= can take one of these three values:
  46. # enforcing - SELinux security policy is enforced.
  47. # permissive - SELinux prints warnings instead of enforcing.
  48. # disabled - No SELinux policy is loaded.
  49. SELINUX=disabled #将此行enabled修改为disabled
  50. # SELINUXTYPE= can take one of three two values:
  51. # targeted - Targeted processes are protected,
  52. # minimum - Modification of targeted policy. Only selected processes are protected.
  53. # mls - Multi Level Security protection.
  54. SELINUXTYPE=targeted
  55. #验证SElinux是否成功关闭
  56. [root@zabbix]# setenforce 0
  57. #重启后验证SElinux已成功关闭
  58. [root@zabbix ~]# setenforce 0
  59. setenforce: SELinux is disabled
  60. #关闭防火墙
  61. [root@zabbix ~]# systemctl stop firewalld
  62. #永久关闭防火墙,禁止开机启动
  63. [root@zabbix ~]# systemctl disable firewalld
  64. Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
  65. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  66. #查看防火墙状态(此处演示,生产环境视情况而定,不建议直接关掉)
  67. [root@zabbix ~]# systemctl status firewalld
  68. ● firewalld.service - firewalld - dynamic firewall daemon
  69. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  70. Active: inactive (dead)
  71. Docs: man:firewalld(1)
  72. Dec 01 02:41:38 zabbix systemd[1]: Starting firewalld - dynamic firewall daemon...
  73. Dec 01 02:42:01 zabbix systemd[1]: Started firewalld - dynamic firewall daemon.
  74. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: ICMP type 'beyond-scope' is not supported by the ker...pv6.
  75. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP ty...ime.
  76. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: ICMP type 'failed-policy' is not supported by the ke...pv6.
  77. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP t...ime.
  78. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: ICMP type 'reject-route' is not supported by the ker...pv6.
  79. Dec 01 02:42:01 zabbix firewalld[591]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP ty...ime.
  80. Dec 01 03:07:06 zabbix systemd[1]: Stopping firewalld - dynamic firewall daemon...
  81. Dec 01 03:07:07 zabbix systemd[1]: Stopped firewalld - dynamic firewall daemon.

Zabbix 安装环境准备

  1. #安装zabbix下载源
  2. [root@zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
  3. Retrieving https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
  4. warning: /var/tmp/rpm-tmp.OHAfBE: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
  5. Preparing... ################################# [100%]
  6. Updating / installing...
  7. 1:zabbix-release-5.0-1.el7 ################################# [100%]
  8. #安装zabbix-server 与zabbix-agent
  9. [root@zabbix ~]# yum install zabbix-server-mysql zabbix-agent
  10. Loaded plugins: fastestmirror, langpacks
  11. http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/repodata/repomd.xml: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
  12. Trying other mirror.
  13. zabbix | 2.9 kB 00:00:00
  14. zabbix-non-supported | 951 B 00:00:00
  15. zabbix/x86_64/primary_db | 52 kB 00:00:02
  16. zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00
  17. Loading mirror speeds from cached hostfile
  18. * base: mirrors.163.com
  19. * extras: mirrors.163.com
  20. * updates: mirrors.163.com
  21. zabbix-non-supported 4/4
  22. Resolving Dependencies
  23. --> Running transaction check
  24. ---> Package zabbix-agent.x86_64 0:5.0.6-1.el7 will be installed
  25. ---> Package zabbix-server-mysql.x86_64 0:5.0.6-1.el7 will be installed
  26. --> Processing Dependency: fping for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  27. --> Processing Dependency: libOpenIPMIposix.so.0()(64bit) for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  28. --> Processing Dependency: libOpenIPMI.so.0()(64bit) for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  29. --> Processing Dependency: libodbc.so.2()(64bit) for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  30. --> Running transaction check
  31. ---> Package OpenIPMI-libs.x86_64 0:2.0.27-1.el7 will be installed
  32. --> Processing Dependency: OpenIPMI-modalias = 2.0.27-1.el7 for package: OpenIPMI-libs-2.0.27-1.el7.x86_64
  33. ---> Package fping.x86_64 0:3.10-1.el7 will be installed
  34. ---> Package unixODBC.x86_64 0:2.3.1-14.el7 will be installed
  35. --> Running transaction check
  36. ---> Package OpenIPMI-modalias.x86_64 0:2.0.27-1.el7 will be installed
  37. --> Processing Dependency: OpenIPMI for package: OpenIPMI-modalias-2.0.27-1.el7.x86_64
  38. --> Running transaction check
  39. ---> Package OpenIPMI.x86_64 0:2.0.27-1.el7 will be installed
  40. --> Finished Dependency Resolution
  41. Dependencies Resolved
  42. ===========================================================================================================
  43. Package Arch Version Repository Size
  44. ===========================================================================================================
  45. Installing:
  46. zabbix-agent x86_64 5.0.6-1.el7 zabbix 452 k
  47. zabbix-server-mysql x86_64 5.0.6-1.el7 zabbix 2.7 M
  48. Installing for dependencies:
  49. OpenIPMI x86_64 2.0.27-1.el7 base 243 k
  50. OpenIPMI-libs x86_64 2.0.27-1.el7 base 523 k
  51. OpenIPMI-modalias x86_64 2.0.27-1.el7 base 16 k
  52. fping x86_64 3.10-1.el7 zabbix-non-supported 40 k
  53. unixODBC x86_64 2.3.1-14.el7 base 413 k
  54. Transaction Summary
  55. ===========================================================================================================
  56. Install 2 Packages (+5 Dependent packages)
  57. Total download size: 4.4 M
  58. Installed size: 12 M
  59. Is this ok [y/d/N]: y
  60. Downloading packages:
  61. warning: /var/cache/yum/x86_64/7/base/packages/OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
  62. Public key for OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm is not installed
  63. (1/7): OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm | 16 kB 00:00:00
  64. (2/7): OpenIPMI-2.0.27-1.el7.x86_64.rpm | 243 kB 00:00:00
  65. (3/7): OpenIPMI-libs-2.0.27-1.el7.x86_64.rpm | 523 kB 00:00:00
  66. (4/7): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00
  67. warning: /var/cache/yum/x86_64/7/zabbix-non-supported/packages/fping-3.10-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
  68. Public key for fping-3.10-1.el7.x86_64.rpm is not installed
  69. (5/7): fping-3.10-1.el7.x86_64.rpm | 40 kB 00:00:02
  70. warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-server-mysql-5.0.6-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
  71. Public key for zabbix-server-mysql-5.0.6-1.el7.x86_64.rpm is not installed
  72. (6/7): zabbix-server-mysql-5.0.6-1.el7.x86_64.rpm | 2.7 MB 00:00:20
  73. (7/7): zabbix-agent-5.0.6-1.el7.x86_64.rpm | 452 kB 00:00:28
  74. -----------------------------------------------------------------------------------------------------------
  75. Total 155 kB/s | 4.4 MB 00:00:28
  76. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
  77. Importing GPG key 0x79EA5ED4:
  78. Userid : "Zabbix SIA <[email protected]>"
  79. Fingerprint: fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4
  80. Package : zabbix-release-5.0-1.el7.noarch (installed)
  81. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
  82. Is this ok [y/N]: y
  83. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
  84. Importing GPG key 0xA14FE591:
  85. Userid : "Zabbix LLC <[email protected]>"
  86. Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
  87. Package : zabbix-release-5.0-1.el7.noarch (installed)
  88. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
  89. Is this ok [y/N]: y
  90. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  91. Importing GPG key 0xF4A80EB5:
  92. Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
  93. Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
  94. Package : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
  95. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  96. Is this ok [y/N]: y
  97. Running transaction check
  98. Running transaction test
  99. Transaction test succeeded
  100. Running transaction
  101. Warning: RPMDB altered outside of yum.
  102. Installing : OpenIPMI-libs-2.0.27-1.el7.x86_64 1/7
  103. Installing : OpenIPMI-2.0.27-1.el7.x86_64 2/7
  104. Installing : OpenIPMI-modalias-2.0.27-1.el7.x86_64 3/7
  105. Installing : unixODBC-2.3.1-14.el7.x86_64 4/7
  106. Installing : fping-3.10-1.el7.x86_64 5/7
  107. Installing : zabbix-server-mysql-5.0.6-1.el7.x86_64 6/7
  108. Installing : zabbix-agent-5.0.6-1.el7.x86_64 7/7
  109. WARNING: ipmi_devintf module isn't available.
  110. WARNING: ipmi_msghandler module isn't available.
  111. Verifying : fping-3.10-1.el7.x86_64 1/7
  112. Verifying : zabbix-server-mysql-5.0.6-1.el7.x86_64 2/7
  113. Verifying : OpenIPMI-2.0.27-1.el7.x86_64 3/7
  114. Verifying : zabbix-agent-5.0.6-1.el7.x86_64 4/7
  115. Verifying : unixODBC-2.3.1-14.el7.x86_64 5/7
  116. Verifying : OpenIPMI-libs-2.0.27-1.el7.x86_64 6/7
  117. Verifying : OpenIPMI-modalias-2.0.27-1.el7.x86_64 7/7
  118. Installed:
  119. zabbix-agent.x86_64 0:5.0.6-1.el7 zabbix-server-mysql.x86_64 0:5.0.6-1.el7
  120. Dependency Installed:
  121. OpenIPMI.x86_64 0:2.0.27-1.el7 OpenIPMI-libs.x86_64 0:2.0.27-1.el7
  122. OpenIPMI-modalias.x86_64 0:2.0.27-1.el7 fping.x86_64 0:3.10-1.el7
  123. unixODBC.x86_64 0:2.3.1-14.el7
  124. Complete!
  125. #安装zabbix前端启用收藏安装源
  126. [root@zabbix ~]# yum install centos-release-scl -y
  127. Loaded plugins: fastestmirror, langpacks
  128. Loading mirror speeds from cached hostfile
  129. * base: mirrors.163.com
  130. * extras: mirrors.163.com
  131. * updates: mirrors.163.com
  132. Resolving Dependencies
  133. --> Running transaction check
  134. ---> Package centos-release-scl.noarch 0:2-3.el7.centos will be installed
  135. --> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-3.el7.centos.noarch
  136. --> Running transaction check
  137. ---> Package centos-release-scl-rh.noarch 0:2-3.el7.centos will be installed
  138. --> Finished Dependency Resolution
  139. Dependencies Resolved
  140. ===========================================================================================================
  141. Package Arch Version Repository Size
  142. ===========================================================================================================
  143. Installing:
  144. centos-release-scl noarch 2-3.el7.centos extras 12 k
  145. Installing for dependencies:
  146. centos-release-scl-rh noarch 2-3.el7.centos extras 12 k
  147. Transaction Summary
  148. ===========================================================================================================
  149. Install 1 Package (+1 Dependent package)
  150. Total download size: 24 k
  151. Installed size: 39 k
  152. Downloading packages:
  153. (1/2): centos-release-scl-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00
  154. (2/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00
  155. -----------------------------------------------------------------------------------------------------------
  156. Total 77 kB/s | 24 kB 00:00:00
  157. Running transaction check
  158. Running transaction test
  159. Transaction test succeeded
  160. Running transaction
  161. Installing : centos-release-scl-rh-2-3.el7.centos.noarch 1/2
  162. Installing : centos-release-scl-2-3.el7.centos.noarch 2/2
  163. Verifying : centos-release-scl-2-3.el7.centos.noarch 1/2
  164. Verifying : centos-release-scl-rh-2-3.el7.centos.noarch 2/2
  165. Installed:
  166. centos-release-scl.noarch 0:2-3.el7.centos
  167. Dependency Installed:
  168. centos-release-scl-rh.noarch 0:2-3.el7.centos
  169. Complete!
  170. #编辑zabbix前端安装源
  171. [root@zabbix ~]# vim /etc/yum.repos.d/zabbix.repo
  172. ...
  173. [zabbix-frontend]
  174. name=Zabbix Official Repository frontend - $basearch
  175. baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
  176. enabled=1 #此处修改为1 启用
  177. gpgcheck=1
  178. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
  179. ...
  180. #安装zabbix环境依赖包
  181. [root@zabbix ~]# yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
  182. Loaded plugins: fastestmirror, langpacks
  183. centos-sclo-rh | 3.0 kB 00:00:00
  184. centos-sclo-sclo | 3.0 kB 00:00:00
  185. zabbix | 2.9 kB 00:00:00
  186. zabbix-frontend | 2.9 kB 00:00:00
  187. zabbix-non-supported | 951 B 00:00:00
  188. (1/3): centos-sclo-sclo/x86_64/primary_db | 300 kB 00:00:00
  189. (2/3): centos-sclo-rh/x86_64/primary_db | 2.9 MB 00:00:01
  190. (3/3): zabbix-frontend/x86_64/primary_db | 13 kB 00:00:03
  191. Loading mirror speeds from cached hostfile
  192. * base: mirrors.163.com
  193. * centos-sclo-rh: mirrors.163.com
  194. * centos-sclo-sclo: mirrors.163.com
  195. * extras: mirrors.163.com
  196. * updates: mirrors.163.com
  197. Resolving Dependencies
  198. --> Running transaction check
  199. ---> Package zabbix-nginx-conf-scl.noarch 0:5.0.6-1.el7 will be installed
  200. --> Processing Dependency: zabbix-web-deps-scl = 5.0.6-1.el7 for package: zabbix-nginx-conf-scl-5.0.6-1.el7.noarch
  201. --> Processing Dependency: rh-nginx116-nginx for package: zabbix-nginx-conf-scl-5.0.6-1.el7.noarch
  202. ---> Package zabbix-web-mysql-scl.noarch 0:5.0.6-1.el7 will be installed
  203. --> Processing Dependency: zabbix-web = 5.0.6-1.el7 for package: zabbix-web-mysql-scl-5.0.6-1.el7.noarch
  204. --> Processing Dependency: rh-php72-php-mysqlnd for package: zabbix-web-mysql-scl-5.0.6-1.el7.noarch
  205. --> Running transaction check
  206. ---> Package rh-nginx116-nginx.x86_64 1:1.16.1-4.el7.1 will be installed
  207. --> Processing Dependency: rh-nginx116-runtime for package: 1:rh-nginx116-nginx-1.16.1-4.el7.1.x86_64
  208. ---> Package rh-php72-php-mysqlnd.x86_64 0:7.2.24-1.el7 will be installed
  209. --> Processing Dependency: rh-php72-php-pdo(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64
  210. ---> Package zabbix-web.noarch 0:5.0.6-1.el7 will be installed
  211. ---> Package zabbix-web-deps-scl.noarch 0:5.0.6-1.el7 will be installed
  212. --> Processing Dependency: rh-php72-php-mbstring for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  213. --> Processing Dependency: rh-php72-php-xml for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  214. --> Processing Dependency: rh-php72-php-bcmath for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  215. --> Processing Dependency: rh-php72-php-ldap for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  216. --> Processing Dependency: rh-php72-php-fpm for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  217. --> Processing Dependency: rh-php72 for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  218. --> Processing Dependency: rh-php72-php-gd for package: zabbix-web-deps-scl-5.0.6-1.el7.noarch
  219. --> Running transaction check
  220. ---> Package rh-nginx116-runtime.x86_64 0:1.16-1.el7 will be installed
  221. ---> Package rh-php72.x86_64 0:1-2.el7 will be installed
  222. --> Processing Dependency: rh-php72-runtime(x86-64) = 1-2.el7 for package: rh-php72-1-2.el7.x86_64
  223. --> Processing Dependency: rh-php72-runtime for package: rh-php72-1-2.el7.x86_64
  224. --> Processing Dependency: rh-php72-php-common(x86-64) for package: rh-php72-1-2.el7.x86_64
  225. --> Processing Dependency: rh-php72-php-cli(x86-64) for package: rh-php72-1-2.el7.x86_64
  226. --> Processing Dependency: rh-php72-php-pear for package: rh-php72-1-2.el7.x86_64
  227. ---> Package rh-php72-php-bcmath.x86_64 0:7.2.24-1.el7 will be installed
  228. ---> Package rh-php72-php-fpm.x86_64 0:7.2.24-1.el7 will be installed
  229. ---> Package rh-php72-php-gd.x86_64 0:7.2.24-1.el7 will be installed
  230. ---> Package rh-php72-php-ldap.x86_64 0:7.2.24-1.el7 will be installed
  231. ---> Package rh-php72-php-mbstring.x86_64 0:7.2.24-1.el7 will be installed
  232. ---> Package rh-php72-php-pdo.x86_64 0:7.2.24-1.el7 will be installed
  233. ---> Package rh-php72-php-xml.x86_64 0:7.2.24-1.el7 will be installed
  234. --> Running transaction check
  235. ---> Package rh-php72-php-cli.x86_64 0:7.2.24-1.el7 will be installed
  236. ---> Package rh-php72-php-common.x86_64 0:7.2.24-1.el7 will be installed
  237. --> Processing Dependency: rh-php72-php-json(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-common-7.2.24-1.el7.x86_64
  238. --> Processing Dependency: rh-php72-php-zip(x86-64) = 7.2.24-1.el7 for package: rh-php72-php-common-7.2.24-1.el7.x86_64
  239. ---> Package rh-php72-php-pear.noarch 1:1.10.5-1.el7 will be installed
  240. --> Processing Dependency: rh-php72-php-posix for package: 1:rh-php72-php-pear-1.10.5-1.el7.noarch
  241. ---> Package rh-php72-runtime.x86_64 0:1-2.el7 will be installed
  242. --> Running transaction check
  243. ---> Package rh-php72-php-json.x86_64 0:7.2.24-1.el7 will be installed
  244. ---> Package rh-php72-php-process.x86_64 0:7.2.24-1.el7 will be installed
  245. ---> Package rh-php72-php-zip.x86_64 0:7.2.24-1.el7 will be installed
  246. --> Finished Dependency Resolution
  247. Dependencies Resolved
  248. ===========================================================================================================
  249. Package Arch Version Repository Size
  250. ===========================================================================================================
  251. Installing:
  252. zabbix-nginx-conf-scl noarch 5.0.6-1.el7 zabbix-frontend 14 k
  253. zabbix-web-mysql-scl noarch 5.0.6-1.el7 zabbix-frontend 13 k
  254. Installing for dependencies:
  255. rh-nginx116-nginx x86_64 1:1.16.1-4.el7.1 centos-sclo-rh 548 k
  256. rh-nginx116-runtime x86_64 1.16-1.el7 centos-sclo-rh 26 k
  257. rh-php72 x86_64 1-2.el7 centos-sclo-rh 4.3 k
  258. rh-php72-php-bcmath x86_64 7.2.24-1.el7 centos-sclo-rh 60 k
  259. rh-php72-php-cli x86_64 7.2.24-1.el7 centos-sclo-rh 2.9 M
  260. rh-php72-php-common x86_64 7.2.24-1.el7 centos-sclo-rh 680 k
  261. rh-php72-php-fpm x86_64 7.2.24-1.el7 centos-sclo-rh 1.5 M
  262. rh-php72-php-gd x86_64 7.2.24-1.el7 centos-sclo-rh 151 k
  263. rh-php72-php-json x86_64 7.2.24-1.el7 centos-sclo-rh 54 k
  264. rh-php72-php-ldap x86_64 7.2.24-1.el7 centos-sclo-rh 59 k
  265. rh-php72-php-mbstring x86_64 7.2.24-1.el7 centos-sclo-rh 553 k
  266. rh-php72-php-mysqlnd x86_64 7.2.24-1.el7 centos-sclo-rh 166 k
  267. rh-php72-php-pdo x86_64 7.2.24-1.el7 centos-sclo-rh 101 k
  268. rh-php72-php-pear noarch 1:1.10.5-1.el7 centos-sclo-rh 357 k
  269. rh-php72-php-process x86_64 7.2.24-1.el7 centos-sclo-rh 62 k
  270. rh-php72-php-xml x86_64 7.2.24-1.el7 centos-sclo-rh 160 k
  271. rh-php72-php-zip x86_64 7.2.24-1.el7 centos-sclo-rh 90 k
  272. rh-php72-runtime x86_64 1-2.el7 centos-sclo-rh 1.1 M
  273. zabbix-web noarch 5.0.6-1.el7 zabbix-frontend 3.2 M
  274. zabbix-web-deps-scl noarch 5.0.6-1.el7 zabbix-frontend 14 k
  275. Transaction Summary
  276. ===========================================================================================================
  277. Install 2 Packages (+20 Dependent packages)
  278. Total download size: 12 M
  279. Installed size: 46 M
  280. Downloading packages:
  281. warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/rh-nginx116-runtime-1.16-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
  282. Public key for rh-nginx116-runtime-1.16-1.el7.x86_64.rpm is not installed
  283. (1/22): rh-nginx116-runtime-1.16-1.el7.x86_64.rpm | 26 kB 00:00:00
  284. (2/22): rh-nginx116-nginx-1.16.1-4.el7.1.x86_64.rpm | 548 kB 00:00:00
  285. (3/22): rh-php72-1-2.el7.x86_64.rpm | 4.3 kB 00:00:00
  286. (4/22): rh-php72-php-bcmath-7.2.24-1.el7.x86_64.rpm | 60 kB 00:00:00
  287. (5/22): rh-php72-php-gd-7.2.24-1.el7.x86_64.rpm | 151 kB 00:00:00
  288. (6/22): rh-php72-php-json-7.2.24-1.el7.x86_64.rpm | 54 kB 00:00:00
  289. (7/22): rh-php72-php-common-7.2.24-1.el7.x86_64.rpm | 680 kB 00:00:00
  290. (8/22): rh-php72-php-fpm-7.2.24-1.el7.x86_64.rpm | 1.5 MB 00:00:00
  291. (9/22): rh-php72-php-ldap-7.2.24-1.el7.x86_64.rpm | 59 kB 00:00:00
  292. (10/22): rh-php72-php-pdo-7.2.24-1.el7.x86_64.rpm | 101 kB 00:00:00
  293. (11/22): rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64.rpm | 166 kB 00:00:00
  294. (12/22): rh-php72-php-process-7.2.24-1.el7.x86_64.rpm | 62 kB 00:00:00
  295. (13/22): rh-php72-php-mbstring-7.2.24-1.el7.x86_64.rpm | 553 kB 00:00:00
  296. (14/22): rh-php72-php-xml-7.2.24-1.el7.x86_64.rpm | 160 kB 00:00:00
  297. (15/22): rh-php72-php-pear-1.10.5-1.el7.noarch.rpm | 357 kB 00:00:00
  298. (16/22): rh-php72-php-zip-7.2.24-1.el7.x86_64.rpm | 90 kB 00:00:00
  299. (17/22): zabbix-nginx-conf-scl-5.0.6-1.el7.noarch.rpm | 14 kB 00:00:00
  300. (18/22): rh-php72-runtime-1-2.el7.x86_64.rpm | 1.1 MB 00:00:00
  301. (19/22): zabbix-web-deps-scl-5.0.6-1.el7.noarch.rpm | 14 kB 00:00:00
  302. (20/22): zabbix-web-mysql-scl-5.0.6-1.el7.noarch.rpm | 13 kB 00:00:00
  303. (21/22): rh-php72-php-cli-7.2.24-1.el7.x86_64.rpm | 2.9 MB 00:00:02
  304. (22/22): zabbix-web-5.0.6-1.el7.noarch.rpm | 3.2 MB 00:03:17
  305. -----------------------------------------------------------------------------------------------------------
  306. Total 60 kB/s | 12 MB 00:03:19
  307. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
  308. Importing GPG key 0xF2EE9D55:
  309. Userid : "CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <[email protected]>"
  310. Fingerprint: c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55
  311. Package : centos-release-scl-rh-2-3.el7.centos.noarch (@extras)
  312. From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
  313. Running transaction check
  314. Running transaction test
  315. Transaction test succeeded
  316. Running transaction
  317. Installing : rh-php72-runtime-1-2.el7.x86_64 1/22
  318. Installing : rh-php72-php-zip-7.2.24-1.el7.x86_64 2/22
  319. Installing : rh-php72-php-json-7.2.24-1.el7.x86_64 3/22
  320. Installing : rh-php72-php-common-7.2.24-1.el7.x86_64 4/22
  321. Installing : rh-php72-php-xml-7.2.24-1.el7.x86_64 5/22
  322. Installing : rh-php72-php-cli-7.2.24-1.el7.x86_64 6/22
  323. Installing : rh-php72-php-fpm-7.2.24-1.el7.x86_64 7/22
  324. Installing : rh-php72-php-bcmath-7.2.24-1.el7.x86_64 8/22
  325. Installing : rh-php72-php-gd-7.2.24-1.el7.x86_64 9/22
  326. Installing : rh-php72-php-process-7.2.24-1.el7.x86_64 10/22
  327. Installing : 1:rh-php72-php-pear-1.10.5-1.el7.noarch 11/22
  328. Installing : rh-php72-1-2.el7.x86_64 12/22
  329. Installing : rh-php72-php-pdo-7.2.24-1.el7.x86_64 13/22
  330. Installing : rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64 14/22
  331. Installing : rh-php72-php-ldap-7.2.24-1.el7.x86_64 15/22
  332. Installing : rh-php72-php-mbstring-7.2.24-1.el7.x86_64 16/22
  333. Installing : zabbix-web-5.0.6-1.el7.noarch 17/22
  334. Installing : zabbix-web-mysql-scl-5.0.6-1.el7.noarch 18/22
  335. Installing : zabbix-web-deps-scl-5.0.6-1.el7.noarch 19/22
  336. Installing : rh-nginx116-runtime-1.16-1.el7.x86_64 20/22
  337. Installing : 1:rh-nginx116-nginx-1.16.1-4.el7.1.x86_64 21/22
  338. Installing : zabbix-nginx-conf-scl-5.0.6-1.el7.noarch 22/22
  339. Verifying : rh-php72-php-xml-7.2.24-1.el7.x86_64 1/22
  340. Verifying : zabbix-web-mysql-scl-5.0.6-1.el7.noarch 2/22
  341. Verifying : rh-php72-php-fpm-7.2.24-1.el7.x86_64 3/22
  342. Verifying : 1:rh-nginx116-nginx-1.16.1-4.el7.1.x86_64 4/22
  343. Verifying : zabbix-nginx-conf-scl-5.0.6-1.el7.noarch 5/22
  344. Verifying : rh-php72-runtime-1-2.el7.x86_64 6/22
  345. Verifying : rh-php72-php-common-7.2.24-1.el7.x86_64 7/22
  346. Verifying : rh-php72-php-zip-7.2.24-1.el7.x86_64 8/22
  347. Verifying : rh-php72-php-bcmath-7.2.24-1.el7.x86_64 9/22
  348. Verifying : rh-php72-php-gd-7.2.24-1.el7.x86_64 10/22
  349. Verifying : rh-php72-php-json-7.2.24-1.el7.x86_64 11/22
  350. Verifying : rh-php72-php-process-7.2.24-1.el7.x86_64 12/22
  351. Verifying : rh-php72-php-pdo-7.2.24-1.el7.x86_64 13/22
  352. Verifying : rh-php72-php-ldap-7.2.24-1.el7.x86_64 14/22
  353. Verifying : zabbix-web-deps-scl-5.0.6-1.el7.noarch 15/22
  354. Verifying : rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64 16/22
  355. Verifying : rh-php72-php-mbstring-7.2.24-1.el7.x86_64 17/22
  356. Verifying : 1:rh-php72-php-pear-1.10.5-1.el7.noarch 18/22
  357. Verifying : rh-php72-1-2.el7.x86_64 19/22
  358. Verifying : rh-nginx116-runtime-1.16-1.el7.x86_64 20/22
  359. Verifying : rh-php72-php-cli-7.2.24-1.el7.x86_64 21/22
  360. Verifying : zabbix-web-5.0.6-1.el7.noarch 22/22
  361. Installed:
  362. zabbix-nginx-conf-scl.noarch 0:5.0.6-1.el7 zabbix-web-mysql-scl.noarch 0:5.0.6-1.el7
  363. Dependency Installed:
  364. rh-nginx116-nginx.x86_64 1:1.16.1-4.el7.1 rh-nginx116-runtime.x86_64 0:1.16-1.el7
  365. rh-php72.x86_64 0:1-2.el7 rh-php72-php-bcmath.x86_64 0:7.2.24-1.el7
  366. rh-php72-php-cli.x86_64 0:7.2.24-1.el7 rh-php72-php-common.x86_64 0:7.2.24-1.el7
  367. rh-php72-php-fpm.x86_64 0:7.2.24-1.el7 rh-php72-php-gd.x86_64 0:7.2.24-1.el7
  368. rh-php72-php-json.x86_64 0:7.2.24-1.el7 rh-php72-php-ldap.x86_64 0:7.2.24-1.el7
  369. rh-php72-php-mbstring.x86_64 0:7.2.24-1.el7 rh-php72-php-mysqlnd.x86_64 0:7.2.24-1.el7
  370. rh-php72-php-pdo.x86_64 0:7.2.24-1.el7 rh-php72-php-pear.noarch 1:1.10.5-1.el7
  371. rh-php72-php-process.x86_64 0:7.2.24-1.el7 rh-php72-php-xml.x86_64 0:7.2.24-1.el7
  372. rh-php72-php-zip.x86_64 0:7.2.24-1.el7 rh-php72-runtime.x86_64 0:1-2.el7
  373. zabbix-web.noarch 0:5.0.6-1.el7 zabbix-web-deps-scl.noarch 0:5.0.6-1.el7
  374. Complete!

数据库准备

  1. #MySQL安装准备
  2. [root@zabbix ~]# vi /etc/yum.repos.d/mysql-community.repo #编辑MySQL安装源
  3. [mysql57-community]
  4. name=MySQL 5.7 Community Server
  5. baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
  6. enabled=1 #此处改为1,其他版本则改为0
  7. gpgcheck=0 #此处改为0,不检查gpg-key
  8. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  9. #安装MySQL 5.7
  10. [root@zabbix ~]# yum -y install mysql-community-server
  11. Loaded plugins: fastestmirror, langpacks
  12. mysql57-community | 2.6 kB 00:00:00
  13. Loading mirror speeds from cached hostfile
  14. * base: mirrors.cn99.com
  15. * centos-sclo-rh: mirrors.cn99.com
  16. * centos-sclo-sclo: mirrors.cn99.com
  17. * extras: mirrors.cn99.com
  18. * updates: mirrors.cn99.com
  19. Resolving Dependencies
  20. --> Running transaction check
  21. ---> Package mysql-community-server.x86_64 0:5.7.32-1.el7 will be installed
  22. --> Processing Dependency: mysql-community-common(x86-64) = 5.7.32-1.el7 for package: mysql-community-server-5.7.32-1.el7.x86_64
  23. --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.32-1.el7.x86_64
  24. --> Running transaction check
  25. ---> Package mysql-community-client.x86_64 0:5.7.32-1.el7 will be installed
  26. --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.32-1.el7.x86_64
  27. ---> Package mysql-community-common.x86_64 0:5.7.32-1.el7 will be installed
  28. --> Running transaction check
  29. ---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be obsoleted
  30. --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
  31. --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  32. --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
  33. --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: zabbix-server-mysql-5.0.6-1.el7.x86_64
  34. ---> Package mysql-community-libs.x86_64 0:5.7.32-1.el7 will be obsoleting
  35. --> Running transaction check
  36. ---> Package mysql-community-libs-compat.x86_64 0:5.7.32-1.el7 will be obsoleting
  37. ---> Package postfix.x86_64 2:2.10.1-6.el7 will be updated
  38. ---> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
  39. --> Finished Dependency Resolution
  40. Dependencies Resolved
  41. ===========================================================================================================
  42. Package Arch Version Repository Size
  43. ===========================================================================================================
  44. Installing:
  45. mysql-community-libs x86_64 5.7.32-1.el7 mysql57-community 2.3 M
  46. replacing mariadb-libs.x86_64 1:5.5.56-2.el7
  47. mysql-community-libs-compat x86_64 5.7.32-1.el7 mysql57-community 1.2 M
  48. replacing mariadb-libs.x86_64 1:5.5.56-2.el7
  49. mysql-community-server x86_64 5.7.32-1.el7 mysql57-community 173 M
  50. Installing for dependencies:
  51. mysql-community-client x86_64 5.7.32-1.el7 mysql57-community 25 M
  52. mysql-community-common x86_64 5.7.32-1.el7 mysql57-community 308 k
  53. Updating for dependencies:
  54. postfix x86_64 2:2.10.1-9.el7 base 2.4 M
  55. Transaction Summary
  56. ===========================================================================================================
  57. Install 3 Packages (+2 Dependent packages)
  58. Upgrade ( 1 Dependent package)
  59. Total size: 205 M
  60. Downloading packages:
  61. Running transaction check
  62. Running transaction test
  63. Transaction test succeeded
  64. Running transaction
  65. Installing : mysql-community-common-5.7.32-1.el7.x86_64 1/8
  66. Installing : mysql-community-libs-5.7.32-1.el7.x86_64 2/8
  67. Installing : mysql-community-client-5.7.32-1.el7.x86_64 3/8
  68. Installing : mysql-community-libs-compat-5.7.32-1.el7.x86_64 4/8
  69. Updating : 2:postfix-2.10.1-9.el7.x86_64 5/8
  70. Installing : mysql-community-server-5.7.32-1.el7.x86_64 6/8
  71. Cleanup : 2:postfix-2.10.1-6.el7.x86_64 7/8
  72. Erasing : 1:mariadb-libs-5.5.56-2.el7.x86_64 8/8
  73. Verifying : 2:postfix-2.10.1-9.el7.x86_64 1/8
  74. Verifying : mysql-community-client-5.7.32-1.el7.x86_64 2/8
  75. Verifying : mysql-community-libs-compat-5.7.32-1.el7.x86_64 3/8
  76. Verifying : mysql-community-libs-5.7.32-1.el7.x86_64 4/8
  77. Verifying : mysql-community-server-5.7.32-1.el7.x86_64 5/8
  78. Verifying : mysql-community-common-5.7.32-1.el7.x86_64 6/8
  79. Verifying : 1:mariadb-libs-5.5.56-2.el7.x86_64 7/8
  80. Verifying : 2:postfix-2.10.1-6.el7.x86_64 8/8
  81. Installed:
  82. mysql-community-libs.x86_64 0:5.7.32-1.el7 mysql-community-libs-compat.x86_64 0:5.7.32-1.el7
  83. mysql-community-server.x86_64 0:5.7.32-1.el7
  84. Dependency Installed:
  85. mysql-community-client.x86_64 0:5.7.32-1.el7 mysql-community-common.x86_64 0:5.7.32-1.el7
  86. Dependency Updated:
  87. postfix.x86_64 2:2.10.1-9.el7
  88. Replaced:
  89. mariadb-libs.x86_64 1:5.5.56-2.el7
  90. Complete!
  91. #启动MySQL数据库
  92. [root@zabbix ~]#systemctl start mysqld
  93. #设为开机启动
  94. [root@zabbix ~]#systemctl enable mysqld
  95. #设置MySQL数据库root密码
  96. [root@zabbix ~]# grep 'temporary password' /var/log/mysqld.log #MySQL安装完成后,默认在/var/log/mysqld.log中会有默认密码
  97. 2020-12-07T00:31:45.104451Z 1 [Note] A temporary password is generated for root@localhost: wv,fe76Re:pg
  98. #将密码修改为'passwd1!'提示不满足当前安全策略
  99. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'passwd1!';
  100. ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
  101. [root@zabbix ~]# vim /etc/my.cnf #修改默认密码策略
  102. [mysqld]
  103. #
  104. # Remove leading # and set to the amount of RAM for the most important data
  105. # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
  106. # innodb_buffer_pool_size = 128M
  107. #
  108. # Remove leading # to turn on a very important data integrity option: logging
  109. # changes to the binary log between backups.
  110. # log_bin
  111. #
  112. # Remove leading # to set options mainly useful for reporting servers.
  113. # The server defaults are faster for transactions and fast SELECTs.
  114. # Adjust sizes as needed, experiment to find the optimal values.
  115. # join_buffer_size = 128M
  116. # sort_buffer_size = 2M
  117. # read_rnd_buffer_size = 2M
  118. datadir=/var/lib/mysql
  119. socket=/var/lib/mysql/mysql.sock
  120. # Disabling symbolic-links is recommended to prevent assorted security risks
  121. symbolic-links=0
  122. log-error=/var/log/mysqld.log
  123. pid-file=/var/run/mysqld/mysqld.pid
  124. validate_password_policy=0 #添加此行
  125. # #Mysql默认的密码策略
  126. validate_password_policy:密码策略,默认为MEDIUM策略
  127. validate_password_dictionary_file:密码策略文件,策略为STRONG才需要
  128. validate_password_length:密码最少长度
  129. validate_password_mixed_case_count:大小写字符长度,至少1个
  130. validate_password_number_count :数字至少1个
  131. validate_password_special_char_count:特殊字符至少1个
  132. #修改密码策略后需重启Mysql服务后,方可修改密码
  133. [root@zabbix ~]# systemctl restart mysqld
  134. [root@zabbix ~]# mysql -uroot -p
  135. Enter password:
  136. Welcome to the MySQL monitor. Commands end with ; or g.
  137. Your MySQL connection id is 2
  138. Server version: 5.7.32
  139. Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  140. Oracle is a registered trademark of Oracle Corporation and/or its
  141. affiliates. Other names may be trademarks of their respective
  142. owners.
  143. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
  144. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'passwd1!';
  145. Query OK, 0 rows affected (0.00 sec)
  146. #创建zabbix数据库,设置字符集为uft-8
  147. mysql> create database zabbix character set utf8 collate utf8_bin;
  148. #创建zabbix用户,密码为'passwd1!'
  149. mysql> create user zabbix@localhost identified by 'passsd1!';
  150. #允许zabbix访问zabbix*数据库
  151. mysql> grant all privileges on zabbix.* to zabbix@localhost;
  152. mysql> quit;
  153. #导入初始架构和数据,系统将提示您输入新创建zabbix用户的密码
  154. [root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
  155. Enter password:
  156. 为Zabbix server配置数据库
  157. [root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf
  158. # Database user.
  159. #
  160. # Mandatory: no
  161. # Default:
  162. # DBUser=
  163. DBUser=zabbix
  164. ### Option: DBPassword
  165. # Database password.
  166. # Comment this line if no password is used.
  167. #
  168. # Mandatory: no
  169. # Default:
  170. DBPassword=passwd1! #修改此行,将zabbix用户数据库密码填上
  171. ### Option: DBSocket
  172. # Path to MySQL socket.
  173. #
  174. # Mandatory: no
  175. # Default:
  176. # DBSocket=

nginx环境配置

  1. [root@zabbix ~]# vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
  2. server {
  3. listen 80; #去掉注释,监听80端口
  4. server_name example.com; #去掉此行注释
  5. root /usr/share/zabbix;
  6. index index.php;
  7. location = /favicon.ico {
  8. log_not_found off;
  9. }
  10. location / {
  11. try_files $uri $uri/ =404;
  12. }
  13. location /assets {
  14. access_log off;
  15. expires 10d;
  16. }
  17. location ~ /.ht {
  18. deny all;
  19. }
  20. location ~ /(api/|conf[^.]|include|locale) {
  21. deny all;
  22. return 404;
  23. }
  24. #修改nginx配置
  25. [root@zabbix zabbix]# vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
  26. ... ...
  27. server {
  28. listen 8080 default_server; #因zabbix server占用80端口,此处改为8080
  29. listen [::]:80 default_server;
  30. server_name _;
  31. root /opt/rh/rh-nginx116/root/usr/share/nginx/html;
  32. # Load configuration files for the default server block.
  33. include /etc/opt/rh/rh-nginx116/nginx/default.d/*.conf;
  34. location / {
  35. }
  36. error_page 404 /404.html;
  37. ......
  38. #为Zabbix前端配置PHP
  39. [root@zabbix ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
  40. [zabbix]
  41. user = apache
  42. group = apache
  43. listen = /var/opt/rh/rh-php72/run/php-fpm/zabbix.sock
  44. listen.acl_users = apache,nginx #修改此行,添加nginx用户
  45. listen.allowed_clients = 127.0.0.1
  46. pm = dynamic
  47. pm.max_children = 50
  48. pm.start_servers = 5
  49. pm.min_spare_servers = 5
  50. pm.max_spare_servers = 35
  51. php_value[session.save_handler] = files
  52. php_value[session.save_path] = /var/opt/rh/rh-php72/lib/php/session/
  53. php_value[max_execution_time] = 300
  54. php_value[memory_limit] = 128M
  55. php_value[post_max_size] = 16M
  56. php_value[upload_max_filesize] = 2M
  57. php_value[max_input_time] = 300
  58. php_value[max_input_vars] = 10000
  59. php_value[date.timezone] = Asia/Shanghai #修改此处时区,改为亚洲/上海
  60. #启动Zabbix server和agent进程
  61. [root@zabbix ~]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
  62. #设为开机启动
  63. [root@zabbix ~]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
  64. Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
  65. Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
  66. Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
  67. 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.

前端准备安装

打开浏览器进入http://你的zabbix服务器ip

88972eec018fd55_1_post.png

下一步,环境检查,全部ok后,下一步

88f209da95fa1cb_1_post.png

确认数据库配置,输入之前新建的zabbix数据库用户密码,下一步继续安装

88fbea9cdc0fd5d_1_post.png

确认Zabbix服务端信息,命名,下一步安装

88f1ce609512bdd_1_post.png

确认配置,下一步继续安装

889f60537fc1fd5_1_post.png

88d91d6c615f156_1_post.png

使用默认账号Admin密码zabbix,登录提示

882a4c91f58ecdf_1_post.png

修改时区为UTC

  1. [root@zabbix zabbix]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
  2. ...
  3. php_value[date.timezone] = UTC
  4. ...
  5. #修改配置后重启服务
  6. [root@zabbix zabbix]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

881d59d6ddc68bf_1_post.png


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK