一.安装旧版本zabbix2.2
1.安装zabbix的release
[root@zabbix ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/2.2/rhel/7/x86_64/zabbix-release-2.2-1.el7.noarch.rpm
2.修改安装源(默认的是国外的源)
[root@zabbix ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/2.2/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
3.安装Zabbix server,Web前端
[root@zabbix ~]# yum -y install zabbix-server-mysql zabbix-web-mysql
4.安装数据库
[root@zabbix ~]# yum -y install mariadb-server
5.初始化数据库并创建用户和库
[root@zabbix ~]# mysql_secure_installation
[root@zabbix ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix default charset utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@'localhost'identified by '123456'
6.导入数据
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-2.2.23/create
[root@zabbix /usr/share/doc/zabbix-server-mysql-2.2.23/create]#mysql -uzabbix -p123456 zabbix <schema.sql
[root@zabbix /usr/share/doc/zabbix-server-mysql-2.2.23/create]#mysql -uzabbix -p123456 zabbix <images.sql
[root@zabbix /usr/share/doc/zabbix-server-mysql-2.2.23/create]#mysql -uzabbix -p123456 zabbix <data.sql
7.修改配置文件
#数据库配置文件
[root@zabbix ~]# grep "^DB" /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#httpd配置文件
[root@zabbix ~]# grep -n "Shanghai" /etc/httpd/conf.d/zabbix.conf
20: php_value date.timezone Asia/Shanghai
8.重载服务
[root@zabbix ~]# systemctl restart zabbix-server httpd
[root@zabbix ~]# systemctl enable zabbix-server httpd
9.web界面设置
![](https://img.haomeiwen.com/i19901269/4977b356e0522219.png)
![](https://img.haomeiwen.com/i19901269/2eb098f9be2263a6.png)
![](https://img.haomeiwen.com/i19901269/48ec73f3519eaa3b.png)
![](https://img.haomeiwen.com/i19901269/4d9df783625bbae5.png)
![](https://img.haomeiwen.com/i19901269/ac7b148e8d14c40b.png)
![](https://img.haomeiwen.com/i19901269/34134a7f139c50d5.png)
登录后的界面
![](https://img.haomeiwen.com/i19901269/29496632610a9a62.png)
选择中文版本
![](https://img.haomeiwen.com/i19901269/588d9c93ec2f058f.png)
二.升级版本到4.0
说明:升级版本可以解决一些模板不兼容的问题,有时我们需要导入低版本的zabbix中通过升级到需要的版本之后导出使用,这样就解决了兼容性的问题。
1.导入模板
![](https://img.haomeiwen.com/i19901269/ff471aa137569ac5.png)
![](https://img.haomeiwen.com/i19901269/f85d7264e0d307b6.png)
![](https://img.haomeiwen.com/i19901269/6493a2affb1e0860.png)
2.升级操作
说明:实验环境这里就不在备份数据,如果是生产环境,为了保险起见,一定要备份数据等数据!
1.移除zabbix-release
[root@zabbix ~]# rpm -e zabbix-release
2.安装4.0的release
说明:官方的release
[root@web02 ~]# wget http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
[root@web02 ~]# ls
anaconda-ks.cfg hostname_ip.sh zabbix-release-4.0-2.el7.noarch.rpm
[root@web02 ~]# rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm
3.手动更新源
[root@zabbix ~]# 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/non-supported/rhel/7/$basearch/
enabled=1
4.安装Zabbix server,Web前端
[root@web02 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql
[root@web02 ~]# systemctl restart zabbix-server.service
5.刷新web页面
![](https://img.haomeiwen.com/i19901269/728012bdab29bb19.png)
6.找出之前的模板,导出使用即可。
![](https://img.haomeiwen.com/i19901269/3dab89107aaf0c02.png)
网友评论