ラベル Lubuntu の投稿を表示しています。 すべての投稿を表示
ラベル Lubuntu の投稿を表示しています。 すべての投稿を表示

2016年5月20日金曜日

UbuntuにOpenVPNをインストールしてiPadから接続したい(iPad編)

このエントリーをはてなブックマークに追加
OpenVPNでiPadからVPNをつなぐ野望。その野望を叶えるために利用するのはこのアプリ。OpenVPNによるOpenVPNのためのアプリ。
このアプリにOpenVPNのクライアント設定ファイルをインポートさせるために、ovpnファイルを作る。中はこんな感じ。
tls-client
client
proto udp
dev tun0
nobind
persist-key
persist-tun
verb 3
pull
comp-lzo
reneg-sec 3600
remote (VPNサーバのIPアドレス) (VPNサーバのポート)

ns-cert-type server

key-direction 1
<ca>
-----BEGIN CERTIFICATE-----
オレオレCA証明書
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
クライアント証明書
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
クライアント認証鍵
-----END PRIVATE KEY-----
</key>
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
TLS認証鍵
-----END OpenVPN Static key V1-----
</tls-auth>
これをメールでもiTunes経由でもいいのでアプリにインポートして接続するだけ!

これでiPadからVPN接続できる!

2016年5月19日木曜日

UbuntuにOpenVPNをインストールしてiPadから接続したい(サーバ設定)

このエントリーをはてなブックマークに追加
まぁ、色々と試行錯誤しなから少しずつサーバを育ているわけですが、今回はさくらVPSで動いているサーバにVPNで接続したいなと思いインストールしてみた。

ちなみに最終目標はタイトル通りiPadからVPN接続ができることです。

まずはOpenVPNのパッケージをインストール。

$ apt-get install openvpn
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  libpkcs11-helper1
提案パッケージ:
  easy-rsa
以下のパッケージが新たにインストールされます:
  libpkcs11-helper1 openvpn
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
462 kB のアーカイブを取得する必要があります。
この操作後に追加で 1,163 kB のディスク容量が消費されます。
続行しますか? [Y/n] y
提案されたeasy-rsaも追加でインストールする。easy-rsaをインストールする際にもpcmciautilsを提案されたので面倒くさいから--install-suggestsをつけて実行する。
$ apt-get install --install-suggests easy-rsa
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  libccid opensc opensc-pkcs11 pcmciautils pcscd
以下のパッケージが新たにインストールされます:
  easy-rsa libccid opensc opensc-pkcs11 pcmciautils pcscd
アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 0 個。
1,108 kB のアーカイブを取得する必要があります。
この操作後に追加で 3,949 kB のディスク容量が消費されます。
続行しますか? [Y/n] y
この後実行する手順はこんな感じ。

  1. オレオレ認証局を作る(認証局と証明書)
  2. オレオレ認証局に認証されたサーバ証明書と秘密鍵を作成する
  3. 暗号化に使用するDiffie-Hellman用パラメータを作成する
  4. オレオレ認証局に認証されたクライアント証明書と公開鍵を作成する
  5. OpenVPNの設定・起動


1. オレオレ認証局を作る(認証局と証明書)

まずは認証局の情報を設定するために、初期設定されたディレクトリとファイルを作成する。

$ make-cadir /etc/openvpn/easy-rsa
/etc/openvpn/easy-rsa/varsの中に認証局のドメインや組織情報などを環境変数に設定してあるので編集する。
export EASY_RSA="/etc/openvpn/easy-rsa"         #設定用のホームディレクトリ

export KEY_COUNTRY="JP"
export KEY_PROVINCE="OSAKA"
export KEY_CITY="Minato-ku, Osaka"
export KEY_ORG="High Mountain"
export KEY_EMAIL="master@highmountain-lab.net"
export KEY_OU="WEB Development Dept."
環境変数を読み込み、オレオレ認証局を作成する。
$ source /etc/openvpn/easy-rsa/vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
$ /etc/openvpn/easy-rsa/clean-all
$ /etc/openvpn/easy-rsa/build-ca
Generating a 2048 bit RSA private key
.................................................................................+++
....+++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [JP]:
State or Province Name (full name) [OSAKA]:
Locality Name (eg, city) [Minato-ku, Osaka]:
Organization Name (eg, company) [High Mountain]:
Organizational Unit Name (eg, section) [WEB Development Dept.]:
Common Name (eg, your name or your server's hostname) [High Mountain CA]:
Name [EasyRSA]:
Email Address [master@highmountain-lab.net]:
これで認証局の証明書(ca.crt)と秘密鍵(ca.key)が/etc/openvpn/easy-rsa/keys配下に作成される。


2. オレオレ認証局に認証されたサーバ証明書と秘密鍵を作成する

さっそくサーバ証明書と秘密鍵を作成しよう。
$ /etc/openvpn/easy-rsa/build-key-server LubuntuSakura
Generating a 2048 bit RSA private key
.........................................................+++
................................+++
writing new private key to 'LubuntuSakura.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [JP]:
State or Province Name (full name) [OSAKA]:
Locality Name (eg, city) [Minato-ku, Osaka]:
Organization Name (eg, company) [High Mountain]:
Organizational Unit Name (eg, section) [WEB Development Dept.]:
Common Name (eg, your name or your server's hostname) [LubuntuSakura]:
Name [EasyRSA]:
Email Address [master@highmountain-lab.net]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'JP'
stateOrProvinceName   :PRINTABLE:'OSAKA'
localityName          :PRINTABLE:'Minato-ku, Osaka'
organizationName      :PRINTABLE:'High Mountain'
organizationalUnitName:PRINTABLE:'WEB Development Dept.'
commonName            :PRINTABLE:'LubuntuSakura'
name                  :PRINTABLE:'EasyRSA'
emailAddress          :IA5STRING:'master@highmountain-lab.net'
Certificate is to be certified until May 15 18:40:00 2026 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
同じようにこれでサーバ証明書(LubuntuSakura.crt)と秘密鍵(LubuntuSakura.key)が/etc/openvpn/easy-rsa/keys配下に作成される。


3. 暗号化に使用するDiffie-Hellman用パラメータを作成する

/etc/openvpn/easy-rsa/build-dhを実行する。
$ /etc/openvpn/easy-rsa/build-dh
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
.........................................................................+...........................................................................................................+.............................................................................................................................................+.............................+......................................+...............+...................................................................................................................
鍵作成されると、/etc/openvpn/easy-rsa/keys/dh2048.pemが作成される。


4. オレオレ認証局に認証されたクライアント証明書と公開鍵を作成する

クイアント証明書と鍵を作成する。
# /etc/openvpn/easy-rsa/build-key LubuntuServerClient
Generating a 2048 bit RSA private key
...........+++
...................................................................................................+++
writing new private key to 'LubuntuServerClient.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [JP]:
State or Province Name (full name) [OSAKA]:
Locality Name (eg, city) [Minato-ku, Osaka]:
Organization Name (eg, company) [High Mountain]:
Organizational Unit Name (eg, section) [WEB Development Dept.]:
Common Name (eg, your name or your server's hostname) [LubuntuServerClient]:
Name [EasyRSA]:
Email Address [master@highmountain-lab.net]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'JP'
stateOrProvinceName   :PRINTABLE:'OSAKA'
localityName          :PRINTABLE:'Minato-ku, Osaka'
organizationName      :PRINTABLE:'High Mountain'
organizationalUnitName:PRINTABLE:'WEB Development Dept.'
commonName            :PRINTABLE:'LubuntuServerClient'
name                  :PRINTABLE:'EasyRSA'
emailAddress          :IA5STRING:'master@highmountain-lab.net'
Certificate is to be certified until May 16 05:23:40 2026 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
TLS認証鍵を作成する。
$ openvpn --genkey --secret /etc/openvpn/easy-rsa/keys/tls.key
下記の4ファイルをクライアント用に使用する。
ca.crt
LubuntuServerClient.crt
LubuntuServerClient.key
ta.key


5. OpenVPNの設定・起動

OpenVPNサーバの設定をするのでサンプルのconfigファイルを/etc/openvpn配下に持って来て編集する。
$ cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
$ gunzip server.conf.gz 
server.confは下記の部分を編集する。
port 1194

proto udp

ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/LubuntuSakura.crt
key /etc/openvpn/easy-rsa/keys/LubuntuSakura.key

dh /etc/openvpn/easy-rsa/keys/dh2048.pem

server 10.8.0.0 255.255.255.0

push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

client-to-client

tls-auth /etc/openvpn/easy-rsa/keys/tls.key 0

user nobody
group nogroup

status /var/log/openvpn-status.log
log-append  /var/log/openvpn.log
ここでOpenVPNだけstartしたら
Activation: failed for connection '有線接続 1'
とsyslogに出力され、うまく起動しなかったのでrebootしたらうまく起動された。

疲れた。iPad(iOS)から繋げるのは次回。

2016年5月17日火曜日

Ubuntu15.10から16.04へアップグレード

このエントリーをはてなブックマークに追加
さくらVPSで使っているUbuntu15.10からリリースされた16.04へアップグレードしようとした。

パッケージリストの更新をしてから
$ apt update

OSアップグレードを実行する。
$ do-release-upgrade
新しい Ubuntu のリリースをチェックしています
0% [作業中]                                                                                                             
0% [jp.archive.ubuntu.com (160.26.2.187) へ接続しています]                                                              
0% [ヘッダの待機中です]                                                                                                 
取得:1 ツールの署名のアップグレード [198 B]
99% [作業中]                                                                                                            
99% [ヘッダの待機中です]                                                                                               
取得:2 ツールのアップグレード [1,265 kB]
100% [作業中]                                                                                                           
1,265 kバイト/0秒 を取得しました (0 B/秒)
「xenial.tar.gz.gpg」を用いて「xenial.tar.gz」の認証を行ないます
'xenial.tar.gz' の展開中

キャッシュを読み込み中

パッケージマネージャーをチェック中です

SSH経由で実行していますが、続けますか?


このセッションはSSH上で実行されているようです。アップグレードをSSH越しに行うことは推奨されません。アップグレードに失敗した時の復元が困難になるからです。

続行する場合、追加のSSHデーモンをポート '1022' で起動します。
本当に作業を進めてよろしいですか?

続行する[yN] N

SSH経由でやると何かあった時に接続できなくなるから止めとけよと脅されたのでビビって"N"と押した。

なのでコンソールから直接実行してみる。/bootの容量もないのでapt-get autoremove --pergeを実行し、/bootの容量をあけるためにこうする。
$ apt-get autoremove --purge

もう一度実行。
$ do-release-upgrade
$ cat /etc/issue
Ubuntu 16.04 LTS \n \l
確認してバージョンアップされていれば完了。

2016年3月22日火曜日

LubuntuにDockerインストールした

このエントリーをはてなブックマークに追加
使い物になるのか試したかったのでLubuntuにDocker入れてみた。ここ見ただけだけどメモっとく。

Install Docker

$ curl -fsSL https://get.docker.com/ | sh
apparmor is enabled in the kernel and apparmor utils were already installed
+ sh -c apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.KxiBSCIzyE --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/alessandro-strada_ubuntu_ppa.gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
gpg: 鍵2C52609Dをhkpからサーバーp80.pool.sks-keyservers.netに要求
gpg: 鍵2C52609D: 公開鍵“Docker Release Tool (releasedocker) ”を読み込みました
gpg: 処理数の合計: 1
gpg:               読込み: 1  (RSA: 1)
+ sh -c mkdir -p /etc/apt/sources.list.d
+ dpkg --print-architecture
+ sh -c echo deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-wily main > /etc/apt/sources.list.d/docker.list
+ sh -c sleep 3; apt-get update; apt-get install -y -q docker-engine
ヒット http://jp.archive.ubuntu.com wily InRelease
取得:1 http://jp.archive.ubuntu.com wily-updates InRelease [65.9 kB]
ヒット http://jp.archive.ubuntu.com wily-backports InRelease
無視 http://dl.google.com stable InRelease
ヒット http://jp.archive.ubuntu.com wily/main Sources
ヒット http://jp.archive.ubuntu.com wily/restricted Sources
ヒット http://jp.archive.ubuntu.com wily/universe Sources
ヒット http://jp.archive.ubuntu.com wily/multiverse Sources
ヒット http://jp.archive.ubuntu.com wily/main amd64 Packages
ヒット http://jp.archive.ubuntu.com wily/restricted amd64 Packages
ヒット http://jp.archive.ubuntu.com wily/universe amd64 Packages
ヒット http://jp.archive.ubuntu.com wily/multiverse amd64 Packages
ヒット http://jp.archive.ubuntu.com wily/main i386 Packages
ヒット http://jp.archive.ubuntu.com wily/restricted i386 Packages
ヒット http://jp.archive.ubuntu.com wily/universe i386 Packages
ヒット http://dl.google.com stable Release.gpg
ヒット http://jp.archive.ubuntu.com wily/multiverse i386 Packages
ヒット http://jp.archive.ubuntu.com wily/main Translation-ja
ヒット http://jp.archive.ubuntu.com wily/main Translation-en
ヒット http://jp.archive.ubuntu.com wily/multiverse Translation-ja
ヒット http://jp.archive.ubuntu.com wily/multiverse Translation-en
ヒット http://jp.archive.ubuntu.com wily/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com wily/restricted Translation-en
ヒット http://jp.archive.ubuntu.com wily/universe Translation-ja
ヒット http://jp.archive.ubuntu.com wily/universe Translation-en
取得:2 https://apt.dockerproject.org ubuntu-wily InRelease [454 B]
無視 https://apt.dockerproject.org ubuntu-wily InRelease
取得:3 https://apt.dockerproject.org ubuntu-wily Release.gpg [801 B]
取得:4 http://security.ubuntu.com wily-security InRelease [65.9 kB]
ヒット https://apt.dockerproject.org ubuntu-wily Release
取得:5 http://jp.archive.ubuntu.com wily-updates/main Sources [69.2 kB]
取得:6 http://jp.archive.ubuntu.com wily-updates/restricted Sources [3,741 B]
取得:7 http://jp.archive.ubuntu.com wily-updates/universe Sources [21.1 kB]
ヒット https://apt.dockerproject.org ubuntu-wily/main amd64 Packages
取得:8 http://jp.archive.ubuntu.com wily-updates/multiverse Sources [3,199 B]
取得:9 http://jp.archive.ubuntu.com wily-updates/main amd64 Packages [197 kB]
取得:10 http://jp.archive.ubuntu.com wily-updates/restricted amd64 Packages [13.3 kB]
取得:11 http://jp.archive.ubuntu.com wily-updates/universe amd64 Packages [87.6 kB]
ヒット http://dl.google.com stable Release
取得:12 http://jp.archive.ubuntu.com wily-updates/multiverse amd64 Packages [6,247 B]
ヒット http://ppa.launchpad.net wily InRelease
取得:13 http://jp.archive.ubuntu.com wily-updates/main i386 Packages [194 kB]
取得:14 http://jp.archive.ubuntu.com wily-updates/restricted i386 Packages [13.4 kB]
取得:15 http://jp.archive.ubuntu.com wily-updates/universe i386 Packages [85.0 kB]
取得:16 http://jp.archive.ubuntu.com wily-updates/multiverse i386 Packages [6,678 B]
取得:17 http://jp.archive.ubuntu.com wily-updates/main Translation-en [90.1 kB]
取得:18 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP [454 B]
取得:19 http://jp.archive.ubuntu.com wily-updates/multiverse Translation-en [3,156 B]
取得:20 http://jp.archive.ubuntu.com wily-updates/restricted Translation-en [3,024 B]
取得:21 http://jp.archive.ubuntu.com wily-updates/universe Translation-en [51.0 kB]
ヒット http://jp.archive.ubuntu.com wily-backports/main Sources
ヒット http://jp.archive.ubuntu.com wily-backports/restricted Sources
ヒット http://jp.archive.ubuntu.com wily-backports/universe Sources
ヒット http://jp.archive.ubuntu.com wily-backports/multiverse Sources
ヒット http://jp.archive.ubuntu.com wily-backports/main amd64 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/restricted amd64 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/universe amd64 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/multiverse amd64 Packages
ヒット http://dl.google.com stable/main amd64 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/main i386 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/restricted i386 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/universe i386 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/multiverse i386 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/main Translation-en
ヒット http://ppa.launchpad.net wily/main amd64 Packages
ヒット http://jp.archive.ubuntu.com wily-backports/multiverse Translation-en
ヒット http://jp.archive.ubuntu.com wily-backports/restricted Translation-en
ヒット http://jp.archive.ubuntu.com wily-backports/universe Translation-en
取得:22 http://security.ubuntu.com wily-security/main Sources [41.3 kB]
取得:23 https://apt.dockerproject.org ubuntu-wily/main Translation-ja [454 B]
ヒット http://ppa.launchpad.net wily/main i386 Packages
取得:24 http://security.ubuntu.com wily-security/restricted Sources [2,854 B]
ヒット http://ppa.launchpad.net wily/main Translation-en
取得:25 http://security.ubuntu.com wily-security/universe Sources [10.8 kB]
取得:26 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
取得:27 http://security.ubuntu.com wily-security/multiverse Sources [2,788 B]
取得:28 http://security.ubuntu.com wily-security/main amd64 Packages [133 kB]
取得:29 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP [454 B]
取得:30 https://apt.dockerproject.org ubuntu-wily/main Translation-ja [454 B]
取得:31 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
取得:32 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP [454 B]
取得:33 http://security.ubuntu.com wily-security/restricted amd64 Packages [10.9 kB]
取得:34 http://security.ubuntu.com wily-security/universe amd64 Packages [49.3 kB]
取得:35 http://security.ubuntu.com wily-security/multiverse amd64 Packages [6,247 B]
取得:36 https://apt.dockerproject.org ubuntu-wily/main Translation-ja [454 B]
取得:37 http://security.ubuntu.com wily-security/main i386 Packages [130 kB]
取得:38 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
取得:39 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP [454 B]
取得:40 http://security.ubuntu.com wily-security/restricted i386 Packages [10.8 kB]
取得:41 https://apt.dockerproject.org ubuntu-wily/main Translation-ja [454 B]
取得:42 http://security.ubuntu.com wily-security/universe i386 Packages [49.3 kB]
取得:43 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
取得:44 http://security.ubuntu.com wily-security/multiverse i386 Packages [6,443 B]
取得:45 http://security.ubuntu.com wily-security/main Translation-en [65.6 kB]
取得:46 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP [454 B]
無視 https://apt.dockerproject.org ubuntu-wily/main Translation-ja_JP
取得:47 https://apt.dockerproject.org ubuntu-wily/main Translation-ja [454 B]
取得:48 http://security.ubuntu.com wily-security/multiverse Translation-en [2,806 B]
無視 https://apt.dockerproject.org ubuntu-wily/main Translation-ja
取得:49 http://security.ubuntu.com wily-security/restricted Translation-en [2,666 B]
取得:50 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
無視 https://apt.dockerproject.org ubuntu-wily/main Translation-en
取得:51 http://security.ubuntu.com wily-security/universe Translation-en [32.3 kB]
無視 http://dl.google.com stable/main Translation-ja_JP
無視 http://dl.google.com stable/main Translation-ja
無視 http://dl.google.com stable/main Translation-en
1,537 kB を 7秒 で取得しました (218 kB/s)
パッケージリストを読み込んでいます... 完了
パッケージリストを読み込んでいます...
依存関係ツリーを作成しています...
状態情報を読み取っています...
以下の追加パッケージがインストールされます:
  aufs-tools cgroupfs-mount git git-man liberror-perl
提案パッケージ:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki
  git-svn
推奨パッケージ:
  yubico-piv-tool
以下のパッケージが新たにインストールされます:
  aufs-tools cgroupfs-mount docker-engine git git-man liberror-perl
アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 1 個。
12.7 MB のアーカイブを取得する必要があります。
この操作後に追加で 68.7 MB のディスク容量が消費されます。
取得:1 http://jp.archive.ubuntu.com/ubuntu/ wily/universe aufs-tools amd64 1:3.2+20130722-1.1 [92.3 kB]
取得:2 http://jp.archive.ubuntu.com/ubuntu/ wily/universe cgroupfs-mount all 1.2 [4,970 B]
取得:3 http://jp.archive.ubuntu.com/ubuntu/ wily/main liberror-perl all 0.17-1.1 [21.1 kB]
取得:4 http://jp.archive.ubuntu.com/ubuntu/ wily-updates/main git-man all 1:2.5.0-1ubuntu0.1 [728 kB]
取得:5 http://jp.archive.ubuntu.com/ubuntu/ wily-updates/main git amd64 1:2.5.0-1ubuntu0.1 [3,009 kB]
取得:6 https://apt.dockerproject.org/repo/ ubuntu-wily/main docker-engine amd64 1.10.3-0~wily [8,834 kB]
12.7 MB を 1秒 で取得しました (9,082 kB/s)
以前に未選択のパッケージ aufs-tools を選択しています。
(データベースを読み込んでいます ... 現在 121037 個のファイルとディレクトリがインストールされています。)
.../aufs-tools_1%3a3.2+20130722-1.1_amd64.deb を展開する準備をしています ...
aufs-tools (1:3.2+20130722-1.1) を展開しています...
以前に未選択のパッケージ cgroupfs-mount を選択しています。
.../cgroupfs-mount_1.2_all.deb を展開する準備をしています ...
cgroupfs-mount (1.2) を展開しています...
以前に未選択のパッケージ docker-engine を選択しています。
.../docker-engine_1.10.3-0~wily_amd64.deb を展開する準備をしています ...
docker-engine (1.10.3-0~wily) を展開しています...
以前に未選択のパッケージ liberror-perl を選択しています。
.../liberror-perl_0.17-1.1_all.deb を展開する準備をしています ...
liberror-perl (0.17-1.1) を展開しています...
以前に未選択のパッケージ git-man を選択しています。
.../git-man_1%3a2.5.0-1ubuntu0.1_all.deb を展開する準備をしています ...
git-man (1:2.5.0-1ubuntu0.1) を展開しています...
以前に未選択のパッケージ git を選択しています。
.../git_1%3a2.5.0-1ubuntu0.1_amd64.deb を展開する準備をしています ...
git (1:2.5.0-1ubuntu0.1) を展開しています...
man-db (2.7.4-1) のトリガを処理しています ...
ureadahead (0.100.0-19) のトリガを処理しています ...
systemd (225-1ubuntu9.1) のトリガを処理しています ...
aufs-tools (1:3.2+20130722-1.1) を設定しています ...
cgroupfs-mount (1.2) を設定しています ...
docker-engine (1.10.3-0~wily) を設定しています ...
liberror-perl (0.17-1.1) を設定しています ...
git-man (1:2.5.0-1ubuntu0.1) を設定しています ...
git (1:2.5.0-1ubuntu0.1) を設定しています ...
libc-bin (2.21-0ubuntu4.1) のトリガを処理しています ...
systemd (225-1ubuntu9.1) のトリガを処理しています ...
ureadahead (0.100.0-19) のトリガを処理しています ...
+ sh -c docker version
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:59:07 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:59:07 2016
 OS/Arch:      linux/amd64

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

さて動くか。

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
03f4658f8b78: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

2016年3月20日日曜日

LubuntuにGoogleDriveをマウントする

このエントリーをはてなブックマークに追加
この前VDIにしたLubuntuはHDDが100GBあるんだけど、ファイルの共有とかもしたいのでGoogle Driveをマウントして使えないか調べてみた。

やっぱり同じように考える人もいるみたいで、Google Driveとファイル同期はさせたくないけどディスクとして使いたいという感じ。
このエントリを参考にさせていただいた。

LINUXでGOOGLEドライブを使えるようにしてみたのでメモ残しておく

google-drive-ocamlfuseというパッケージを利用し、Google Driveを仮想ディスクとして認識させることができる。

早速、google-drive-ocamlfuseを使うためにUbuntuのリポジトリ用に提供されているPPAを登録し、パッケージをインストールする。
$ add-apt-repository ppa:alessandro-strada/ppa
$ apt-get update
$ apt-get install google-drive-ocamlfuse
インストールしたパッケージをデスクトップ上のターミナルで実行する。
$ google-drive-ocamlfuse
すると、ブラウザが開きGoogleの認証画面になるのでアカウントを入力しログインする。
ログインが無事終了するとこのような画面が表示される。
ここでブラウザを閉じる。

また適当な場所にマウント先になるディレクトリを作成しマウントしてみる。
$ cd ドキュメント
$ mkdir GoogleDrive
$ google-drive-ocamlfuse GoogleDrive/
これでマウントができたので、GoogleDriveの中のファイルをローカルにコピーしてみる。
$ cp -ip GoogleDrive/image1.JPG ~
きちんとコピーできた。
アンマウントする時はこう。
$  fusermount -u GoogleDrive/
これで便利なると思うんだけど、毎回マウントするのが面倒くさいので起動時にマウントするようにしておくとなお便利かな。~/.bashrcあたりに書いといたらいいんじゃないかと。



2016年3月13日日曜日

Lubuntuのターミナルが使いにくいのでguakeをインストールした

このエントリーをはてなブックマークに追加
Lubuntuのターミナルソフトがあまりいけてないなぁという柔らかい理由で、なんかいいの探してたらGuakeとかいうやつがMacのiTermに似て良さそうだったのでインストールしてみた。

デフォルトのUXTermはこんな感じ。


そこでインストール。

$ apt-get install guake

こんな感じで上に張り付く。F12で出したりしまえたりは便利かも。


2016年3月2日水曜日

さくらVPSにLubuntu Descktopを入れてVDI環境を作った

このエントリーをはてなブックマークに追加
家の外でモバイルで作業する時にはノートPCを持っていくことが多いんだけれど、いつも家にあるMacの3台のどれをもっていくかで悩んでいた。本来であればiPadで全部用事すませたいところなんだけど、なかなかかゆいところに手が届かなかったりするので。。。

家にあるMacは割と特徴がそれぞれ。
  1. MacBook Pro 13インチ (Retina, 13-inch, Late 2013
    • DDR3 1600MHz 8GB
    • Corei5 2.4Ghz
    • SSD 256GB
    • 1.57kg
  2. MacBook Pro 13インチ (13-inch, Mid 2012)
    • DDR3 1600MHz 16GB
    • Corei5 2.5Ghz
    • SSD 500GB(換装済み)
    • 2.06kg
    • Windows10がBootCampで入っている。
  3. MacBook Air 11インチ (11-inch, Mid 2012)
    • DDR3 1600MHz 4GB
    • Corei5 1.7Ghz
    • SSD 64GB
    • 1.08kg

一番、性能もいいのは②、画面がRetinaでないのが残念。一番重量は重い。①はRetinaで画面もきれいながら重量もそこまでないけど、持ち歩くと腰痛持ちにはちょっと荷が重い。。。

そこで目標を③のMacBook Airに絞った、ただしハード的な制約は割とあってSSDとメモリが少ない。特にSSDが少ないので、それを補うために仮想デスクトップを用意してシンクライアントっぽく利用できればと思って、さくらのVPSに軽量LinuxのLubutu-15-10 DesktopをさくらのVPSにインストールしてみた。


Debiun系さわるのは久しぶりなので少し勘を取り戻しながらやる。
以下、インストールしていったもの。


[Google Chrome]
デフォルトでブラウザはFirefoxが入ってるのだけど拡張機能とか使い慣れているChromeが良かったので

[sysv-rc-conf]
単純にRedhat系のchkconfigみたいなのが良かっただけ。

[SSH]
基本的にデスクトップ用途なのでデフォルトでは入っていない。それでもいいんだけれど何かあったときは必要だろうと思うのでインストール。ただしGlobalIPで接続することになるのでパスワード認証なし、Rootログインなし、鍵認証は必ずしておく。さすがにIPベースで縛るのはきびしいし。

[XRDP]
デスクトップにリモート接続するために導入。VNCより使い勝手がよさそう。

IDCFクラウドでUbuntu MATE 14.10とxrdpを使うを参考にさせていただいた。

割と使いやすい。でもメモリが1GBなのであまり重い処理はできないな。。。