Ubuntu 14.04.3 の環境準備を行う
Ubuntu のインストール
Docker もインストールするつもりなので、 64bit 版であることは必須。
更に、GUIは要らないので、軽量化を重視して Server エディションをインストールしました。
とりあえず、言語は日本語で。(コンソールの表示は文字化けするけど、基本 SSH でアクセスするから関係ないよね!)
apt リポジトリを近場に切り替える
標準のままだと、海外のサーバに対してパッケージの取得などを行うため、ネットワーク速度がかなり遅い。
そこで、近場(日本国内)の安定したサーバにリポジトリを変更する。(今回は JAIST にした)
$ sudo sed -i".bak" -e 's/\/\/jp.archive.ubuntu.com/\/\/ftp.jaist.ac.jp/g' /etc/apt/sources.list
これで、 apt 操作は快適になる。
コアに必要なパッケージをインストールする
基本的な開発環境としての機能は、 Docker 上に構築するつもりなので、必要最低限のパッケージのみインストールする。
その前に、おもむろにアップデートする。
$ sudo apt-get update $ sudo apt-get upgrade -y
何はともあれ、ネットワークディレクトリの準備
まずは、母艦からファイルにアクセスするために SAMBA 環境を構築する。
Docker でコンテナを動作させるときも、コード編集などのファイルアクセスについては、(コンテナの共有機能を使って) Docker を動作させている Ubuntu 上にだけアクセスすれば良いようにする。
複数のサービス(今回は SAMBA )をどう出させることはリソースの無駄なので、母艦のスペック上、冗長な処理は省いていく
Ubuntu Server インストール時に、追加インストールパッケージとして選択していたので、すでにパッケージはインストール済み。
まだ入っていない場合は、
$ sudo apt-get install -y samba
とすればインストールできるはず。
次に、 SAMBA で公開するディレクトリの設定を行う。(この辺りは、好みが分かれる設定だと思うので、他の人がどうするか気になります)
$ sudo vim /etc/samba/smb.conf
--- /etc/samba/smb.conf.orig 2015-09-13 09:36:50.780300850 +0900 +++ /etc/samba/smb.conf 2015-09-13 09:41:54.088300850 +0900 @@ -190,28 +190,29 @@ # Un-comment the following (and tweak the other settings below to suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username -;[homes] -; comment = Home Directories -; browseable = no +[homes] + comment = Home Directories + browseable = no # By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. -; read only = yes + read only = no + writable = yes # File creation mask is set to 0700 for security reasons. If you want to # create files with group=rw permissions, set next parameter to 0775. -; create mask = 0700 + create mask = 0775 # Directory creation mask is set to 0700 for security reasons. If you want to # create dirs. with group=rw permissions, set next parameter to 0775. -; directory mask = 0700 + directory mask = 0775 # By default, \\server\username shares can be connected to by anyone # with access to the samba server. # Un-comment the following parameter to make sure that only "username" # can connect to \\server\username # This might need tweaking when using external authentication schemes -; valid users = %S + valid users = %S # Un-comment the following and create the netlogon directory for Domain Logons # (you need to configure Samba to act as a domain controller too.) @@ -234,23 +235,23 @@ ; create mask = 0600 ; directory mask = 0700 -[printers] - comment = All Printers - browseable = no - path = /var/spool/samba - printable = yes - guest ok = no - read only = yes - create mask = 0700 +;[printers] +; comment = All Printers +; browseable = no +; path = /var/spool/samba +; printable = yes +; guest ok = no +; read only = yes +; create mask = 0700 # Windows clients look for this share name as a source of downloadable # printer drivers -[print$] - comment = Printer Drivers - path = /var/lib/samba/printers - browseable = yes - read only = yes - guest ok = no +;[print$] +; comment = Printer Drivers +; path = /var/lib/samba/printers +; browseable = yes +; read only = yes +; guest ok = no # Uncomment to allow remote administration of Windows print drivers. # You may need to replace 'lpadmin' with the name of the group your # admin users are members of.
さらに、ユーザの作成も行います。
$ sudo smbpasswd -a <ユーザ名> New SMB Password: <パスワード> Retype new SMB Password: <パスワード>
設定変更後は、 SAMBA の再起動が必要です。
$ sudo service smbd restart
Docker をインストールする
基本的な手順は、 公式 の通りにすれば良い。
$ curl -sSL https://get.docker.com/ | sh
あれ?1.3の頃と比べて、格段に簡単になってる。
インストールが完了すると、
$ sudo usermod -aG docker <ユーザ名>
と表示されるので実行しておく。( sudo しなくても docker コマンドが使用できるようになる)
以前は、
$ sudo gpasswd -a <ユーザ名> docker Adding user <ユーザ名> to group docker
としていたけど、同じ効果となる。
とりあえず、 VirtualBox 上で直接動作する Ubuntu については以上で設定終わり。(不足が見つかったら加筆します)