-
准备zabbix-2.2的yum源
-
zabbix-server-mysql,zabbix-web-mysql
-
创建zabbix数据库,导入数据
-
-
#检查php包,版本太高安装失败 $ 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
$ 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
$ yum install zabbix-server-mysql zabbix-web-mysql -y $ systemctl start zabbix-server.service
$ yum install mariadb mariadb-server -y $ systemctl start mariadb $ systemctl enable mariadb $ mysql
2. 创建表
MariaDB [(none)]> create database zabbix chrset uft8; MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '123456'; MariaDB [(none)]> exit;
3. zabbix导入库
$ 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
$ vim /etc/zabbix/zabbix_server.conf 81 DBHost=localhost 91 DBName=zabbix 107 DBUser=zabbix 115 DBPassword=123456 $ systemctl restart zabbix-server.service
$ vim /etc/httpd/conf.d/zabbix.conf 19 php_value date.timezone Asia/ShangHai $ systemctl start httpd
注:登录名:Admin 密码:zabbix
-
升级zabbix的yum源 4.0版
-
备份数据库
-
$ 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%]
vim /etc/yum.repos.d/zabbix.repo #底行模式 %s#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g
$ mysqldump -B zabbix > zabbix.sql $ yum install zabbix-server-mysql zabbix-web-mysql -y --升级zabbix $ systemctl start httpd zabbix-server.service
$ systemctl stop httpd
$ systemctl stop zabbix-server.service
$ 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
$ 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