1、环境准备
---初始工具下载
yum install wget openssl-devel -y
---Centos7更换yum源
cd /etc/yum.repo.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
---清理和制作缓存
yum clean all
yum makecache
---关闭防火墙和selinux
#关闭selinux
setenforce 0
#修改selinux配置文件,永久生效;
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#暂时关闭防火墙
systemctl stop firewalld &> /dev/null
#永久关闭防火墙
systemctl disable firewalld &> /dev/null
#清除防火墙规则
iptables -F
#暂时关闭NetworkManager
systemctl stop NetworkManager
#永久关闭NetworkManager
systemctl disable NetworkManager
---修改主机名,IP,hosts
#查看IP
ip addr
#修改IP
vi /etc/sysconfig/network-scripts/ifcfg-ens33 #ens33,网卡名称
#重启网络服务
systemctl restart network
#修改主机名
hostname set-hostname zabbix
#修改hosts
vi /etc/hosts
192.168.1.250 zabbix
2、安装zabbix5
---安装zabbix5服务端
#安装repo、server、agent
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y
#zabbix-frontend模块第11行,enabled=0改成enabled=1
sed -i '11s/0/1/' /etc/yum.repos.d/zabbix.repo
#安装frontend包
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
---安装数据库
#安装mariadb数据库
yum install mariadb mariadb-server -y
#启动数据库
service mariadb start
#设置开机启动mariadb数据库
systemctl enable mariadb
#查看进程及端口状态
ps aux|grep mysql
netstat -anplut
#登录数据库
mysql -u root -p
#创建一个数据库,数据库名称为zabbix
create database zabbix character set utf8 collate utf8_bin;
#创建一个用户,用户名为zabbix;密码为:123456
create user zabbix@localhost identified by '123456';
#授予zabbix用户对zabbix数据库拥有完全权限
grant all privileges on zabbix.* to zabbix@localhost;
#退出数据库;
quit;
#导入Mysql数据库初始架构和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p 123456
---更改zabbix配置文件
vi /etc/zabbix/zabbix_server.conf
#123456为数据库密码
DBPassword=123456
---启动zabbix的server和agent
#启动服务和开机自动启动
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
#查看服务状态
systemctl status zabbix-server zabbix-agent httpd rh-php72-php-fpm
---登录zabbix前端
默认的用户名为:Admin 密码为:zabbix
标签:repo,server,---,zabbix,systemctl,yum,安装 From: https://blog.csdn.net/weixin_52037378/article/details/140295478