安装zabbix3.0

系统环境

[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@centos7 ~]# uname -r
3.10.0-862.el7.x86_64
[root@centos7 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@centos7 ~]# getenforce 
Disabled

如何下载zabbix服务端

官网下载地址:https://www.zabbix.com/download

 centos7.5安装zabbix3.0_第1张图片

zabbix服务端安装


配置好时间同步

cat >>/var/spool/cron/root </dev/null
EOF

下载

官网下载地址:https://www.zabbix.com/download

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

为什么选择zabbix-release版本:

   因为下载这个版本会在yum.repos.d下面生成一个zabbix.repo的文件

检查是否下载成功:主要检查/etc/yum.repos.d/目录中没有zabbix.repo这个文件

[root@centos7 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo  zabbix.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  epel.repo

关闭防火墙

  systemctl stop firewalld


安装软件

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


修改PHP时区设置

sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf


启动mysql并创建zabbix库与zabbix用户

systemctl start mariadb.service

mysql -e 'create database zabbix character set utf8 collate utf8_bin;'

mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'


导入zabbix数据至数据库

方法一:

   gzip -d /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql.gz

   mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql

   #版本不同时

   #gzip -d /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz

   #mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql

方法二:

   zcat /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql.gz|mysql -uzabbix -pzabbix zabbix

   #版本不同时

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


配置zabbix配置文件

sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf


解决中文乱码

yum -y install wqy-microhei-fonts

\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf


启动服务

systemctl start zabbix-server

systemctl start httpd


浏览器访问

访问地址是:

   echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"

centos7.5安装zabbix3.0_第2张图片

 

快速安装命令

rpm -ivh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
cat /etc/yum.repos.d/zabbix.repo 
yum install zabbix-server-mysql zabbix-web-mysql mariadb-server -y
rpm -qa zabbix-server-mysql zabbix-web-mysql mariadb-server
yum install zabbix-server-mysql zabbix-web-mysql mariadb-server -y
sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
systemctl start mariadb.service
mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
gzip -d /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz
mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
systemctl start zabbix-server
systemctl start httpd