linux redhat7.0 zabbix4.0的安装和部署

系统运维

4.0中文版安装手册

https://www.zabbix.com/documentation/4.0/zh/manual
zabbix清华源下载地址:https://mirrors.tuna.tsinghua.edu.cn/zabbix/ 

安装步骤:

1. 下载安装zabbix的release的rpm包(安装完后会自动生成zabbix的yum源)
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
rpm -ql zabbix-release 查看是否安装成功
/etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
/etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
/etc/yum.repos.d/zabbix.repo
/usr/share/doc/zabbix-release-4.0
/usr/share/doc/zabbix-release-4.0/GPL
2. 替换成清华的yum源(这样是为了下载速度快)
vim /etc/yum.repos.d/zabbix.repo
[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-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
3 .安装 zabbix-server-mysql  zabbix-web-Mysql
yum install zabbix-server-MYSQL yum install zabbix-server-mysql -y
-----------------------------------------
如有报错提示
错误:软件包:zabbix-server-mysql-3.0.25-1.el7.x86_64 (zabbix)
需要:libiksemel.so.3()(64bit)
错误:软件包:zabbix-server-mysql-3.0.25-1.el7.x86_64 (zabbix)
需要:fping
----------------------------------------------------------
解决方法:添加epel.repo源
vim /etc/yum.repo/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.ucloud.cn/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.ucloud.cn/epel/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.ucloud.cn/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=http://mirrors.ucloud.cn/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.ucloud.cn/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=http://mirrors.ucloud.cn/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1
---------------------------------------------------
如有报错:
Error: Package: zabbix-server-mysql-3.4.15-1.el7.x86_64 (zabbix)

       Requires: libiksemel.so.3()(64bit)
-----------------------------------
解决方法:
yum install -y http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64/iksemel-1.4-6.sdl7.x86_64.rpm
4、安装mariadb
yum install mariadb-server -y
#启动mariadb
systemctl start mariadb
systemctl enable mariadb
#安全初始化数据库
mysql_secure_installation
#输入root密码  空格
#设置root密码吗 n
#要移除匿名用户吗 y
#取消root远程登录权限吗 y
#是否删除test库 y
#重置权限表吗 y
5、创建zabbix数据库,并把字符集设置utf8

create database zabbix character set utf8 collate utf8_bin;  创建数据库,设置utf8
grant all privileges on zabbix.* to zabbix@localhost identified by \'zabbix\';  设置密码
6、导入初始数据到mysql的zabbix用户的库里
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
mysql
use zabbix; 登录zabbix用户
show tables; 查询是否导入成功
7、修改zabbix配置文件
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
8、启动zabbix服务
systemctl restart zabbix-server
systemctl enable zabbix-server
9、配置zabbix前端(只需要添加一个时区)
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
10、最后在执行安装一遍需要的服务
yum isntall httpd php php-mysql mariadb -y
systemctl start httpd
systemctl enable httpd
11、现在zabbix就可以访问了
*.*.*.*/zabbix

新网虚拟主机

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注