Zabbix Server 6.0を、Ubuntu 20.04に入れるメモです。
apt-update,apt-upgaradeを実行済みです。
ConohaVPS
で作業をしてみました。
MySQLのインストール
上記の手順で、MySQL 8.0 を入れます。
標準で入る、zabbix-server
# apt install zabbix-server-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfwupdplugin1 linux-headers-5.4.0-66 linux-headers-5.4.0-66-generic linux-image-5.4.0-66-generic linux-modules-5.4.0-66-generic linux-modules-extra-5.4.0-66-generic Use 'apt autoremove' to remove them. The following additional packages will be installed: fping libblas3 libiksemel3 liblinear4 liblua5.3-0 libmysqlclient21 libodbc1 libopenipmi0 libsensors-config libsensors5 libsnmp-base libsnmp35 libssh2-1 lua-lpeg nmap nmap-common snmpd traceroute Suggested packages: liblinear-tools liblinear-dev libmyodbc odbc-postgresql tdsodbc unixodbc-bin lm-sensors snmp-mibs-downloader ncat ndiff zenmap snmptrapd zabbix-frontend-php The following NEW packages will be installed: fping libblas3 libiksemel3 liblinear4 liblua5.3-0 libmysqlclient21 libodbc1 libopenipmi0 libsensors-config libsensors5 libsnmp-base libsnmp35 libssh2-1 lua-lpeg nmap nmap-common snmpd traceroute zabbix-server-mysql 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. Need to get 11.1 MB of archives. After this operation, 46.3 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient21 amd64 8.0.29-0ubuntu0.20
↑zabbix の mysqlタイプをインストールします。
# systemctl start zabbix-server # systemctl status zabbix-server ● zabbix-server.service - Zabbix Server (MySQL/MariaDB) Loaded: loaded (/lib/systemd/system/zabbix-server.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-XX-XX XX:XX:XX JST; XX ago Docs: man:zabbix_server Main PID: 2310 (zabbix_server) Tasks: 1 (limit: 2273) Memory: 6.8M CGroup: /system.slice/zabbix-server.service └─2310 /usr/sbin/zabbix_server --foreground systemd[1]: Started Zabbix Server (MySQL/MariaDB). zabbix_server[2310]: Starting Zabbix Server. Zabbix 4.0.17 (revision a528a0a4bc). zabbix_server[2310]: Press Ctrl+C to exit.
↑起動しました。Zabbix 4.0 なので、少し古いですね。
最新版の、6.0を入れてみたいと思います。
Zabbix 用DB設定
mysql> create database zabbix_db character set utf8mb4 collate utf8mb4_bin; Query OK, 1 row affected (0.01 sec) mysql> create user 'zabbix'@'localhost' identified by '(DB用パスワード)'; Query OK, 0 rows affected (0.02 sec) mysql> grant all privileges on zabbix_db.* to 'zabbix'@'localhost'; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
↑DBの初期設定を行います。
Zabbix Server 6.0 のインストール
↑Zabbixのダウンロードページにアクセスします。
↑「6.0 LTS」、「Ubuntu」、「20.04 (Focal)」、「MySQL」、「Apache」と選びます。
画面下のほうにある手順を参考に作業をします。
# wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb --2022-XX-XX XX:XX:XX-- https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb Resolving repo.zabbix.com (repo.zabbix.com)... 178.128.6.101, 2604:a880:2:d0::2062:d001 Connecting to repo.zabbix.com (repo.zabbix.com)|178.128.6.101|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3504 (3.4K) [application/octet-stream] Saving to: ‘zabbix-release_6.0-1+ubuntu20.04_all.deb’ zabbix-release_6.0-1+ubuntu20.04_all.deb 100%[=====================================================================================>] 3.42K --.-KB/s in 0s 2022-XX-XX XX:XX:XX (294 MB/s) - ‘zabbix-release_6.0-1+ubuntu20.04_all.deb’ saved [3504/3504]
# dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb Selecting previously unselected package zabbix-release. (Reading database ... 145851 files and directories currently installed.) Preparing to unpack zabbix-release_6.0-1+ubuntu20.04_all.deb ... Unpacking zabbix-release (1:6.0-1+ubuntu20.04) ... Setting up zabbix-release (1:6.0-1+ubuntu20.04) ...
# dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb Selecting previously unselected package zabbix-release. (Reading database ... 145851 files and directories currently installed.) Preparing to unpack zabbix-release_6.0-1+ubuntu20.04_all.deb ... Unpacking zabbix-release (1:6.0-1+ubuntu20.04) ... Setting up zabbix-release (1:6.0-1+ubuntu20.04) ... root@160-251-23-141:~# apt update Get:1 https://repo.zabbix.com/zabbix/6.0/ubuntu focal InRelease [4,958 B] Get:2 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main Sources [1,240 B] Get:3 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main amd64 Packages [5,158 B] Hit:4 http://jp.archive.ubuntu.com/ubuntu focal InRelease Get:5 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:6 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:7 http://jp.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:8 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,789 kB] Get:9 http://jp.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [921 kB] Fetched 3,056 kB in 12s (251 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date.
インストールを行います。
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfwupdplugin1 linux-headers-5.4.0-66 linux-headers-5.4.0-66-generic linux-image-5.4.0-66-generic linux-modules-5.4.0-66-generic linux-modules-extra-5.4.0-66-generic Use 'apt autoremove' to remove them. The following additional packages will be installed: apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fping libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libjansson4 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libmodbus5 libmysqlclient21 libodbc1 libonig5 libopenipmi0 libsensors-config libsensors5 libsnmp-base libsnmp35 libtiff5 libwebp6 libxpm4 php php-bcmath php-common php-gd php-ldap php-mbstring php-mysql php-xml php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-gd php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml snmpd ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser php-pear libgd-tools libmyodbc odbc-postgresql tdsodbc unixodbc-bin lm-sensors snmp-mibs-downloader snmptrapd openssl-blacklist zabbix-nginx-conf The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fping libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libjansson4 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libmodbus5 libmysqlclient21 libodbc1 libonig5 libopenipmi0 libsensors-config libsensors5 libsnmp-base libsnmp35 libtiff5 libwebp6 libxpm4 php php-bcmath php-common php-gd php-ldap php-mbstring php-mysql php-xml php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-gd php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml snmpd ssl-cert zabbix-agent zabbix-apache-conf zabbix-frontend-php zabbix-server-mysql zabbix-sql-scripts 0 upgraded, 60 newly installed, 0 to remove and 0 not upgraded. Need to get 28.4 MB of archives. After this operation, 106 MB of additional disk space will be used. Do you want to continue? [Y/n] y (略) To activate the new configuration, you need to run: systemctl reload apache2 Setting up php (2:7.4+75) ... Processing triggers for ufw (0.36-6ubuntu1) ... Processing triggers for systemd (245.4-4ubuntu3.17) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for libc-bin (2.31-0ubuntu9.9) ... Processing triggers for php7.4-cli (7.4.3-4ubuntu2.10) ... Processing triggers for libapache2-mod-php7.4 (7.4.3-4ubuntu2.10) ...
↑インストールが完了しました。
# zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix_db Enter password: (DBのパスワード)
↑DBの初期化が完了しました。
# vi /etc/zabbix/zabbix_server.conf DBName=zabbix ↓ DBName=zabbix_db # DBPassword= ↓ DBPassword=(DBのパスワード)
# systemctl restart zabbix-server zabbix-agent apache2 # systemctl enable zabbix-server zabbix-agent apache2 Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable zabbix-server Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable apache2 Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /lib/systemd/system/zabbix-server.service.
↑各サービスの起動が終わりました。自動起動も設定します。
zabbix 6.0 初期画面
↑http://(サーバーのIP)/zabbix/
↑「You are not able to choose some of the languages, because locales for them are not installed on the web server.」
とエラーが出て、日本語が選べません
# locale -a C C.UTF-8 en_US.utf8 POSIX
↑「ja_JP.utf8」が入っていないので、入れてあげます。
# apt install language-pack-ja-base language-pack-ja Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfwupdplugin1 linux-headers-5.4.0-66 linux-headers-5.4.0-66-generic linux-image-5.4.0-66-generic linux-modules-5.4.0-66-generic linux-modules-extra-5.4.0-66-generic Use 'apt autoremove' to remove them. The following NEW packages will be installed: language-pack-ja language-pack-ja-base 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 1,669 kB of archives. After this operation, 7,772 kB of additional disk space will be used. Get:1 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 language-pack-ja-base all 1:20.04+20220211 [1,667 kB] Get:2 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 language-pack-ja all 1:20.04+20220211 [1,896 B] Fetched 1,669 kB in 9s (193 kB/s) Selecting previously unselected package language-pack-ja-base. (Reading database ... 148853 files and directories currently installed.) Preparing to unpack .../language-pack-ja-base_1%3a20.04+20220211_all.deb ... Unpacking language-pack-ja-base (1:20.04+20220211) ... Selecting previously unselected package language-pack-ja. Preparing to unpack .../language-pack-ja_1%3a20.04+20220211_all.deb ... Unpacking language-pack-ja (1:20.04+20220211) ... Setting up language-pack-ja (1:20.04+20220211) ... Setting up language-pack-ja-base (1:20.04+20220211) ... Generating locales (this might take a while)... ja_JP.UTF-8... done Generation complete.
↑「ja_JP.utf8」の登録が完了しました。
http://(サーバーのIP)/zabbix/setup.php
を再読込します。
↑日本語が選べました。
↑日本語になりました。
↑なぜか、英語に戻ってしまいますが、先に進めます。
↑DBの情報を入れます。
↑「Zabbix server name」に適当な名前を入れます。
そして、タイムゾーンを東京にします。
↑確認画面です
↑インストールが完了しました。
↑ログイン画面になります。
初期のIDとパスワード「Admin」「zabbix」を入れます。
↑左メニュー、下の方「User Setting」「Profile」を選びます。
↑「Language」のところから「Japanese(ja_JP)」を選びます。
↑「Update」を選びます。
↑メニュー関係は、日本語になりましたが、エラーが出てしまいました。
Locale for language "ja_JP" is not found on the web server. Tried to set: ja_JP, ja_JP.utf8, ja_JP.UTF-8, ja_JP.iso885915, ja_JP.ISO8859-1, ja_JP.ISO8859-2, ja_JP.ISO8859-4, ja_JP.ISO8859-5, ja_JP.ISO8859-15, ja_JP.ISO8859-13, ja_JP.CP1131, ja_JP.CP1251, ja_JP.CP1251, ja_JP.CP949, ja_JP.KOI8-U, ja_JP.US-ASCII, ja_JP.eucKR, ja_JP.eucJP, ja_JP.SJIS, ja_JP.GB18030, ja_JP.GB2312, ja_JP.GBK, ja_JP.eucCN, ja_JP.Big5HKSCS, ja_JP.Big5, ja_JP.armscii8, ja_JP.cp1251, ja_JP.eucjp, ja_JP.euckr, ja_JP.euctw, ja_JP.gb18030, ja_JP.gbk, ja_JP.koi8r, ja_JP.tcvn. Unable to translate Zabbix interface.
# locale -a C C.UTF-8 en_US.utf8 ja_JP.utf8 POSIX
↑ここに、「ja_JP」が入っていないのが、原因のようです。
# localedef -f UTF-8 -i ja_JP ja_JP # locale -a C C.UTF-8 en_US.utf8 ja_JP ja_JP.utf8 POSIX
↑これで、入りました。
エラーが解消されたかと思います。