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

2016年6月8日水曜日

VMwareToolsではなくopen-vm-tools

このエントリーをはてなブックマークに追加
VMware WorkStation、VMware Fusion共にVMWare Toolsではなく今はopen-vm-toolsに置き換えられている。
  • open-vm-tools
  • open-vm-tools-desktop
使うのはこの2つ。

2016年6月3日金曜日

yum grouplistはUbuntuではtaskselを使う

このエントリーをはてなブックマークに追加
表題の通りRedhat系ではyum grouplistを使うとGNOMEなどまとめてインストールできる。ubuntuで同じようなコマンドないかなぁと思って探したらtaskselってのがあった。
コマンド打つとこんな感じ。
まとめて入れれて便利

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年5月7日土曜日

Bash on Ubuntu on Windowsのnetwork周りはまだまだだった(build14332)

このエントリーをはてなブックマークに追加
Bash on Ubuntu on Windowsを触ってみたんだけど、どの程度までできるものなのかApacheをコンパイルして起動させてみるとこまでやってみたいと思う。

Bash on Ubuntu on Windows10を試すの時はPowerShellから起動して...みたいなことを書いていたけども、スタートメニューにBash on Ubuntu on Windowsってのが増えてたので、こちらから起動する。


開けたらこんな感じ。ディレクトリもLinuxになってる。rootも可。


IP調べようと思ったらifconfigでエラーが出た。

$ ifconfig
Warning: cannot open /proc/net/dev (No such file or directory). Limited output.

一応、networkをスタートしてみたもののエラーが出た。

$ /etc/init.d/networking start
 * Configuring network interfaces...                                                                                    resolvconf: Error: /run/resolvconf/interface either does not exist or is not a directory
resolvconf: Error: /run/resolvconf/interface either does not exist or is not a directory
../../../../lib/isc/unix/socket.c:2379: setsockopt(20, SO_TIMESTAMP) failed: Invalid argument
../../../../lib/isc/unix/socket.c:2379: setsockopt(21, SO_TIMESTAMP) failed: Invalid argument
../../../../lib/isc/unix/socket.c:2408: setsockopt(21, IPV6_RECVPKTINFO) failed: Invalid argument
../../../../lib/isc/unix/socket.c:5678: setsockopt(21, IPV6_V6ONLY) failed: Invalid argument

そこで同じようなエラーが出てる人がいて解決できたよってあるので参考にしてみた。

名前解決できないからDNSをGoogleDNSに向けてねってあったので向けてみた。

search web.setting
#nameserver 192.168.128.1
#nameserver 192.168.128.1
#nameserver 192.168.2.1
nameserver 8.8.8.8
nameserver 8.8.4.4

さてもう一度networkをstartした結果。

$ /etc/init.d/networking start
 * Configuring network interfaces...                                                                                    ../../../../lib/isc/unix/socket.c:2379: setsockopt(20, SO_TIMESTAMP) failed: Invalid argument
../../../../lib/isc/unix/socket.c:2379: setsockopt(21, SO_TIMESTAMP) failed: Invalid argument
../../../../lib/isc/unix/socket.c:2408: setsockopt(21, IPV6_RECVPKTINFO) failed: Invalid argument
../../../../lib/isc/unix/socket.c:5678: setsockopt(21, IPV6_V6ONLY) failed: Invalid argument
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Error getting interfaces; Invalid argument
Can't get list of interfaces.
Failed to bring up eth0.

resolveconfのエラーは出なくなったけどsocketのエラーはそのまま。

BashのMSDNにあるFrequently Asked Questionsには
Why isn't ICMP working?

This is a known issues that will effect several networking commands such as ping. Stay tuned for updates.
(pingみたいなnetwork周りのコマンドは問題あること分かってるからupdateを待っててね)
とあるので、少し待ち。

ちなみにUbuntu on Windowsのウィンドウを閉じると、今の時点ではさっきのresolve.confへの変更は取り消されます。

手元のbuildは14332だけどrelease noteをみるとresolve.confをマシにしたとあるので、こまめにアップデートして確認できればいいかな。

まだ問題はあるけどプロダクトとしては非常に面白い。VirtualBoxやVMwareを使わずに手軽に動かせる環境として使えそう。

2016年5月6日金曜日

Bash on Ubuntu on Windows10を試す

このエントリーをはてなブックマークに追加
WindowsのプレビュービルドにてWindows10上でUbuntuが実行できる環境がβ版として提供されているので、少し試してみた。

WindowsのOSバージョンはBuild 14332.1001だ。


「コントロールパネル」から「プログラム」、「Windows機能の有効化または無効化」を選択し、「Windows Subsystem for Linux(Beta)」にチェックを入れる。


「今すぐ再起動」を押し再起動させる。


再起動後、スタートメニューから「Windows PowerShell」を実行する。

ここでbashと入力すると環境のインストールが開始される。
設定するユーザ名やパスワードが聞かれるので適当に決めて入力しよう。


試しにapt-getでupdateしてみる。


割とそれなりに使えそうです。正式リリースの際にはどの程度になっているか楽しみですね。


2016年4月29日金曜日

Alpine Linuxが軽量で素敵

このエントリーをはてなブックマークに追加
Dockerなどのコンテナを利用する上でOSが軽量なのは非常にいいことかと思い、VMなどの仮想マシンでも軽量なことはやはりうれしいことです。

軽量ディストリビューションの中で最近、Alpine Linuxがちょっと流行りだ。サイトでもうたっている特徴としては、

Alpine Linux is built around musl libc and busybox. This makes it smaller and more resource efficient than traditional GNU/Linux distributions.
GNU Linuxに沿い、BusyBoxやmusl libcなどを使用して軽量化していること。
A container requires no more than 8 MB and a minimal installation to disk requires around 130 MB of storage.
MB単位でのディスクの利用しかしないディストリビューションであること。

を特徴としている。

そこで一度使ってみることにした。

基本的なところ


・デフォルトシェルはash
・パッケージマネージャはapk
コマンドの詳細は
http://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Overview

2016年4月16日土曜日

VoyagerX2をVMWare Fusionで動かした時のディスプレイ解像度固定の方法

このエントリーをはてなブックマークに追加
どこ触ってもできなかったので、メモしておく。

最終的には/etc/default/grubに記述すれば反映された。

#GRUB_GFXMODE=640x480
GRUB_GFXMODE=2560x1600   # 設定したい解像度

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月3日木曜日

MacからSSHトンネリングでRDPする

このエントリーをはてなブックマークに追加
さて、さくらVPSにLubuntu Descktopを入れてVDI環境を作ったでRDPできるようにしたはいいものの、こいつもグローバルに画面が見えているのであればSSHを鍵認証にした意味がない。なので、RDP自身もSecureに利用するためにSSHのトンネリングを利用して接続できるように変更してみた。

WindowsだとputtyでSSH tunnelが作れるみたいだけど、MacにはputtyがないのでターミナルからコマンドでSSH tunnelを作成する。
ssh -L [any local Port]:localhost:3389 [username]@[sakura vps IP] -i ~/.ssh/[secretkey Name]

-L で指定するのはMacからRDPしたい時に指定するPort番号と、そのあとはSSH接続したサーバが接続しにいくhostとPort番号になる

MacのRemote Desktop Clientが指定するのはlocalhost:13389になる。この接続の中で利用するlocalhostは2つの意味がある。
Remote Desktop Clientのlocalhost:Macのlocalhost
SSHコマンドのlocalhost:サーバ側がフォワードにいくサーバとしてのlocalhost


あとはRDP側の接続をlocalhostからしか受け付けないようにする。/etc/xrdp/xrdp.iniの[globals]セクションに下記の指定を加える。
address=127.0.0.1
そのあとxrdpのサービスを再起動する。
$sudo service xrdp restart

これでSSH tunnelを確立した後でないとRDPできないようになった。これでリモート接続に関しては一安心。。。

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なのであまり重い処理はできないな。。。

2016年2月23日火曜日

CentOS7でOpenStackを構築する

このエントリーをはてなブックマークに追加
Fedora23でやろうとしたんだけど、今後、仕事でサーバ構築にFedoraを使うかというと微妙すぎた(FedoraはあくまでRedHatへのフィードバックディストリビューションの位置付け)ので、CentOS7をVMWareFusionでVM(メモリ4GB、HDD150GB)を用意して、これにRDOを使ってOpenStackをインストールすることにした。

構築の仕方はRDO QuickStartを見ながら。

RDOリポジトリの追加とアップデート

まずはパッケージのアップデートとRDOのリポジトリを追加しておく
$ yum -y install https://www.rdoproject.org/repos/rdo-release.rpm
読み込んだプラグイン:fastestmirror
rdo-release.rpm                                                                                  | 5.1 kB  00:00:00
/var/tmp/yum-root-jzdiyf/rdo-release.rpm を調べています: rdo-release-liberty-2.noarch
/var/tmp/yum-root-jzdiyf/rdo-release.rpm をインストール済みとして設定しています
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ rdo-release.noarch 0:liberty-2 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

========================================================================================================================
 Package                      アーキテクチャー        バージョン                    リポジトリー                   容量
========================================================================================================================
インストール中:
 rdo-release                  noarch                  liberty-2                     /rdo-release                  1.4 k

トランザクションの要約
========================================================================================================================
インストール  1 パッケージ

合計容量: 1.4 k
インストール容量: 1.4 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : rdo-release-liberty-2.noarch                                                            1/1
  検証中                  : rdo-release-liberty-2.noarch                                                            1/1

インストール:
  rdo-release.noarch 0:liberty-2

完了しました!

packstackコマンドをインストールする

$ yum -y install openstack-packstack

シングルノードでのOpenStack構築

$ packstack --allinone
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20160223-040412-NQg7pb/openstack-setup.log
Packstack changed given value  to required value /root/.ssh/id_rsa.pub

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Adding pre install manifest entries                  [ DONE ]
Setting up CACERT                                    [ DONE ]
Adding AMQP manifest entries                         [ DONE ]
Adding MariaDB manifest entries                      [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Adding Keystone manifest entries                     [ DONE ]
Adding Glance Keystone manifest entries              [ DONE ]
Adding Glance manifest entries                       [ DONE ]
Adding Cinder Keystone manifest entries              [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Adding Cinder manifest entries                       [ DONE ]
Adding Nova API manifest entries                     [ DONE ]
Adding Nova Keystone manifest entries                [ DONE ]
Adding Nova Cert manifest entries                    [ DONE ]
Adding Nova Conductor manifest entries               [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Adding Nova Compute manifest entries                 [ DONE ]
Adding Nova Scheduler manifest entries               [ DONE ]
Adding Nova VNC Proxy manifest entries               [ DONE ]
Adding OpenStack Network-related Nova manifest entries[ DONE ]
Adding Nova Common manifest entries                  [ DONE ]
Adding Neutron VPNaaS Agent manifest entries         [ DONE ]
Adding Neutron FWaaS Agent manifest entries          [ DONE ]
Adding Neutron LBaaS Agent manifest entries          [ DONE ]
Adding Neutron API manifest entries                  [ DONE ]
Adding Neutron Keystone manifest entries             [ DONE ]
Adding Neutron L3 manifest entries                   [ DONE ]
Adding Neutron L2 Agent manifest entries             [ DONE ]
Adding Neutron DHCP Agent manifest entries           [ DONE ]
Adding Neutron Metering Agent manifest entries       [ DONE ]
Adding Neutron Metadata Agent manifest entries       [ DONE ]
Adding Neutron SR-IOV Switch Agent manifest entries  [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Adding OpenStack Client manifest entries             [ DONE ]
Adding Horizon manifest entries                      [ DONE ]
Adding Swift Keystone manifest entries               [ DONE ]
Adding Swift builder manifest entries                [ DONE ]
Adding Swift proxy manifest entries                  [ DONE ]
Adding Swift storage manifest entries                [ DONE ]
Adding Swift common manifest entries                 [ DONE ]
Adding Provisioning Demo manifest entries            [ DONE ]
Adding Provisioning Demo bridge manifest entries     [ DONE ]
Adding Provisioning Glance manifest entries          [ DONE ]
Adding MongoDB manifest entries                      [ DONE ]
Adding Redis manifest entries                        [ DONE ]
Adding Ceilometer manifest entries                   [ DONE ]
Adding Ceilometer Keystone manifest entries          [ DONE ]
Adding Nagios server manifest entries                [ DONE ]
Adding Nagios host manifest entries                  [ DONE ]
Adding post install manifest entries                 [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 172.16.33.181_prescript.pp
172.16.33.181_prescript.pp:                          [ DONE ]
Applying 172.16.33.181_amqp.pp
Applying 172.16.33.181_mariadb.pp
172.16.33.181_amqp.pp:                               [ DONE ]
172.16.33.181_mariadb.pp:                            [ DONE ]
Applying 172.16.33.181_keystone.pp
Applying 172.16.33.181_glance.pp
Applying 172.16.33.181_cinder.pp
172.16.33.181_keystone.pp:                           [ DONE ]
172.16.33.181_glance.pp:                             [ DONE ]
172.16.33.181_cinder.pp:                             [ DONE ]
Applying 172.16.33.181_api_nova.pp
172.16.33.181_api_nova.pp:                           [ DONE ]
Applying 172.16.33.181_nova.pp
172.16.33.181_nova.pp:                               [ DONE ]
Applying 172.16.33.181_neutron.pp
172.16.33.181_neutron.pp:                            [ DONE ]
Applying 172.16.33.181_osclient.pp
Applying 172.16.33.181_horizon.pp
172.16.33.181_osclient.pp:                           [ DONE ]
172.16.33.181_horizon.pp:                            [ DONE ]
Applying 172.16.33.181_ring_swift.pp
172.16.33.181_ring_swift.pp:                         [ DONE ]
Applying 172.16.33.181_swift.pp
Applying 172.16.33.181_provision_demo.pp
172.16.33.181_swift.pp:                              [ DONE ]
172.16.33.181_provision_demo.pp:                     [ DONE ]
Applying 172.16.33.181_provision_demo_bridge.pp
172.16.33.181_provision_demo_bridge.pp:              [ DONE ]
Applying 172.16.33.181_provision_glance
172.16.33.181_provision_glance:                      [ DONE ]
Applying 172.16.33.181_mongodb.pp
Applying 172.16.33.181_redis.pp
172.16.33.181_mongodb.pp:                            [ DONE ]
172.16.33.181_redis.pp:                              [ DONE ]
Applying 172.16.33.181_ceilometer.pp
172.16.33.181_ceilometer.pp:                         [ DONE ]
Applying 172.16.33.181_nagios.pp
Applying 172.16.33.181_nagios_nrpe.pp
172.16.33.181_nagios.pp:                             [ DONE ]
172.16.33.181_nagios_nrpe.pp:                        [ DONE ]
Applying 172.16.33.181_postscript.pp
172.16.33.181_postscript.pp:                         [ DONE ]
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** Installation completed successfully ******

Additional information:
 * A new answerfile was created in: /root/packstack-answers-20160223-040413.txt
 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
 * Warning: NetworkManager is active on 172.16.33.181. OpenStack networking currently does not work on systems that have the Network Manager service enabled.
 * File /root/keystonerc_admin has been created on OpenStack client host 172.16.33.181. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://172.16.33.181/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * To use Nagios, browse to http://172.16.33.181/nagios username: nagiosadmin, password: ead818c11ae742b9
 * The installation log file is available at: /var/tmp/packstack/20160223-040412-NQg7pb/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20160223-040412-NQg7pb/manifests
最後の方にこんなWarningが出てたけど、無事にdashboardにアクセスできた!
* Warning: NetworkManager is active on 172.16.33.181. OpenStack networking currently does not work on systems that have the Network Manager service enabled.
この画面でログインする時のID、PASSWORDは~/keystonerc_adminに残っているのでそのアカウントでログインする。
$ cat ~/keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=ef6d2d3aa7d2474c
export OS_AUTH_URL=http://172.16.33.181:5000/v2.0
export PS1='[\u@\h \W(keystone_admin)]\$ '

export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne
ようやくログインできた。

2016年2月17日水曜日

VMWareFusionで仮想マシンのHDDを拡張した時にしたこと

このエントリーをはてなブックマークに追加
VMWareFusionで作った仮想マシンのHDDを60GBから150GBへ拡張した。そのままでは仮想マシン側のFedora23では拡張されたことは認識されないので、HDD拡張を認識させるためにやったことをまとめておく。


まずはfdisk -lで認識されているディスク情報を確認する。

# fdisk -l
ディスク /dev/sda: 150 GiB, 161061273600 バイト, 314572800 セクタ
単位: セクタ (1 * 512 = 512 バイト)
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
ディスクラベルのタイプ: dos
ディスク識別子: 0x4c356fd6

デバイス   起動 開始位置 最後から セクタ サイズ Id タイプ
/dev/sda1  *        2048   1026047   1024000   500M 83 Linux
/dev/sda2        1026048 125829119 124803072  59.5G 8e Linux LVM


ディスク /dev/mapper/fedora-root: 38.7 GiB, 41490055168 バイト, 81035264 セクタ
単位: セクタ (1 * 512 = 512 バイト)
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


ディスク /dev/mapper/fedora-swap: 2 GiB, 2147483648 バイト, 4194304 セクタ
単位: セクタ (1 * 512 = 512 バイト)
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


ディスク /dev/mapper/fedora-home: 18.9 GiB, 20254294016 バイト, 39559168 セクタ
単位: セクタ (1 * 512 = 512 バイト)
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト

/dev/sda2を拡張させればいいと分かった。ここからはpartedで実施する。

# parted
GNU Parted 3.2
/dev/sda を使用
GNU Parted へようこそ! コマンド一覧を見るには 'help' と入力してください。

素直にhelpを実行する
(parted) help
  align-check TYPE N            パーティション N のアライメント(TYPE: min|opt)をチェックする
  help [コマンド]               ヘルプ表示。コマンド指定でそのヘルプを表示
  mklabel,mktable ラベルの種類  新しいラベル(パーティションテーブル)を作る
  mkpart パーティションの種類 [ファイルシステムの種類] 開始 終了
                    パーティションを作る
  name NUMBER 名前              パーティションに名前をつける
  print [devices|free|list,all|NUMBER]
                     パーティションテーブルや、利用可能なデバイス、空き領域、
                     見つかった全てのパーティション、あるいは特定のパーティションについて表示する
  quit                          プログラムを終了する
  rescue 開始 終了              開始、終了で指定した範囲付近にあるパーティションを復活させる
  resizepart NUMBER END         パーティション NUMBER を END にリサイズする
  rm NUMBER                     パーティションを削除する
  select デバイス               操作するデバイスを選択
  disk_set FLAG STATE           選択したデバイスの FLAG を変更
  disk_toggle [FLAG]            選択したデバイスの FLAG の状態をトグル
  set NUMBER フラグ 状態        ファイルシステムのフラグと状態を設定する
  toggle [NUMBER [FLAG]]        パーティションのフラグの状態を反転する
  unit UNIT                     デフォルトの単位を UNIT にする
  version                       GNU Parted のバージョンと著作権情報を表示

念のためもう1回ディスク情報を確認する。
(parted) print all
モデル: VMware, VMware Virtual S (scsi)
ディスク /dev/sda: 161GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了    サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  525MB   524MB   primary  ext4              boot
 2    525MB   64.4GB  63.9GB  primary                    lvm

パーティション番号の2を変更したいのでresizepart [partition number]を利用する。
(parted) resizepart 2
終了?  [64.4GB]? 150GB
(parted) p
モデル: VMware, VMware Virtual S (scsi)
ディスク /dev/sda: 161GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了   サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  525MB  524MB   primary  ext4              boot
 2    525MB   151GB  150GB   primary                    lvm

これでパーティションが変更された。次に物理ボリュームを変更する。
現在の情報を確認する。
# pvscan
  PV /dev/sda2   VG fedora   lvm2 [59.51 GiB / 4.00 MiB free]
  Total: 1 [59.51 GiB] / in use: 1 [59.51 GiB] / in no VG: 0 [0   ]
物理ボリュームを変更する。
# pvresize /dev/sda2
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
変更されたか確認する。
# pvscan
  PV /dev/sda2   VG fedora   lvm2 [149.45 GiB / 89.95 GiB free]
  Total: 1 [149.45 GiB] / in use: 1 [149.45 GiB] / in no VG: 0 [0   ]

次は論理パーティションを変更する
# lvextend -L +90G /dev/mapper/fedora-root
  Insufficient free space: 23040 extents needed, but only 23026 available

そのまま拡張したサイズを指定しても1GB=1024KBの関係で拡張できないので少し小さくする。

# lvextend -L +89G /dev/mapper/fedora-root
  Size of logical volume fedora/root changed from 38.64 GiB (9892 extents) to 127.64 GiB (32676 extents).
  Logical volume root successfully resized.

ファイルシステムを最後に変更して完了。

# resize2fs /dev/mapper/fedora-root
resize2fs 1.42.13 (17-May-2015)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/fedora-root
Couldn't find valid filesystem superblock.

怒られた。

調べたらxfsのアイルシステムではresize2fsは使えないようなのでxfs_growfsを利用する。
# xfs_growfs /dev/mapper/fedora-root
meta-data=/dev/mapper/fedora-root isize=512    agcount=4, agsize=2532352 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1
data     =                       bsize=4096   blocks=10129408, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=4946, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 10129408 to 33460224

再起動してdf -hなどで確認しておく。


2015年12月8日火曜日

PHP 7.0.0が正式にリリースされたのでインストールしてみる

このエントリーをはてなブックマークに追加
PHP 7.0.0が2015/12/3に正式リリースされたのでインストールだけやってみた。フレームワークとか何が対応済みかとかまでは調べていない。

PHP7.0.0の公式リリースノートによれば以下のような変更が実装されたという感じ。

Improved performance: PHP 7 is up to twice as fast as PHP 5.6
ーーPHP5.6に比べて2倍速くなった
Significantly reduced memory usage
ーーメモリ使用量が減った
Abstract Syntax Tree
ーー抽象構文木の採用
Consistent 64-bit support
ーー本格的な64bitサポート
Improved Exception hierarchy
ーー例外階層の改善
Many fatal errors converted to Exceptions
ーー多くの致命的なエラーを例外へ
Secure random number generator
ーーセキュアな乱数生成
Removed old and unsupported SAPIs and extensions
ーー古くてサポートされなくなったSAPIと拡張の削除
The null coalescing operator (??)
ーーnull 合体演算子(??)の実装
Return and Scalar Type Declarations
ーー関数のretrun値とスカラー型の宣言
Anonymous Classes
ーー匿名クラス
Zero cost asserts
ーー低コスト化


ちなみに試す同一環境には既にPHP5.6.15がインストールされているので共存できる環境を目指してみる。OSはCentOS7、Apacheは2.4.17がインストールされている環境。

とりあえずインストール先のprefixは/usr/local/php7としてインストールするようにすれば既存のものには影響がない"はず"

# ./configure --enable-mbstring=all --enable-mbregex --with-apxs2=/usr/local/apache2/bin/apxs --with-openssl --with-zlib --with-pdo-mysql=/usr/local/mysql --prefix=/usr/local/php7
# make
# make install


ここまで行うとhttpd.confに
LoadModule php7_module modules/libphp7.so
が追加されている。

前のPHP5のモジュール読み込み部分に関してはコメントアウトしておく
#LoadModule php5_module modules/libphp5.so

一応、php.iniを新しいのに置き換えてやる。

# mv /usr/local/lib/php.ini /usr/local/lib/php-5.ini.20151208
# cp -ipr /usr/local/src/php-7.0.0/php.ini-development /usr/local/lib/php.ini

Apacheを再起動してphpinfo()で確認してみる。

# systemctl start httpd.service


手順的には今までのPHP5.6系とほとんど変わっていなかった。

今日の作業

目標みつからず全然遊んでました。。。

2015年11月24日火曜日

DockerでCentOSのコンテナを作る

このエントリーをはてなブックマークに追加

CentOSのコンテナを作成したいと思うので、docker searchコマンドで確認する。

$ docker search centos
NAME                                        DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                                      The official build of CentOS.                   1652      [OK]
jdeathe/centos-ssh                          CentOS-6 6.6 x86_64 / EPEL/IUS Repos / Ope...   11                   [OK]
blalor/centos                               Bare-bones base CentOS 6.5 image                9                    [OK]
million12/centos-supervisor・・・
:
:
:
見つけた一番上のOffcialイメージをダウンロードする。
$ docker pull centos
Using default tag: latest
latest: Pulling from library/centos
fa5be2806d4c: Pull complete
0cd86ce0a197: Pull complete
e9407f1d4b65: Pull complete
c9853740aa05: Pull complete
e9fa5d3a0d0e: Pull complete
Digest: sha256:c96eeb93f2590858b9e1396e808d817fa0ba4076c68b59395445cb957b524408
Status: Downloaded newer image for centos:latest
イメージができているか確認する。
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              latest              e9fa5d3a0d0e        5 weeks ago         172.3 MB
起動して確認する。
$ docker run -t -i centos:latest /bin/bash
[root@25fc2734ad99 /]# ls
bin  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@25fc2734ad99 /]# whoami
root
[root@25fc2734ad99 /]# systemctl list-unit-files
UNIT FILE                            STATE
proc-sys-fs-binfmt_misc.automount    static
dev-hugepages.mount                  masked
dev-mqueue.mount                     static
proc-sys-fs-binfmt_misc.mount        static
:
:
終わって、コンテナ自体も終了しているか確認する。
[root@25fc2734ad99 /]# exit
exit
$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
25fc2734ad99        centos:latest       "/bin/bash"         11 minutes ago      Exited (0) 4 seconds ago                       jovial_meninsky

今日の作業

大阪へ戻ります。

2015年11月18日水曜日

(続)CasperJSで画面キャプチャを撮る〜日本語を利用できるようにする

このエントリーをはてなブックマークに追加
タイトルの通り、昨日の続き。なるほど、TTFフォントをインストールしていないからフォントが豆腐になったのか。

LinuxなのでIPAフォントを使ってみよう。書体はゴシックでいいや。

# wget http://dl.ipafont.ipa.go.jp/IPAexfont/ipaexg00301.zip
# unzip ipaexg00301.zip
# mkdir /usr/share/fonts/ipaexg00301
# cp -ip ipaexg00301/ipaexg.ttf /usr/share/fonts/ipaexg00301/
# fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/ipaexg00301: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
確認。
# fc-list
/usr/share/fonts/ipaexg00301/ipaexg.ttf: IPAexゴシック,IPAexGothic:style=Regular

キャプチャスクリプトを再実行
# casperjs screenshot.js


できたー

2015年11月11日水曜日

gcc: エラー: /usr/lib/rpm/redhat/redhat-hardened-cc1: そのようなファイルやディレクトリはありません

このエントリーをはてなブックマークに追加
gcc: エラー: /usr/lib/rpm/redhat/redhat-hardened-cc1: そのようなファイルやディレクトリはありません

と出た時はrpm-buildパッケージが足りないので、インストールしないといけない。
#dnf -y install rpm-build
依存性が解決されました。
================================================================================
 パッケージ                   アーキテクチャ
                                       バージョン               リポジトリ
                                                                           容量
================================================================================
インストール中:
 dwz                          x86_64   0.12-1.fc23              fedora    106 k
 ghc-srpm-macros              noarch   1.4.2-2.fc23             fedora    8.2 k
 gnat-srpm-macros             noarch   2-1.fc23                 fedora    8.4 k
 go-srpm-macros               noarch   2-3.fc23                 fedora    8.0 k
 ocaml-srpm-macros            noarch   2-3.fc23                 fedora    8.1 k
 perl-generators              noarch   1.06-1.fc23              updates    15 k
 perl-srpm-macros             noarch   1-17.fc23                fedora    9.7 k
 redhat-rpm-config            noarch   36-1.fc23                fedora     59 k
 rpm-build                    x86_64   4.13.0-0.rc1.6.fc23      updates   135 k
アップグレード中:
 rpm                          x86_64   4.13.0-0.rc1.6.fc23      updates   509 k
 rpm-build-libs               x86_64   4.13.0-0.rc1.6.fc23      updates   115 k
 rpm-libs                     x86_64   4.13.0-0.rc1.6.fc23      updates   293 k
 rpm-plugin-selinux           x86_64   4.13.0-0.rc1.6.fc23      updates    50 k
 rpm-plugin-systemd-inhibit   x86_64   4.13.0-0.rc1.6.fc23      updates    50 k
 rpm-python                   x86_64   4.13.0-0.rc1.6.fc23      updates    99 k
 rpm-python3                  x86_64   4.13.0-0.rc1.6.fc23      updates   100 k

トランザクションの要約
================================================================================
インストール    9 Packages
アップグレード  7 Packages

総ダウンロード容量: 1.5 M


(2016/1/1:追記)
redhat-rpm-configだけあればいけるみたい。