CentOS7安装Zabbix4.0.19

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7安装Zabbix4.0.19相关的知识,希望对你有一定的参考价值。

环境:
CentOS-7.6-x86_64-minimal
系统安装完毕后关闭selinux这坑货
setenforce 0
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config

先更新系统
yum -y install wget vim-enhanced
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/{*.repo,backup}
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.163.com/.help/CentOS7-Base-163.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
rpm -ivh https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
rm -rf /var/cache/yum
rm -rf /var/cache/man
yum makecache
yum -y update

1.安装zabbix
yum -y install zabbix-web-mysql zabbix-server-mysql mariadb-server
2.启动并初始化mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
systemctl status mariadb.service
mysql_secure_installation

3.创建zabbix数据库
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@localhost identified by ‘123456‘;

4.导入zabbix数据库
cd /usr/share/doc/zabbix-server-mysql-4.0.19
gzip -d create.sql.gz
mysql -uzabbix -p123456 zabbix <create.sql

5.配置zabbix_server内数据库连接
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

6.配置时区
配置vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

7.防火墙放行80端口或者实验环境下关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
或者
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --query-port=80/tcp
firewall-cmd --reload

8.启动httpd和zabbix-server
systemctl start httpd zabbix-server.service
systemctl enable httpd zabbix-server.service
systemctl status httpd zabbix-server.service

9.浏览器输入http://ip/zabbix
进行相关设置后即可登入。

10.主机localhost监控
直接安装zabbix-agent
yum -y install zabbix-agent
systemctl start zabbix-agent

11.远程Linux主机监控
yum -y install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
第95行Server后面敲逗号,附加上zabbix监控server端的IP地址,然后启动或重启zabbix-agent
在zabbix-server的GUI端进行主机添加。

以上是关于CentOS7安装Zabbix4.0.19的主要内容,如果未能解决你的问题,请参考以下文章

Centos7.6下zabbix4.0的安装配置

CentOS 7 yum安装Zabbix

使用 Zabbix 监控私有信息-邮件报警

Centos 7.0 下安装 Zabbix server 服务器的安装及 监控主机的加入

LAMP编译安装——安装xcache-3.2.0

LAMP编译安装——安装php-5.6.27