目录
1、Install Zabbix repository
2、Install Zabbix server and agent
3、Install Zabbix frontend
4、Install Zabbix frontend packages.
5、创建初始数据库
6、从mysql官网获取yum源
7、下载到服务器
7.1、安装下载好的rpm包
7.2、查看MySQL的版本
7.3、安装5.7要去zabbix的yum源里面关闭掉8.0的源
7.4、然后查看mysql8.0的源是否被关闭
7.5、安装MySQL
8、开启msyql服务
8.1、改默认密码
9、在数据库主机上运行以下代码。
9.1、导入初始架构和数据,系统将提示您输入新创建的密码。
9.2、为Zabbix server配置数据库
9.3、为Zabbix前端配置PHP
10、启动Zabbix server和agent进程,并为它们设置开机自启:
11、登录zabbix并且把英文界面改成中文。
# 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 install zabbix-server-mysql zabbix-agent
# yum install centos-release-scl
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
Make sure you have database server up and running.
安装mysql5.7
mysql官方下载页:https://dev.mysql.com/downloads/https://dev.mysql.com/downloads/
目前在官网下载 jdk以及其他oracle公司的产品的时候需要登陆,这边分享一个账号,方便下载
密码:OraclePassword123!
这里选择el7的版本
wget https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
rpm -Uvh mysql80-community-release-el7-5.noarch.rpm
yum repolist all | grep mysql
注:这里显示8.0是开启的5.7是关闭的所以要去关掉8.0开启5.7的yum源。
vi /etc/yum.repos.d/mysql-community.repo
yum repolist all | grep mysql
yum install mysql-community-server
开启服务
systemctl start mysqld
查看状态
systemctl status mysqld
[root@localhost ~]# grep -i "password" /var/log/mysqld.log 2021-05-28T02:42:52.290430Z 1 [Note] A temporary password is generated for root@localhost: cSNlQY/Qr1KU
[root@localhost ~]# mysqladmin -u root -p password "WWW.1.com" Enter password:
然后输入上面的默认密码。
# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> quit;
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, uncomment and set the right timezone for you.
; php_value[date.timezone] = Europe/Riga
换成亚洲上海
php_value[date.timezone] = Asia/Shanghai
# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
http:ip/zabbix
用户名:Admin
密码:zabbix