参考:
https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=7&db=mysql&ws=nginx
a. Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm这里到zabbix的官方源不通,需要更换为国内的源,替换baseurl即可
[root@redhat7 yum.repos.d]# cat zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1 [root@redhat7 yum.repos.d]# yum clean allb. Install Zabbix server and agent
[root@redhat7 yum.repos.d]# yum install zabbix-server-mysql zabbix-agentc. Install Zabbix frontend
Enable Red Hat Software Collections
[root@redhat7 ~]# yum-config-manager --enable rhel-server-rhscl-7-rpms Loaded plugins: fastestmirror, product-idEdit file /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 --修改这里 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591Install Zabbix frontend packages.
[root@redhat7 ~]# yum install centos-release-scl-rh [root@redhat7 conf.d]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scld. Create initial database
[root@redhat7 ~]# yum -y install mariadb-server mariadb [root@redhat7 ~]# systemctl start mariadb [root@redhat7 ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.65-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)]> create user zabbix@localhost identified by 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.00 sec)
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
[root@redhat7 ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbixe. Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
[root@redhat7 ~]# cat /etc/zabbix/zabbix_server.conf |grep DBPassword ### Option: DBPassword # DBPassword= DBPassword=mysqldf. Configure PHP for Zabbix frontend
Edit file /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, uncomment and set the right timezone for you.
; php_value[date.timezone] = Asia/Shanghaig. Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
[root@redhat7 conf.d]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm [root@redhat7 conf.d]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpmh. Configure Zabbix frontend
Connect to your newly installed Zabbix frontend: http://server_ip_or_name Follow steps described in Zabbix documentation: Installing frontend
前端配置:
[root@redhat7 ~]# vi /etc/opt/rh/rh-php72/php.ini date.timezone = "Asia/Shanghai"