全部博文(150)
分类: 系统运维
2017-03-28 19:01:10
系统:centos7.2 zabbix:2.4.7 ,安装自epel的repo 数据库:mysql zabbix repo : zabbix官方repo
[root@ops01 ~]# systemctl stop zabbix-server [root@ops01 ~]# systemctl stop zabbix-java-gateway [root@ops01 ~]# systemctl stop zabbix-agent
cd /etc/zabbix for i in `ls -al *.conf |awk '{print $9}'` ;do cp $i $i`date +%Y%m%d` ;done
[root@ops01 zabbix]# cd /etc [root@ops01 etc]# cp -r zabbix zabbix.20170328
cd /usr/share ### web ui的父目录 cp -r zabbix zabbix.2.4.7
[root@ops01 ~]# systemctl stop mysql
cp -r mysql mysql.20170328
[root@ops01 ~]# rpm -ivh 获取 警告:/var/tmp/rpm-tmp.9F6Bwl: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:zabbix-release-3.2-1.el7 ################################# [100%]
[root@ops01 etc]# yum --disablerepo=* --enablerepo=zabbix install zabbix-server zabbix-agent zabbix-java-gateway 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 zabbix.x86_64.0.2.4.7-1.el7 将被 取代 ---> 软件包 zabbix-agent.x86_64.0.2.4.7-1.el7 将被 升级 ---> 软件包 zabbix-agent.x86_64.0.3.2.4-2.el7 将被 舍弃 ---> 软件包 zabbix-java-gateway.x86_64.0.2.4.7-1.el7 将被 升级 ---> 软件包 zabbix-java-gateway.x86_64.0.3.2.4-2.el7 将被 舍弃 ---> 软件包 zabbix-server.x86_64.0.2.4.7-1.el7 将被 取代 ---> 软件包 zabbix-server-mysql.x86_64.0.2.4.7-1.el7 将被 升级 ---> 软件包 zabbix-server-mysql.x86_64.0.3.2.4-2.el7 将被 舍弃 --> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================================================== Package 架构 版本 源 大小 =============================================================================================================================================================================================== 正在安装: zabbix-agent x86_64 3.2.4-2.el7 zabbix 342 k 替换 zabbix.x86_64 2.4.7-1.el7 zabbix-java-gateway x86_64 3.2.4-2.el7 zabbix 717 k 替换 zabbix.x86_64 2.4.7-1.el7 zabbix-server-mysql x86_64 3.2.4-2.el7 zabbix 1.8 M 替换 zabbix.x86_64 2.4.7-1.el7 替换 zabbix-server.x86_64 2.4.7-1.el7 事务概要 =============================================================================================================================================================================================== 安装 3 软件包 总下载量:2.8 M Is this ok [y/d/N]: y Downloading packages: 警告:/var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-3.2.4-2.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY ] 189 kB/s | 441 kB 00:00:12 ETA zabbix-agent-3.2.4-2.el7.x86_64.rpm 的公钥尚未安装 (1/3): zabbix-agent-3.2.4-2.el7.x86_64.rpm | 342 kB 00:00:01 (2/3): zabbix-java-gateway-3.2.4-2.el7.x86_64.rpm | 717 kB 00:00:02 (3/3): zabbix-server-mysql-3.2.4-2.el7.x86_64.rpm | 1.8 MB 00:00:03 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 497 kB/s | 2.8 MB 00:00:05 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 检索密钥 导入 GPG key 0xA14FE591: 用户ID : "Zabbix LLC" 指纹 : a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591 软件包 : zabbix-release-3.2-1.el7.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 是否继续?[y/N]: Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 ** 发现 7 个已存在的 RPM 数据库问题, 'yum check' 输出如下: centos-release-7-2.1511.el7.centos.2.10.x86_64 是 centos-release-7-0.1406.el7.centos.2.3.x86_64 的副本 filesystem-3.2-20.el7.x86_64 是 filesystem-3.2-18.el7.x86_64 的副本 langtable-0.0.31-3.el7.noarch 是 langtable-0.0.13-4.el7.noarch 的副本 langtable-data-0.0.31-3.el7.noarch 是 langtable-data-0.0.13-4.el7.noarch 的副本 langtable-python-0.0.31-3.el7.noarch 是 langtable-python-0.0.13-4.el7.noarch 的副本 linux-firmware-20150904-43.git6ebf5d5.el7.noarch 是 linux-firmware-20140213-0.3.git4164c23.el7.noarch 的副本 setup-2.8.71-6.el7.noarch 是 setup-2.8.71-4.el7.noarch 的副本 正在安装 : zabbix-java-gateway-3.2.4-2.el7.x86_64 1/8 warning: /etc/zabbix/zabbix_java_gateway.conf created as /etc/zabbix/zabbix_java_gateway.conf.rpmnew 正在安装 : zabbix-agent-3.2.4-2.el7.x86_64 2/8 warning: /etc/zabbix/zabbix_agentd.conf created as /etc/zabbix/zabbix_agentd.conf.rpmnew 正在安装 : zabbix-server-mysql-3.2.4-2.el7.x86_64 3/8 warning: /etc/zabbix/zabbix_server.conf created as /etc/zabbix/zabbix_server.conf.rpmnew 清理 : zabbix-java-gateway-2.4.7-1.el7.x86_64 4/8 正在删除 : zabbix-server-2.4.7-1.el7.x86_64 5/8 清理 : zabbix-server-mysql-2.4.7-1.el7.x86_64 6/8 清理 : zabbix-agent-2.4.7-1.el7.x86_64 7/8 正在删除 : zabbix-2.4.7-1.el7.x86_64 8/8 验证中 : zabbix-server-mysql-3.2.4-2.el7.x86_64 1/8 验证中 : zabbix-agent-3.2.4-2.el7.x86_64 2/8 验证中 : zabbix-java-gateway-3.2.4-2.el7.x86_64 3/8 验证中 : zabbix-java-gateway-2.4.7-1.el7.x86_64 4/8 验证中 : zabbix-agent-2.4.7-1.el7.x86_64 5/8 验证中 : zabbix-2.4.7-1.el7.x86_64 6/8 验证中 : zabbix-server-mysql-2.4.7-1.el7.x86_64 7/8 验证中 : zabbix-server-2.4.7-1.el7.x86_64 8/8 已安装: zabbix-agent.x86_64 0:3.2.4-2.el7 zabbix-java-gateway.x86_64 0:3.2.4-2.el7 zabbix-server-mysql.x86_64 0:3.2.4-2.el7 替代: zabbix.x86_64 0:2.4.7-1.el7 zabbix-server.x86_64 0:2.4.7-1.el7 完毕!
### 因为仓库较多的时候,yum 会先更新仓库,比较费时 --disablerepo=* ### 先禁止所有的仓库 --enablerepo=zabbix ### 只允许zabbix仓库
## 可以看出有两个仓库名字,zabbix和zabbix-non-supported cat /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl= 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= enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
[root@ops01 share]# yum --enablerepo=zabbix upgrade zabbix-web zabbix-web-mysql ...... 事务概要 =============================================================================================================================================================================================== 安装 ( 1 依赖软件包) 升级 2 软件包 (+10 依赖软件包) 总下载量:11 M Is this ok [y/d/N]: y Downloading packages: No Presto metadata available for zabbix No Presto metadata available for os ...... (13/13): zabbix-web-3.2.4-2.el7.noarch.rpm | 3.6 MB 00:00:08 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 1.2 MB/s | 11 MB 00:00:09 Running transaction check Running transaction test Transaction test succeeded Running transaction ...... 更新完毕: zabbix-web.noarch 0:3.2.4-2.el7 zabbix-web-mysql.noarch 0:3.2.4-2.el7 完毕!
略
[root@ops01 zabbix]# systemctl start mysql [root@ops01 zabbix]# systemctl start zabbix-server [root@ops01 zabbix]# systemctl start zabbix-java-gateway
[root@ops01 include]# rpm -ql zabbix-web |more /etc/httpd/conf.d/zabbix.conf /etc/zabbix/web /etc/zabbix/web/maintenance.inc.php /etc/zabbix/web/zabbix.conf.php ......
chown -R nginx /etc/zabbix/zabbix
chmod +x /var/lib/php/session/ chmod g+x,u+x /var/lib/php/session/
zabbix官方的repo,web默认使用apapche的用户和组作为属主和组,因此相关安装后的文件属主和组都是apache,我们本例用的是nginx,nginx用户则无权限访问以上两处目录及文件,修改为nginx用户为属主后解决