首页 > 技术文章 > [CentOS7 Zabbix 5.0 安裝過程] (2020/09/25 更新)

jbite9057 2019-12-09 20:51 原文

 

1. 關閉selinux
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

2. 重啟電腦
reboot

3. 更改防火牆設定
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
systemctl restart firewalld

4. 修改reposi位置

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum makecache

yum -y update

5. 安裝所需套件
5.1 mysql apache
yum -y install httpd mariadb*
systemctl enable mariadb
systemctl restart mariadb

5.2 安裝zabbix套件

yum install -y centos-release-scl
yum -y install zabbix-server-mysql zabbix-agent zabbix-web-mysql

編輯repo配置

vim /etc/yum.repos.d/zabbix.repo

[zabbix-frontend]
...
enabled=1
...

5.3 安裝zabbix前端

yum install -y zabbix-web-mysql-scl zabbix-nginx-conf-scl 

5.4 安裝相依套件
yum -y install php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel net-snmp-utils perl-DBI

6. 設定mysql
mysql

create database zabbix character set utf8 collate utf8_bin;

grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';

quit;

 

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

7. 設定zabbix server

7.1

vi /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBUser=zabbix
DBPassword=zabbix --> same as you create at step 6

7.2 

vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf

server {

  listen 8080;

       server_name example.com;

     .....

}

7.3

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

listen.acl_users = apache,nginx

php_value[date.timezone = Asia/Taipei

8. 服務重啟

systemctl start zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

10. 透過瀏覽器登入zabbix
http://<IP>/zabbix

推荐阅读