CentOS7.x yum源安装zabbix4.x

安装zabbix:

  • 1. 首先添加zabbix仓库(若国外源失败可以改用国内yum源)

rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

  • 2. 安装zabbix-server

yum install zabbix-server-mysql

  • 3. 安装zabbix-front-web

yum install zabbix-web-mysql

  • 4. 安装mariadb数据库

yum install mariadb-server

systemctl start mariadb #启动数据库
systemctl enable mariadb #设置开机自动启动数据库服务
create database zabbix character set utf8 collate utf8_bin; # 创建数据库,名称为zabbix,并且字符为utf8.
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; # 授权zabbix用户从localhost访问,
# 对zabbix数据库有完全控制权限。
flush privileges; # 刷新权限
quit # 退出
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix # 初始化数据结构并导入数据

针对zabbix-server配置数据库:
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost # 数据库主机
DBName=zabbix # 数据库名称
DBUser=zabbix # 数据库用户名
DBPassword=<password> # 数据库密码

  • 5. 启动zabbix-server

(1) 设置开机自启zabbix-server
systemctl enable zabbix-server

(2) 启动zabbix-server服务
systemctl start zabbix-server

  • 6. 设置zabbix-front

vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

(2) 启动前端访问的httpd
systemctl start httpd
ystemctl enable httpd

注意事项:关闭selinux和firwealld

  • 7. 初始配置

(1)打开http://server_ip/zabbix
默认的用户名:Admin 密码:zabbix

 

安装zabbix-agent:

  • 1. 添加zabbix仓库

rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

  • 2. 使用如下命令安装zabbix-agent

yum install zabbix-agent -y

  • 3. 启动zabbix-agent服务

systemctl start zabbix-agent
systemctl enable zabbix-agent


校验我们所安装的是否正常:
通过以下命令进行校验:

netstat -nltup
ss -tunlp
zabbix-server监听端口为tcp 10051

猜你喜欢

转载自www.cnblogs.com/caiqing/p/12678836.html