Quantcast
Channel: mattintosh note
Viewing all articles
Browse latest Browse all 891

Ubuntu Server 16.04 LTS に Zabbix 3.0 をインストールする

$
0
0

CentOS 7 にインストールするのは終わったので、今度は Ubuntuに入れてみる。公式のドキュメント通りにやればいいのだけど、ちょっと手順変更してやってみる。

GPG 鍵の登録。

$ curl -s https://repo.zabbix.com/zabbix-official-repo.key | sudo apt-key add -

リポジトリの登録。

$ sudo add-apt-repository 'deb https://repo.zabbix.com/https://repo.zabbix.com/zabbix/3.0/ubuntu/ xenial main'

パッケージリストの更新。

$ sudo apt-get update

Zabbix のインストール。

$ sudo apt-get install zabbix-{release,agent,server-mysql,frontend-php} --install-suggests --install-recommends

MySQLMariaDB)の設定。仮想マシンなのでとりあえず root のパスワードは放置。

$ sudo mysql -uroot
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
> quit;

テンプレートを使ってテーブルのセットアップ。

$ zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

設定をバックアップして編集。

$ sudo gzip -k /etc/zabbix/zabbix_server.conf
$ sudo vim /etc/zabbix/zabbix_server.conf

DBPasswordのとこだけだった。

$ diff -u <(zcat /etc/zabbix/zabbix_server.conf.gz) /etc/zabbix/zabbix_server.conf
--- /dev/fd/63  2017-06-27 00:56:55.808000984 +0900+++ /etc/zabbix/zabbix_server.conf      2017-06-27 00:55:06.753552066 +0900@@ -112,7 +112,7 @@
 #
 # Mandatory: no
 # Default:
-# DBPassword=+DBPassword=zabbix
 
 ### Option: DBSocket
 #      Path to MySQL socket.
$ sudo systemctl start zabbix-server
$ ^start^status
sudo systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
   Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-06-27 00:55:14 JST; 7s ago
  Process: 1848 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
 Main PID: 1865 (zabbix_server)                                                                                                                     
    Tasks: 27                                                                                                                                       
   Memory: 28.7M                                                                                                                                    
      CPU: 152ms                                                                                                                                    
   CGroup: /system.slice/zabbix-server.service
           ├─1865 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
 :
 :
 :

自動起動

$ sudo systemctl enable zabbix-server

これでブラウザから http://${IP_ADDRESS}/zabbixにアクセスする。

f:id:mattintosh4:20170627010257p:plain

わーい。

足りないものがあったので追加設定。

$ sudo gzip -k /etc/zabbix/apache.conf
$ sudo vim /etc/zabbix/apache.conf
$ diff -u <(zcat /etc/zabbix/apache.conf.gz) /etc/zabbix/apache.conf
--- /dev/fd/63  2017-06-27 01:12:46.346248048 +0900+++ /etc/zabbix/apache.conf     2017-06-27 01:05:10.285505239 +0900@@ -25,7 +25,7 @@
         php_value upload_max_filesize 2M
         php_value max_input_time 300
         php_value always_populate_raw_post_data -1
-        # php_value date.timezone Europe/Riga+        php_value date.timezone Asia/Tokyo</IfModule>
 </Directory>
$ sudo apt-get install php7.0-{bcmath,mbstring,xml}
$ sudo systemctl restart apache2

オッケー。

f:id:mattintosh4:20170627011433p:plain

f:id:mattintosh4:20170627011632p:plain

CentOS 7 より断然楽。メモリも少なめでよい。

$ free -m
              total        used        free      shared  buff/cache   available
Mem:            991         222         349          16         420         583
Swap:          1906           0        1906

あとはコンテナ化したいなー。

あと、ja_JP.UTF-8を有効にしてなかったので日本語が選択できなかった。

$ sudo vim /etc/locale.gen
$ sudo systemctl restart apache2

Viewing all articles
Browse latest Browse all 891

Trending Articles