centos8.5部署zabbix6.0

centos8.5部署zabbix6.0

系统环境

CentOS Linux release 8.5.2111

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

部署lamp环境

zabbix 6.0 需要 安装10.6.5以上的Mariadb,系统自带的为10.5,需要配置新的yum源。

cat <<EOF > /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = https://mirrors.cloud.tencent.com/mariadb/yum/10.6/centos8-amd64
module_hotfixes=1
gpgkey=https://mirrors.cloud.tencent.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
dnf install mariadb mariadb-server httpd httpd-tools php php-cli php-json php-gd php-mbstring php-pdo php-xml php-mysqlnd php-pecl-zip wget -y

配置zabbix

rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
dnf clean all
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2 -y

配置mysql

systemctl start mariadb && systemctl enable mariadb
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@'localhost' identified by '123456'; #创建用户并授权
flush privileges;
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix #导入数据

配置zabbix_server

[root@localhost ~]# cat /etc/zabbix/zabbix_server.conf |grep -v "^#"|grep -v "^$"
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbix/zabbix_server.pid
SocketDir=/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=123456 #配置密码
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1

启动zabbix

systemctl restart zabbix-server zabbix-agent2 httpd php-fpm #启动zabbix_server
systemctl enable zabbix-server zabbix-agent2 httpd php-fpm #启动zabbix_agent

访问zabbix

http://ip/zabbix ,账户/密码:Admin /zabbix

安装报错

报错:Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist,Centos8于2021年年底停止了服务,在使用yum源安装时候,出现这个”错误“。

1、进入yum的repos目录
cd /etc/yum.repos.d/

2、修改所有的CentOS文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

3、更新yum源为阿里镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all
yum makecache

4、yum安装测试是否可以yum安装
yum install wget –y

报错:You are not able to choose some of the languages, because locales for them are not installed on the web server.

# 服务器没有安装中文包导致的,执行以下命令安装。
dnf reinstall glibc-common
dnf install langpacks-zh_CN.noarch
locale -a #查看是否安装成功
posted @ 2023-02-28 21:25  trouble03  阅读(233)  评论(0)    收藏  举报