zabbix version upgrades and rollback

Install version 2.2 zabbix

Source arranged zabbix-2.2

Ideas:

  1. Zabbix-2.2 ready source of yum

  2. zabbix-server-mysql,zabbix-web-mysql

  3. Zabbix create a database, import data

  4. Installation Configuration zabbix-server

  5. Installation Configuration zabbix-web

Tsinghua Source : https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/2.2/rhel/7/x86_64/

# Check php package, version too failed to install 
$ RPM -qa | grep php 
$ wget HTTPS: // mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/2.2/rhel/7/x86_64/zabbix-release-2.2 -1.el7.noarch.rpm

Change zabbix source Tsinghua source

$ 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

Installation zabbix

$ yum install zabbix-server-mysql zabbix-web-mysql -y
$ systemctl start zabbix-server.service

Install Database

1. Install

$ yum install mariadb mariadb-server -y
$ systemctl start mariadb 
$ systemctl enable  mariadb
$ mysql

2. Create a table

MariaDB [(none)]> create database zabbix chrset uft8;
MariaDB [(none)]> grant all on zabbix.* to  zabbix@localhost identified by '123456';
MariaDB [(none)]> exit;

3. zabbix import library

Import library sql file location/usr/share/doc/zabbix-server-mysql-2.2.23/create/

$ cd /usr/share/doc/zabbix-server-mysql-2.2.23/create/
$ ls
$ data.sql  images.sql  schema.sql

#文件导入库
$ mysql -uzabbix -p123456 zabbix  <schema.sql
$ mysql -uzabbix -p123456 zabbix  <images.sql
$ mysql -uzabbix -p123456 zabbix  <data.sql

Modify the configuration file database connection

$ vim /etc/zabbix/zabbix_server.conf
81 DBHost=localhost
91 DBName=zabbix
107 DBUser=zabbix
115 DBPassword=123456

$ systemctl restart zabbix-server.service

Change the time zone

$ vim /etc/httpd/conf.d/zabbix.conf
19   php_value date.timezone Asia/ShangHai
$ systemctl start httpd

Login : http://10.0.0.91/zabbix/setup.php

Connect to the database

Note: The login name: Admin Password: zabbix

zabbix-server upgrade

Thinking

  1. Zabbix upgrade version 4.0 of yum source

  2. backup database

  3. zabbix-server-mysql,zabbix-web-mysql

Upgrading yum source

Tsinghua 4.0 Source Address: https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/

$ wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

$ rpm -Uvh zabbix-release-4.0-2.el7.noarch.rpm
warning: zabbix-release-4.0-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-2.el7         ################################# [ 50%]
Cleaning up / removing...
   2:zabbix-release-2.2-1.el7         ################################# [100%]

Change the source for download at Tsinghua University

vim /etc/yum.repos.d/zabbix.repo
#底行模式
%s#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g

backup database

$ mysqldump -B  zabbix > zabbix.sql
$ yum install zabbix-server-mysql zabbix-web-mysql -y  --升级zabbix
$ systemctl start httpd zabbix-server.service

登录zabbixhttp://10.0.0.91/zabbix

zabbix rollback

Note: all right not to go to the rollback, but a failure it is easy to cool

Close Service

$ systemctl stop httpd
$ systemctl stop zabbix-server.service 

卸载zabbix包

$ rpm -qa | grep zabbix
zabbix-release-4.0-2.el7.noarch
zabbix-web-4.0.17-2.el7.noarch
zabbix-server-mysql-4.0.17-2.el7.x86_64
zabbix-web-mysql-4.0.17-2.el7.noarch

$ yum remove  zabbix-web  zabbix-release.noarch zabbix-server-mysql.x86_64  -y

安装2.0版本zabbix包

$ rpm -ivh zabbix-release-2.2-1.el7.noarch.rpm

#更新到清华源
$ vim  /etc/yum.repos.d/zabbix.repo
%s#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g

$ yum clean all
$ yum install zabbix-server-mysql zabbix-web -y

还原数据库

还原之前的数据库

$ mysql -uzabbix -p123456 <zabbix.sql
$ mysql


MariaDB [zabbix]> use zabbix;
Database changed
MariaDB [zabbix]> show tables;
---表忽略
151 rows in set (0.00 sec)

MariaDB [zabbix]> drop database zabbix;
MariaDB [(none)]> create database zabbix  charset utf8;

$ mysql -uzabbix -p123456 <zabbix.sql
MariaDB [(none)]> use zabbix
MariaDB [zabbix]> show tables;
--表忽略
108 rows in set (0.00 sec)

还原配置文件

$ \mv /etc/zabbix/zabbix_server.conf.rpmsave  /etc/zabbix/zabbix_server.conf 

#时区改为亚洲/上海
$ vim /etc/httpd/conf.d/zabbix.conf
19         php_value date.timezone Asia/ShangHai

$ systemctl start httpd
$ systemctl restart  zabbix-server.service

zabbix登录http://10.0.0.91/zabbix

Guess you like

Origin www.cnblogs.com/Mercury-linux/p/12289402.html