zabbix安装
配置阿里云zabbix yum源
|
1
|
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm |
下载repo文件
|
1
|
wget http://mirrors.aliyun.com/repo/Centos-7.repo |
备份并替换系统的repo文件
|
1
2
3
4
5
6
7
|
cp Centos-7.repo /etc/yum.repos.d/cd /etc/yum.repos.d/mv CentOS-Base.repo CentOS-Base.repo.bakmv Centos-7.repo CentOS-Base.repo |
执行下面步骤生成缓存
|
1
|
yum makecache |
(2)更换zabbix国内源
|
1
|
vim /etc/yum.repos.d/zabbix.repo |
如需安装4.0:将下面改为3.0改成4.0即可
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[zabbix]name=Zabbix Official Repository - \$basearchbaseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/\$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported]name=Zabbix Official Repository non-supported - \$basearchbaseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIXgpgcheck=1 |
添加gpgkey
|
1
2
3
4
5
|
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX |
添加之后即可使用,更新源
|
1
|
yum makecache -y |
(3)安装zabbix
1、安装相关软件
|
1
|
yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb zabbix-agent -y |
2、修改PHP时区配置
|
1
|
vim /etc/httpd/conf.d/zabbix.conf |
将<IfModule mod_php5.c>块的注释打开并且修改时区为Asia/Shanghai
php_value date.timezone Asia/Shanghai
3、数据库配置
|
1
|
systemctl start mariadb |
4、创建zabbix 所用的数据库以及用户
|
1
2
3
4
5
|
mysqlcreate database zabbix character set utf8 collate utf8_bin;grant all on zabbix.* to zabbix@'%' identified by '123456';grant all on zabbix.* to zabbix@'localhost' identified by '123456';exit; |
5、导入zabbix数据
|
1
|
cd /usr/share/doc/zabbix-server-mysql-3.0.28 |
注意:这里可能出现问题。进入这个目录可能出错。因为可能不是3.0.28这个版本号
所以我们查看下版本号。发现版本号是3.0.30
rpm -qal |grep zabbix-server-mysql
所以我们应该输入
cd /usr/share/doc/zabbix-server-mysql-3.0.30
|
1
|
zcat create.sql.gz |mysql -uzabbix -p123456 zabbix |
6、修改zabbix配置文件
|
1
2
3
4
5
6
7
|
vim /etc/zabbix/zabbix_server.conf#打开这个文件后,找到对应的。进行修改即可。默认是DBHost和DBPassword是被屏蔽的DBHost=localhost #数据库所在主机DBName=zabbix #数据库名DBUser=zabbix #数据库用户DBPassword=123456 #数据库密码 |
7、启动zabbix及http
|
1
2
|
systemctl start httpd.servicesystemctl start zabbix-server.service |
8、用浏览器访问
http://服务器ip/zabbix/setup.php


浙公网安备 33010602011771号