先日リリースされた、Zabbix 4.0(LTS)を早速、普段色々お世話になっている、ubuntu16.04にインストールしてみた。
[環境]
hoge@host:~$ cat /proc/version Linux version 4.4.0-130-generic (buildd@lgw01-amd64-039) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) ) #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 hoge@host:~$sudo mysql --version mysql Ver 15.1 Distrib 10.0.36-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
公式のインストール手順に沿ってインストール。
[インストールに使用するリポジトリの追加]
sudo出来る一般ユーザで作業しています。
hoge@host:~$ wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb --2018-10-04 10:27:32-- https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138 Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3930 (3.8K) [application/octet-stream] Saving to: 'zabbix-release_4.0-2+xenial_all.deb' zabbix-release_4.0-2+xenial_a 100%[================================================>] 3.84K --.-KB/s in 0s 2018-10-04 10:27:33 (248 MB/s) - 'zabbix-release_4.0-2+xenial_all.deb' saved [3930/3930] hoge@host:~$ sudo dpkg -i zabbix-release_4.0-2+xenial_all.deb (Reading database ... 152591 files and directories currently installed.) Preparing to unpack zabbix-release_4.0-2+xenial_all.deb ... Unpacking zabbix-release (1:4.0-2+xenial) over (3.4-1+xenial) ... Setting up zabbix-release (1:4.0-2+xenial) ... Installing new version of config file /etc/apt/sources.list.d/zabbix.list ... hoge@host:~$ sudo apt update Hit:1 http://jp.archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:4 http://repo.zabbix.com/zabbix/4.0/ubuntu xenial InRelease [7096 B] Hit:5 http://apt.mackerel.io/v2 mackerel InRelease Hit:6 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu xenial InRelease Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB] Get:8 http://repo.zabbix.com/zabbix/4.0/ubuntu xenial/main Sources [1186 B] Get:9 http://repo.zabbix.com/zabbix/4.0/ubuntu xenial/main amd64 Packages [2678 B] Get:10 http://repo.zabbix.com/zabbix/4.0/ubuntu xenial/main i386 Packages [2682 B] Fetched 120 kB in 1s (76.9 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 3 packages can be upgraded. Run 'apt list --upgradable' to see them. N: Skipping acquire of configured file 'contrib/binary-i386/Packages' as repository 'http://apt.mackerel.io/v2 mackerel InRelease' doesn't support architecture 'i386'
[ZabbixサーバとWebフロントエンド、エージェントのインストール]
hoge@host:~$ sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic linux-image-4.4.0-62-generic linux-image-extra-4.4.0-62-generic Use 'sudo apt autoremove' to remove them. Processing triggers for man-db (2.7.5-1) ... Setting up libiksemel3:amd64 (1.4-3build1) ... Setting up zabbix-server-mysql (1:4.0.0-2+xenial) ... Setting up snmpd (5.7.3+dfsg-1ubuntu4.1) ... locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory adduser: Warning: The home directory `/var/lib/snmp' does not belong to the user you are currently creating. update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults update-rc.d: warning: stop runlevel arguments (1) do not match snmpd Default-Stop values (0 1 6) Setting up zabbix-agent (1:4.0.0-2+xenial) ... Configuration file '/etc/zabbix/zabbix_agentd.conf' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** zabbix_agentd.conf (Y/I/N/O/D/Z) [default=N] ? Y Installing new version of config file /etc/zabbix/zabbix_agentd.conf ... Setting up zabbix-frontend-php (1:4.0.0-2+xenial) ... Processing triggers for libc-bin (2.23-0ubuntu10) ... Processing triggers for systemd (229-4ubuntu21.4) ... Processing triggers for ureadahead (0.100.0-19) ...
[データベースの初期化]
hoge@host:~$ sudo mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 47 Server version: 10.0.36-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04 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 character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit Bye hoge@host:~$
[作成したデータベースの初期化]
(これだけrootで実施しました)
root@host:~# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uroot -p zabbix Enter password:
[Zabbixサーバの設定ファイルにデータベースのパスワードを設定]
自分の環境だと、設定ファイルの125行目付近でコメントアウトされた状態でした
hoge@host:~$ sudo vim /etc/zabbix/zabbix_server.conf
で設定ファイルを開いて、
DBPassword=password
に修正して保存
[タイムゾーンの設定]
hoge@host:~$ sudo vim /etc/zabbix/apache.conf
で設定ファイルを開いて、
# php_value date.timezone Europe/Riga
となっている箇所を、
php_value date.timezone Asia/Tokyo
に修正して保存
[起動]
hoge@host:~$ systemctl restart zabbix-server zabbix-agent apache2 Failed to restart zabbix-server.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files See system logs and 'systemctl status zabbix-server.service' for details. Failed to restart zabbix-agent.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files See system logs and 'systemctl status zabbix-agent.service' for details. Failed to restart apache2.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files See system logs and 'systemctl status apache2.service' for details.
あるぇ?時間がないので今日はここまで!