CentOS7 安装 Zabbix4.0
准备 Yum 源
# 备份 Yum 源
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
# CentOS7 Zabbix4.0 Yum源
echo "[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.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=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1" > /etc/yum.repos.d/zabbix.repo
# epel & CentOS7.5(1804) Yum源
echo "[epel]
name=epel
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/
gpgcheck=0
enabled=1
[centos]
name=centos
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.5.1804/os/x86_64/
gpgcheck=0
enabled=1" > /etc/yum.repos.d/repo.repo
# 清除缓存,查看 Yum 列表
yum clean all
yum repolist
下载 服务端程序
yum install -y zabbix-server-mysql zabbix-web-mysql
yum install -y mariadb-server
配置 数据库
systemctl start mariadb && systemctl enable mariadb
mysql_secure_installation
#回车 第一个N 其他Y
mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
cd /usr/share/doc/zabbix-server-mysql-4.0.34/
zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix
配置 服务端
vim /etc/zabbix/zabbix_server.conf
# 修改 连接数据库相关配置
# DBHost=localhost < 数据库 IP >
# DBName=zabbix < 数据库名>
# DBUser=zabbix < 数据库用户>
# DBPassword=zabbix < 数据库密码>
vim /etc/httpd/conf.d/zabbix.conf
# 修改时区 (去除注释)
# php_value date.timezone Asia/Shanghai
systemctl start zabbix-server && systemctl enable zabbix-server
systemctl start httpd && systemctl enable httpd
yum install -y net-tools
netstat -lntp
# 检查 是否有 Zabbix-server (10051) 端口
# 登录 zabbix 网页设置
添加 监控主机
yum install -y zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
# 修改服务端 IP
# Server=127.0.0.1
systemctl start zabbix-agent && systemctl enable zabbix-agent
# 网页添加 监控主机
评论