Zabbix4.0 alpha版からZabbix4.0LTS へアップデート

##はじめに
Zabiix4.0LTSがようやくリリースされました。（春くらいと言われてましたが...）
アルファ版をインストールして使ってた人もそこそこいると思うのでアルファ版からLTSへのアップデート手順を記録しておきます。

https://www.zabbix.com/jp/pr/pr220

CentOS7.5を使用した環境です。

##手順

・バージョン確認

```
# zabbix_server -V
zabbix_server (Zabbix) 4.0.0alpha8
Revision 81985 18 June 2018, compilation time: Jun 18 2018 09:05:37

Copyright (C) 2018 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
```

・サービスの停止

```
# systemctl stop zabbix_server
# systemctl stop zabbix_agent
```

Zabox 4.0 LTSを追加

```
yum install https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
```

・エラー発生...

```
error: rpmdb: BDB0113 Thread/process 29384/140409701078848 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
```

ggrとすぐ解決
（詳細はググってください）
`#rm -rf /var/lib/rpm __db.oo*`

・改めて

```
yum install https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

Loaded plugins: fastestmirror
zabbix-release-4.0-1.el7.noarch.rpm                                                                     |  13 kB  00:00:00
Examining /var/tmp/yum-root-dg_YSf/zabbix-release-4.0-1.el7.noarch.rpm: zabbix-release-4.0-1.el7.noarch
Marking /var/tmp/yum-root-dg_YSf/zabbix-release-4.0-1.el7.noarch.rpm as an update to zabbix-release-3.5-1.el7.noarch
Resolving Dependencies
--> Running transaction check
---> Package zabbix-release.noarch 0:3.5-1.el7 will be updated
---> Package zabbix-release.noarch 0:4.0-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================
 Package                     Arch                Version                   Repository                                     Size
===============================================================================================================================
Updating:
 zabbix-release              noarch              4.0-1.el7                 /zabbix-release-4.0-1.el7.noarch               21 k

Transaction Summary
===============================================================================================================================
Upgrade  1 Package

Total size: 21 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : zabbix-release-4.0-1.el7.noarch                                                                             1/2
  Cleanup    : zabbix-release-3.5-1.el7.noarch                                                                             2/2
  Verifying  : zabbix-release-4.0-1.el7.noarch                                                                             1/2
  Verifying  : zabbix-release-3.5-1.el7.noarch                                                                             2/2

Updated:
  zabbix-release.noarch 0:4.0-1.el7

Complete!
```

・各種アップデート

```
# yum clear all
# yum check-update
# yum update 'zabbix*'
BDB2053 Freeing read locks for locker 0x32: 21437/140654152447808
BDB2053 Freeing read locks for locker 0x34: 21437/140654152447808
BDB2053 Freeing read locks for locker 0x35: 21437/140654152447808
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fileplanet.com
 * epel: fedora-epel.mirrors.tds.net
 * extras: mirror.fileplanet.com
 * updates: mirror.keystealth.org
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:4.0.0-1.1alpha8.el7 will be updated
---> Package zabbix-agent.x86_64 0:4.0.0-2.el7 will be an update
---> Package zabbix-server-mysql.x86_64 0:4.0.0-1.1alpha8.el7 will be updated
---> Package zabbix-server-mysql.x86_64 0:4.0.0-2.el7 will be an update
---> Package zabbix-web.noarch 0:4.0.0-1.1alpha8.el7 will be updated
---> Package zabbix-web.noarch 0:4.0.0-2.el7 will be an update
---> Package zabbix-web-mysql.noarch 0:4.0.0-1.1alpha8.el7 will be updated
---> Package zabbix-web-mysql.noarch 0:4.0.0-2.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================
 Package                               Arch                     Version                         Repository                Size
===============================================================================================================================
Updating:
 zabbix-agent                          x86_64                   4.0.0-2.el7                     zabbix                   379 k
 zabbix-server-mysql                   x86_64                   4.0.0-2.el7                     zabbix                   2.1 M
 zabbix-web                            noarch                   4.0.0-2.el7                     zabbix                   2.7 M
 zabbix-web-mysql                      noarch                   4.0.0-2.el7                     zabbix                   7.8 k

Transaction Summary
===============================================================================================================================
Upgrade  4 Packages

Total download size: 5.2 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): zabbix-agent-4.0.0-2.el7.x86_64.rpm                                                              | 379 kB  00:00:00
(2/4): zabbix-server-mysql-4.0.0-2.el7.x86_64.rpm                                                       | 2.1 MB  00:00:00
(3/4): zabbix-web-mysql-4.0.0-2.el7.noarch.rpm                                                          | 7.8 kB  00:00:00
(4/4): zabbix-web-4.0.0-2.el7.noarch.rpm                                                                | 2.7 MB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------
Total                                                                                          5.0 MB/s | 5.2 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : zabbix-web-4.0.0-2.el7.noarch                                                                               1/8
  Updating   : zabbix-web-mysql-4.0.0-2.el7.noarch                                                                         2/8
  Updating   : zabbix-agent-4.0.0-2.el7.x86_64                                                                             3/8
  Updating   : zabbix-server-mysql-4.0.0-2.el7.x86_64                                                                      4/8
warning: /etc/zabbix/zabbix_server.conf created as /etc/zabbix/zabbix_server.conf.rpmnew
  Cleanup    : zabbix-web-4.0.0-1.1alpha8.el7.noarch                                                                       5/8
  Cleanup    : zabbix-web-mysql-4.0.0-1.1alpha8.el7.noarch                                                                 6/8
  Cleanup    : zabbix-agent-4.0.0-1.1alpha8.el7.x86_64                                                                     7/8
  Cleanup    : zabbix-server-mysql-4.0.0-1.1alpha8.el7.x86_64                                                              8/8
  Verifying  : zabbix-server-mysql-4.0.0-2.el7.x86_64                                                                      1/8
  Verifying  : zabbix-web-mysql-4.0.0-2.el7.noarch                                                                         2/8
  Verifying  : zabbix-web-4.0.0-2.el7.noarch                                                                               3/8
  Verifying  : zabbix-agent-4.0.0-2.el7.x86_64                                                                             4/8
  Verifying  : zabbix-web-4.0.0-1.1alpha8.el7.noarch                                                                       5/8
  Verifying  : zabbix-server-mysql-4.0.0-1.1alpha8.el7.x86_64                                                              6/8
  Verifying  : zabbix-web-mysql-4.0.0-1.1alpha8.el7.noarch                                                                 7/8
  Verifying  : zabbix-agent-4.0.0-1.1alpha8.el7.x86_64                                                                     8/8

Updated:
  zabbix-agent.x86_64 0:4.0.0-2.el7          zabbix-server-mysql.x86_64 0:4.0.0-2.el7      zabbix-web.noarch 0:4.0.0-2.el7
  zabbix-web-mysql.noarch 0:4.0.0-2.el7

Complete!
```

・サービス起動

```
# systemctl start zabbix-server
# systemctl start zabbix-agent
```

・バージョン確認

```
# zabbix_server -V
zabbix_server (Zabbix) 4.0.0
Revision 85308 1 October 2018, compilation time: Oct  1 2018 08:41:15

Copyright (C) 2018 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
```

完了

##まとめ
サクッとアップデートできました。
設定内容を全部引き継いでくれてるのかなどの確認はまだできてないので（検証環境だしあとでいいや感）
本番環境ではちょっと気をつけてくださいm(_ _)m