在CentOS7中安装5.0zabbix

5.0

准备工作 CentOS 7.8 虚拟机 XShell6/7软件SSH远程登录调试

官网找到需要的yum源,Zabbix 的yum源
https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
阿里yum源
https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
组件
https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/x86_64/

一.
1.1关闭防火墙
查看默认防火墙状态,关闭后显示not running,开启后显示running
#firewall-cmd --state

[root@Zabbix server ~]# firewall-cmd --state
not running
[root@Zabbix server ~]# 

临时关闭firewall

#systemctl stop firewalld.service 

禁止firewall开机启动

#systemctl disable firewalld.service 
[root@Zabbix server ~]# systemctl stop firewalld
[root@Zabbix server ~]# systemctl disable firewalld
[root@Zabbix server ~]# 

1.2关闭SELINUX
将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效
检测selinux是否关闭,Disabled 为关闭
#cat /etc/selinux/config
#getenforce

[root@Zabbix server ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 


[root@Zabbix server ~]# getenforce
Disabled
[root@Zabbix server ~]# 

二.部署5.0zabbix服务器
2.1 安装zabbix的yum源

[root@Zabbix server ~]#rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@Zabbix server ~]#
[root@Zabbix server ~]# ls /etc/yum.repos.d/ |grep zabbix
zabbix.repo
[root@Zabbix server ~]# 

查看文件已有zabbix.repo

[root@Zabbix server ~]# cat /etc/yum.repos.d/zabbix.repo 
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1


打开然后用阿里yum替换官方yum 为了下载安装更快防止入坑
保存退出。

vim /etc/yum.repos.d/zabbix.repo

查看安装包是否就位

[root@Zabbix server ~]# yum list | grep zabbix 
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
fping.x86_64                               3.16-1.el7             @zabbix-non-supported
zabbix-agent.x86_64                        5.0.25-1.el7           @zabbix       
zabbix-apache-conf-scl.noarch              5.0.25-1.el7           @zabbix-frontend
zabbix-release.noarch                      5.0-1.el7              installed     
zabbix-server-mysql.x86_64                 5.0.25-1.el7           @zabbix       
zabbix-web.noarch                          5.0.25-1.el7           @zabbix-frontend
zabbix-web-deps-scl.noarch                 5.0.25-1.el7           @zabbix-frontend
zabbix-web-mysql-scl.noarch                5.0.25-1.el7           @zabbix-frontend
iksemel.x86_64                             1.4-2.el7.centos       zabbix-non-supported
iksemel-devel.x86_64                       1.4-2.el7.centos       zabbix-non-supported
iksemel-utils.x86_64                       1.4-2.el7.centos       zabbix-non-supported
pcp-export-pcp2zabbix.x86_64               4.3.2-13.el7_9         updates       
pcp-export-zabbix-agent.x86_64             4.3.2-13.el7_9         updates       
zabbix-agent2.x86_64                       5.0.25-1.el7           zabbix        
zabbix-get.x86_64                          5.0.25-1.el7           zabbix        
zabbix-java-gateway.x86_64                 5.0.25-1.el7           zabbix        
zabbix-js.x86_64                           5.0.25-1.el7           zabbix        
zabbix-nginx-conf-scl.noarch               5.0.25-1.el7           zabbix-frontend
zabbix-proxy-mysql.x86_64                  5.0.25-1.el7           zabbix        
zabbix-proxy-pgsql.x86_64                  5.0.25-1.el7           zabbix        
zabbix-proxy-sqlite3.x86_64                5.0.25-1.el7           zabbix        
zabbix-sender.x86_64                       5.0.25-1.el7           zabbix        
zabbix-server-pgsql.x86_64                 5.0.25-1.el7           zabbix        
zabbix-web-deps-scl-php73.noarch           5.0.25-1.el7           zabbix-frontend
zabbix-web-japanese.noarch                 5.0.25-1.el7           zabbix-frontend
zabbix-web-mysql-scl-php73.noarch          5.0.25-1.el7           zabbix-frontend
zabbix-web-pgsql-scl.noarch                5.0.25-1.el7           zabbix-frontend
zabbix-web-pgsql-scl-php73.noarch          5.0.25-1.el7           zabbix-frontend

2.2安装Zabbix服务,代理

yum -y install zabbix-server-mysql zabbix-agent

安装CentOS扩展软件库

yum -y install centos-release-scl

2.3安装数据库

yum -y install mariadb-server mariadb
systemctl start mariadb 			#启动数据库
systemctl enable mariadb 			#设置数据库开机启动
mysql_secure_installation 			#数据库初始化

安装数据库初始化文件和Nginx

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

创建数据库,用户并未给数据库用户授予权限。

#mysql -uroot -p
Enter password:
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> create user zabbix@localhost identified by '密码';
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
MariaDB [(none)]> quit;

初始化数据库

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

配置zabbix服务的数据库

vi /etc/zabbix/zabbix_server.conf 			#将文件内容做如下修改DBPassword=password

2.4配置PHP环境

修改配置文件vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
将PHP时区修改为Asia/Shanghai
php_value[date.timezone] = Asia/Shanghai

启动zabbix和agent服务

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

三、软件配置
打开浏览器进行Zabbix初始化,在浏览器地址栏输入http://IP/zabbix,进入初始化界面如图:

http://IP/zabbix

默认账号密码Admin zabbix

切换中文界面
在这里插入图片描述

完成安装

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值