Zabbix安装部署(国内源镜像)----一次性解决centos7安装zabbix报错:[Errno 256] 的问题

Zabbix安装部署

环境准备
OS:CentOS 7

安装步骤
一,关闭selinux和iptables

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0

在这里插入图片描述
二,安装Zabbix rpm包仓库

1、配置阿里云的zabbix yum 源

先找到zabbix rpm文件地址:

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

[root@localhost ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

备份下载repo文件并替换repo文件

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.backup
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# mv Centos-7.repo CentOS-Base.repo

执行yum源更新命令

[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[root@localhost yum.repos.d]# yum update -y

2、更换zabbix国内源

[root@localhost yum.repos.d]# vi zabbix.repo

更改baseurl的地址为阿里云的地址

[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.4/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=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

在这里插入图片描述

添加gpgkey

[root@localhost yum.repos.d]# curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[root@localhost yum.repos.d]# curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

添加之后即可使用,更新源

[root@localhost yum.repos.d]# yum makecache -y

三,安装zabbix-server-mysql和zabbix-web-mysql

安装相关软件

[root@localhost yum.repos.d]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

验证:

rpm -qa  install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender

在这里插入图片描述
修改PHP时区配置

[root@localhost yum.repos.d]# vi /etc/httpd/conf.d/zabbix.conf

对#php_value date.timezone Europe/Riga这一行 取消注释并修改时区为 Asia/Shanghai

即修改为:php_value date.timezone Asia/Shanghai

更改web端口(也可以不更改)

[root@localhost yum.repos.d]# vi /etc/httpd/conf/httpd.conf
Listen 8088
ServerName IP:8088

重启apache服务,systemctl restart httpd

数据库配置

安装mariadb数据库客户端和服务端:

yum install mariadb mariadb-server
[root@localhost yum.repos.d]# systemctl start mariadb

创建zabbix所有的数据库以及用户

[root@localhost yum.repos.d]# mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> grant all on zabbix.* to zabbix@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> grant all on zabbix.* to zabbix@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> exit;
Bye

导入zabbix数据

[root@localhost yum.repos.d]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/
[root@localhost zabbix-server-mysql-3.4.15]# ll
total 2120
-rw-r--r--. 1 root root      98 Nov 12  2018 AUTHORS
-rw-r--r--. 1 root root  866545 Nov 12  2018 ChangeLog
-rw-r--r--. 1 root root   17990 Nov 12  2018 COPYING
-rw-r--r--. 1 root root 1267039 Nov 12  2018 create.sql.gz
-rw-r--r--. 1 root root      52 Nov 12  2018 NEWS
-rw-r--r--. 1 root root    1062 Nov 12  2018 README 
[root@localhost zabbix-server-mysql-3.4.15]# zcat create.sql.gz |mysql -uzabbix -p123456 zabbix

修改zabbix配置文件

[root@localhost zabbix-server-mysql-3.4.15]#vi /etc/zabbix/zabbix_server.conf
DBHost=192.168.1.X      #数据库地址
DBName=zabbix   #数据库名
DBUser=zabbix   #数据库用户
DBPassword=123456   #数据库密码

启动zabbix及httpd

[root@localhost zabbix-server-mysql-3.4.15]#systemctl start httpd.service
[root@localhost zabbix-server-mysql-3.4.15]#systemctl start zabbix-server.service

用浏览器访问

http://服务器ip:端口/zabbix/setup.php

默认超级管理员账号:Admin

密码:zabbix

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页