VMwarePlayerでUbuntu
やりたいこと
VMwarePlayer+Ubuntu/KVM/OVSでOpenFlowテスト環境をつくる(1)Add Star
http://d.hatena.ne.jp/stereocat/20130116/1358342989
VMwareToolsのインストール
sudo -i
apt-get install gcc
mkdir /mnt/cdrom
mount -t iso9660 /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
cp VM*.tar.gz /tmp
cd /tmp
tar zxvf VMwareTools*.tar.gz
cd vmware-tools-distrib
./vmware-install.pl
shutdown -r 0
ただ、server版だからかコピペがうまくいかなかったので もはや普通にsshクライアント (puttyとか
でいじることに
ssh 関連
sudo apt-get install openssh-server ssh
service ssh status
ssh localhost
自動起動させたかったので chkconfig使う
chkconfig
sudo apt-get install chkconfig
chkconfig ssh on
chkconfig ssh on でエラー
なんか
/sbin/insserv がないよーってエラーが出ます
シンボリックリンクはって対応するらしい・・・? http://netkids.me/post/25291140466/ubuntu-12-04-64bit-sbin-insserv
ln -s /usr/lib/insserv/insserv /sbin/insserv
chkconfig ssh on
chkconfig ssh on
chkconfig ssh
なんかずらーっと長いコマンドで怒られますがもう一度やると大丈夫です。
ポート固定
sshの関係上ポートを固定します。
まずはインストールしたVMware playerのdhcpがどのレンジか調べます。
win7ではc:\programdata\vmware\vmnetdhcp.confを開きます
# Virtual ethernet segment 8
# Added at 03/17/13 15:39:57
subnet 192.168.65.0 netmask 255.255.255.0 {
range 192.168.65.128 192.168.65.254; # default allows up to 125 VM's
option broadcast-address 192.168.65.255;
option domain-name-servers 192.168.65.2;
option domain-name "localdomain";
option netbios-name-servers 192.168.65.2;
option routers 192.168.65.2;
default-lease-time 1800;
max-lease-time 7200;
}
host VMnet8 {
hardware ethernet 00:50:56:C0:00:08;
fixed-address 192.168.65.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}
# End
となっていたので 192.168.65.3〜127までが使えますね
/etc/network/interfaceをいじっていきます
auto eth0
iface eth0 inet static
address 192.168.65.100
netmask 255.255.255.0
gateway 192.168.65.2
dns-nameservers 192.168.65.2 192.168.0.15
Ubuntu上にKVMとOPEN vSwitchインストール
参考
http://d.hatena.ne.jp/stereocat/20130116/1358342989
http://blog.scottlowe.org/2012/08/17/installing-kvm-and-open-vswitch-on-ubuntu/
OSの更新
sudo apt-get update -y && sudo apt-get dist-upgrade && uname -a
KVMのインストール
ifconfigでvirbr0ができているか確認
ifconfig
linux bridgeじゃなくてOpen vSwitchを使うのが目的なので削除
sudo virsh net-destroy default
sudo virsh net-autostart --disable default
sudo aptitude purge ebtables
OVS(Open vSwitch)のインストール
sudo apt-get install openvswitch-controller openvswitch-brcompat openvswitch-switch openvswitch-datapath-source
bridge compatibility mode
インストールしたら
OVSを bridge compatibility mode?にするそうで
vim /etc/default/openvswitch-switch
#BRCOMPAT=no
を
BRCOMPAT=yes
に変更し起動
OVS起動
sudo service openvswitch-switch start
OVSPID確認
service openvswitch-switch status
で
ovsdb-server
ovs-vswitchd
ovs-brcompatd
OVSコンフィグ確認
sudo ovs-vsctl show
で設定空
を確認
TIPS
virbr0とか消し忘れるとエラーがでるようなので
FATAL: Module brcompat not found.
* Inserting brcompat module
Module has probably not been built for this kernel.
For instructions, read
/usr/share/doc/openvswitch-datapath-source/README.Debian
FATAL: Module brcompat not found.
* Inserting brcompat module
FATAL: Error inserting brcompat (/lib/modules/3.5.0-25-generic/kernel/brcompat.ko): Unknown symbol in module, or unknown parameter (see dmesg)
* Inserting brcompat module
Module has probably not been built for this kernel.
For instructions, read
/usr/share/doc/openvswitch-datapath-source/README.Debian
FATAL: Error inserting brcompat (/lib/modules/3.5.0-25-generic/kernel/brcompat.ko): Unknown symbol in module, or unknown parameter (see dmesg)
* Inserting brcompat module
その時は 以下のようにするらしい
sudo module-assistant auto-install openvswitch-datapath
んだけど これでもだめで
bridge modが読み込まれてるとだめっぽいのでそこの対策をしました
# Fix
# Unload the Linux bridging module “bridge”, will be loaded on reboot w/this method: $ lsmod | grep bridge
#If it is you can remove it temporarily until a reboot: $ rmmod bridge# Blacklist the ko module to make the removal persistent through reboots: Edit /etc/modprobe.d/blacklist Add: blacklist bridge
# Delete the bridge-utils package:
#Ubuntu
$ apt-get purge bridge-utils#Redhat
$ yum remove bridge-utils Verify block/removal
$ lsmod | grep bridge
上記のとおり
lsmod|grep bridge
rmmod bridge
vim /etc/modprobe.d/blacklist
- blacklist bridge
sudo apt-get purge bridge-utils
そのあと再起動し
lsmod|grep br
brcompat 13513 0
openvswitch 84124 1 brcompat
service openvswitch-switch status
ovsdb-server is running with pid 1116
ovs-vswitchd is running with pid 1130
ovs-brcompatd is running with pid 1133
ってことで大丈夫でした
kernelバージョンアップするとうまく入らない臭い
その時は上にも書いたけど
module-assistant auto-install openvswitch-datapath
とかしてインストールする
その時
sudo apt-get install module-assistant
とか必要かも
WindowsユーザーがSqaleで遊ぶために VMware player+Ubuntu12.04.2+ruby1.9.3+rails3.2.12+rvmな環境を整える
参考
-
- Ubuntu12.04 にRVM を導入して、かなしみを吹っ飛ばしました
http://d.hatena.ne.jp/moznion/20121011/1349974417
http://d.hatena.ne.jp/inouetakuya/20120205/1328443579
-
- VMware Player で共有フォルダを有効にする(2)
インストール
ここまではぐぐってください
初期設定
- 日本語配列にキー配列変更
sudo loadkeys jp
- アップデート
sudo apt-get -y update && sudo apt-get -y dist-upgrade
- ビルド環境
sudo apt-get install make gcc g++ wget libssl-dev zlib1g-dev libreadline-dev libxslt-dev libxml2-dev
- VMware tools(共有フォルダの設定のため必要)
sudo -i
apt-get install gcc
mkdir /mnt/cdrom
mount -t iso9660 /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
cp VM*.tar.gz /tmp
cd /tmp
tar zxvf VMwareTools*.tar.gz
cd vmware-tools-distrib
./vmware-install.pl
shutdown -r 0
- 共有フォルダ設定
VMware Player で共有フォルダを有効にする(2)
http://korikorikorikori.blog.fc2.com/blog-entry-156.html
/mnt/hgfs/
以下にマウントされます
- ssh環境
RVM
sudo apt-get -y install git-core curl
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
追記
後日別環境で行ったところ
rvm install 1.9.3
の前に
sudo apt-get install libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbmdev libncurses5-dev automake libtool bison pkg-config libffi-dev
をする必要がありました
bootstrapを使ってみる
参考
Ruby on Rails 3.2.10でとりあえずプロジェクト立ち上げるメモ
http://qiita.com/items/e2427141443a90d66a35
Gehirn RS2 に nginx + unicorn 環境で Rails3 を動かしてみる("おまけ" twitter-bootstrap-rails も動かしてみよう)
http://qiita.com/items/c1edfa84b34dba2211ac
インストール
/mnt/hgfs/railsを共有フォルダとしたのでここで作っていきます
rails new bootstrap
cd bootstrap
bootstrapつかうよーとGemfileに書いて
bundle install
すると
sqlite3がないよ とか言われるので
sudo apt-get install -y sqlite3 libsqlite3-dev
gem install sqlite3 -v '1.3.7'
再度 bundle install
bundle install
意気揚々と
rails g bootstrap:install
とかやると
/.rvm/gems/ruby-1.9.3-p392/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
みたいに怒られます
どうやらランタイムエンジンがないよ ということで
ExecJS supports these runtimes:
therubyracer - Google V8 embedded within Ruby
therubyrhino - Mozilla Rhino embedded within JRuby
Node.js
Apple JavaScriptCore - Included with Mac OS X
のどれかをつかえってことなんですけど
定番?の therubyracerを使っていきます
http://qiita.com/items/e2427141443a90d66a35
Gemfileに
gem 'execjs'
gem 'therubyracer'
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
とかいて
bundle install
rails g bootstrap:install less
うまく
insert app/assets/javascripts/application.js
create app/assets/javascripts/bootstrap.js.coffee
create app/assets/stylesheets/bootstrap_and_overrides.css.less
create config/locales/en.bootstrap.yml
gsub app/assets/stylesheets/application.css
gsub app/assets/stylesheets/application.css
とかでたら成功です