#####zabbix5.0安装搭建

准备开始

关闭防火墙

sed -ri '/^[^#]*SELINUX=/s#=.+$#=disabled#' /etc/selinux/config
# systemctl stop firewalld
# systemctl disable firewalld
setenforce 0

安装httpd包 yum install -y httpd 

##启动开机服务

[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl enable httpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

zabbix源地址

[root@localhost 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-A14FE59

安装zabbix server 、agent 和安装 zabbix 前端源和相关环境

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

##安装mysql
yum install -y mysql-community-server
启动mysql服务

[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]# systemctl enable mysqld

##查找mysql密码
grep "password" /var/log/mysqld.log

[root@localhost ~]# grep "password" /var/log/mysqld.log
2022-06-24T07:08:45.376755Z 1 [Note] A temporary password is generated for root@localhost: kgoMhJ?L=4:U   ###为随机密码

##在mysql的配置文件末尾添加以下内容 意为:去掉mysql数据库密码复杂权限
vim /etc/my.cnf 

plugin-load=validate_password.so
validate-password=OFF
character-set-server=utf8
innodb_file_per_table=1

保存退出
##重启mysql服务systemctl restart mysqld
##进入mysql更改密码并且给zabbix添加账户

[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]# mysql -uroot -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password for root@localhost = password('admin'); 
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec)

mysql> 

##导入数据至mysql的zabbix账户中,zabbix 数据库用户为 zabbix,密码为zabbix

[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-5.0.20/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:  zabbix   ##密码

为Zabbix前端配置PHP文件里的时区

[root@localhost ~]#vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai

为Zabbix server配置数据库

[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix

启动zabbix ,http,rh-php72-php-fpm服务,并配置开机自动启动

[root@localhost ~]#systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]#systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.

浏览器访问zabbix 的 web 页面,http://ip/zabbix 

 

 配置mysql数据库zabbix账号密码

 此zabbix前端配置完成,输入账号Admin密码zabbix

将页面修改成中文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机灵的小小子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值