概要
Hostにsshで入れて、Dockerで用途ごとに仮想マシンを建てられるような環境を作る
手順
-
ubuntu server 16.0.4 LTSをインストールする
- 公式ページからisoをダウンロードしてDVDに書き込む
- ↑を使ってマシンにクリーンインストール
-
static ipを割り振る
/etc/network/interfaces
を編集し以下の様に変更するiface eno1 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 8.8.8.8
-
SSH serverを立てる
- インストールのときに、Open SSH Serverにチェックを入れておく
/etc/ssh/sshd_config
を編集 - passwordでのログインを非許可
yesをnoに変更
PasswordAuthentication no
- 鍵での認証を有効にする RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys
- 認証鍵の置き場を作成する chmod 700 ~/.ssh/ touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
- 鍵の作成
clientで鍵を作成
ssh-keygen -t rsa -b 2048
id_rsa.pubの中身をhostの.ssh/authorized_keys
に書き込む
- インストールのときに、Open SSH Serverにチェックを入れておく
-
Dockerをインストールする
- 公式ページの手順でインストールする