centos7 yum安装zabbix4.0

Posted valyriansteel

tags:

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

1、添加清华大学软件源:

 将以下内容写入 /etc/yum.repos.d/CentOS-Base.repo

 

 

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

更新软件包缓存 sudo yum makecache

 

2、下载清华软件源的rpm包:

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-server-mysql-4.0.14-1.el7.x86_64.rpm

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-web-4.0.14-1.el7.noarch.rpm

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-web-mysql-4.0.14-1.el7.noarch.rpm

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.14-1.el7.x86_64.rpm

wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-get-4.0.14-1.el7.x86_64.rpm

 

yum -y localinstall zabbix-server-mysql-4.0.14-1.el7.x86_64.rpm

yum -y localinstall zabbix-web-4.0.14-1.el7.noarch.rpm

yum -y localinstall zabbix-web-mysql-4.0.14-1.el7.noarch.rpm

yum -y localinstall zabbix-agent-4.0.14-1.el7.x86_64.rpm

yum -y localinstall zabbix-get-4.0.14-1.el7.x86_64.rpm

 

gunzip /usr/share/doc/zabbix-server-mysql-4.0.14/create.sql.gz

 

3、安装数据库mariadb并配置:

yum install mariadb mariadb-server
systemctl start mariadb   #启动mariadb
systemctl enable mariadb  #设置开机自启动
mysql_secure_installation #设置root密码等相关
mysql -uroot -p           #测试登录

create database zabbix;

grant all on zabbix.* to zabbix@‘127.0.0.1‘ identified by ‘zabbix123‘;

source /usr/share/doc/zabbix-server-mysql-4.0.14/create.sql

 

vi /etc/zabbix/zabbix_server.conf

修改DBhost为127.0.0.1:

### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
# If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
# DBHost=localhost
DBHost=127.0.0.1

 

# Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=zabbix123

 

vi /etc/php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
date.timezone = Asia/shanghai

 

4、启动zabbix-server agent和apache :

systemctl start zabbix-server zabbix-agent httpd

在浏览器访问 ip/zabbix 即可进入web配置页面

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

centos7安装zabbix4.0

Centos7 zabbix4.0安装

centos7.5离线安装zabbix4.0

zabbix-02-CentOS7.4安装zabbix4.0

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

CentOS6离线安装Zabbix4.0