登录后台

页面导航

本文编写于 320 天前,最后修改于 182 天前,其中某些信息可能已经过时。

环境centos7+zabbix3.4

zabbix默认使用国外源,若电脑无法访问外国网站可以手动切换本地yum源来进行安装

mkdir -p /data/software/yum
cd /data/software/yum
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
cd /etc/yum.repos.d
wget http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
rm -f/var/run/yum.pid
rm -f /var/run/yum.pid
yum clean all
yum makecache
yum update

切换阿里源,并安装epel源,epel包含yum源一些不包含的包

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum install epel-release

下载zabbix3.4 release包

rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

安装数据库、服务端、客户端等

yum install zabbix-web-mysql zabbix-server-mysql zabbix-server zabbix-agent mariadb-server

启动数据库,创建zabbix库,并授予zabbix账号所有权限

systemctl start mariadb
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

数据库导入zabbix库初始架构

cd /usr/share/doc/zabbix-server-mysql-3.4.15/
zcat create.sql.gz |mysql -uroot zabbix -p

编辑zabbix配置文件,关闭防火墙,关闭selinux,并启动zabbix

vim /etc/zabbix/zabbix_server.conf 
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBPort=3306
vim /etc/selinux/config
SELINUX=disable
setenforce 0
systemctl stop firewalld
systemctl status zabbix-server

编辑Apache配置文件,主要参数默认配置完成,只需修改时区即可

vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/ShangHai
systemctl start httpd

浏览器输入服务器地址/zabbix 可进入zabbix引导界面

解决中文乱码

vim /usr/share/zabbix/include/defines.inc.php
67 define('ZBX_GRAPH_FONT_NAME',           'simkai'); // font file name
#修改第67行的simkai