Centos 8 安裝 Zabbix 4.4

1、選擇安裝zabbix服務器的平臺

此處我們選擇的是 zabbix 4.4 + Centos 8 + MySQL + Apache

2、在平臺上安裝和配置zabbix服務

  • 更新 Centos 8的軟件包
<code>dnf update -y/<code>
  • 關閉SELinux
<code>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
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted/<code>
  • adding zabbix repository
<code>rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm

dnf clean all/<code>
  • 安裝 zabbix server,web前端,agent
<code>dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent mariadb-server mairadb -y/<code>
  • 啟動 MySQL 、Apache 服務
<code>systemctl start mairadb httpd

systemctl enable mariadb httpd/<code>
  • 創建數據庫密碼
<code>mysql -u root

update user set password = password("zabbixpasswd")where user = 'root';

flush privileges;

quit;

或者使用 mysql_secure_installation 根據指引一步一步來。/<code>
  • 創建 zabbix 的數據庫和用戶
<code>mysql -uroot -p zabbixpasswd
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user 'zabbix'@'localhost' identified by 'zabbixpasswd';
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
mysql> quit;/<code>
  • 導入初始架構和數據,系統將提示輸入新創建的密碼
<code>zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix/<code>
  • 配置 zabbix server 數據庫
<code>vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbixpasswd/<code>
  • 修改 php.ini 的時區和參數
<code>vim /etc/php.ini

找到 date.timezone

date.timezone = Asia/Shanghai/<code>
  • 修改web前端的時區或者php參數(參數可不調,此處略做tiao'z)
<code>php_value[max_execution_time] = 600
php_value[memory_limit] = 512M
php_value[post_max_size] = 64M
php_value[upload_max_filesize] = 200M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
; php_value[date.timezone] = Asia/Shanghai/<code>
  • 啟動 zabbix server and agent process
<code>systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm/<code>
  • 添加防火牆端口或者關閉防火牆(不安全)
<code>添加端口:

firewall-cmd --add-port={10050/tcp,10051/tcp} --permanent

firewall-cmd --add-service={http,https} --permanent

systemctl restart firewalld



關閉防火牆:

systemctl stop firewalld(臨時)


systemctl disable firewalld(永久)/<code>
  • 因為安裝Centos 8 選擇的是英文版,要zabbix中文顯示需要安裝中文包
<code>dnf install langpacks-zh_CN.noarch -y/<code>
  • 通過瀏覽器訪問zabbix進行最後的步驟完成確認,即可使用zabbix:

http://x.x.x.x/zabbix


Centos 8 安裝 Zabbix 4.4

Zabbix 4.4.6. © 2001–2020, Zabbix SIA


分享到:


相關文章: