zabbix5.0 MySQL体验

参考:

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 all

b. Install Zabbix server and agent

[root@redhat7 yum.repos.d]# yum install zabbix-server-mysql zabbix-agent

c. Install Zabbix frontend

Enable Red Hat Software Collections

[root@redhat7 ~]# yum-config-manager --enable rhel-server-rhscl-7-rpms
Loaded plugins: fastestmirror, product-id

Edit 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-A14FE591

Install Zabbix frontend packages.

[root@redhat7 ~]# yum install centos-release-scl-rh
[root@redhat7 conf.d]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

d. 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 zabbix

e. 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=mysqld

f. 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/Shanghai

g. 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-fpm

h. 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"

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值