ubuntu 18.04 minimal に mackerel-agent を導入する

# TL;DR
- `gnupg` が足りなそうなので入れたら大丈夫そう
- リモートから入るのに `openssh-server` を入れたからそれの依存で入るやつも必要かも

# 環境
- Ubuntu 18.04 なホストサーバから xen で Ubuntu 18.04 な DomU を作った。
- 起動イメージには minimal イメージを利用した。
    - [Installation/MinimalCD - Community Help Wiki](https://help.ubuntu.com/community/Installation/MinimalCD)
- インストール後、sshd が動いていないので、openssh-server を入れた。

# インストール
- まずは [Mackerel](https://mackerel.io/ja/) の UI から、 Hosts をクリック
- 右上のほうにある、「エージェントをインストール」をクリック
- 「Ubuntu / Debian」をクリックし、展開後「Ubuntu 16.04 / Debian 8 以降」をクリック
- するとインストール用のコマンドで出てくるため実行!  
    - `wget -q -O - https://mackerel.io/file/script/setup-all-apt-v2.sh | MACKEREL_APIKEY='(Your API Key)X' sh`

## いざ
```
$ wget -q -O - https://mackerel.io/file/script/setup-all-apt-v2.sh | MACKEREL_APIKEY='(Your API Key)' sh
This script requires superuser authority to setup Mackerel agent:
[sudo] password for YOUR_NAME: 
+ command -v curl
+ command -v wget
/usr/bin/wget
+ http_get=wget -q -O -
+ [ wget -q -O - =  ]
+ echo deb [arch=amd64] http://apt.mackerel.io/v2/ mackerel contrib
+ wget -q -O - https://mackerel.io/file/cert/GPG-KEY-mackerel-v2
+ apt-key add -
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
+ apt-get update -qq
W: GPG error: http://apt.mackerel.io/v2 mackerel InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 66332B78417E73EA
E: The repository 'http://apt.mackerel.io/v2 mackerel InRelease' is not signed.
+ apt-get install -y mackerel-agent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mackerel-agent
+ mackerel-agent init -apikey(Your API Key)
sh: 21: mackerel-agent: not found
+ systemctl start mackerel-agent
Failed to start mackerel-agent.service: Unit mackerel-agent.service not found.
```
- なんか gnupg あたりでエラーが  
```
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
+ apt-get update -qq
```
- とりあえず gnupg 入れてみますか。  
```
$ sudo apt install gnupg
```

## リベンジ
```
$ wget -q -O - https://mackerel.io/file/script/setup-all-apt-v2.sh | MACKEREL_APIKEY='(Your API Key)' sh
This script requires superuser authority to setup Mackerel agent:
[sudo] password for YOUR_NAME: 
+ command -v curl
+ command -v wget
/usr/bin/wget
+ http_get=wget -q -O -
+ [ wget -q -O - =  ]
+ echo deb [arch=amd64] http://apt.mackerel.io/v2/ mackerel contrib
+ + wgetapt-key -q add -O - -
 https://mackerel.io/file/cert/GPG-KEY-mackerel-v2
OK
+ apt-get update -qq
+ apt-get install -y mackerel-agent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mackerel-agent
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,824 kB of archives.
After this operation, 6,003 kB of additional disk space will be used.
Get:1 http://apt.mackerel.io/v2 mackerel/contrib amd64 mackerel-agent amd64 0.58.2-1.systemd [1,824 kB]
Fetched 1,824 kB in 0s (5,961 kB/s)      
Selecting previously unselected package mackerel-agent.
(Reading database ... 57941 files and directories currently installed.)
Preparing to unpack .../mackerel-agent_0.58.2-1.systemd_amd64.deb ...
Unpacking mackerel-agent (0.58.2-1.systemd) ...
Setting up mackerel-agent (0.58.2-1.systemd) ...
Created symlink /etc/systemd/system/multi-user.target.wants/mackerel-agent.service → /lib/systemd/system/mackerel-agent.service.
+ mackerel-agent init -apikey=(Your API Key)
+ systemctl start mackerel-agent
*************************************

     Done! Welcome to Mackerel!

*************************************
```
- 無事インストールができました。めでたしめでたし。