CentOS > Scientfic > DebianとそれぞれでKVM環境を作ってきましたが、今回はUbuntuです。構築してから丸一晩たってますが、使った感触はなかなかいい!!です。
ゲストOSのインストールもなんだか早く感じるし、OSの起動はマジはやです。
全部体感ですけど!
てなわけでDebianの時とほとんど一緒ですけど、インストールメモを残しておこうかと。インストール作業は割愛します。
まずはアプデ関連をしました。
sudo aptitude update
sudo aptitude upgrade
必要なパッケージを入れました。
sudo aptitude install kvm libvert-bin bridge-utils virt-manager
network-managerの削除は参考サイトではやってましたがこちらの環境では不要でした。
sudo aptitude remove network-manager
モジュールをロードしました。
sudo modprobe kvm_intel
sudo modprobe kvm
sudo lsmod | grep kvm
kvm_intel 132891 0
kvm 443165 1 kvm_intel
virbr0は生成されてたので削除しました。
brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yes
sudo virsh net-autostart default --disable
ネットワーク default の自動起動設定が解除されました
virsh net-destroy default
エラー: ネットワーク 'default' を取得できませんでした
エラー: Network not found: no network with matching name 'default'
sudo virsh net-destroy default
ネットワーク default は強制停止されました
brctl show
bridge name bridge id STP enabled interfaces
ネットワークの設定をしました。IPはそれぞれの環境下に合わせます。
sudo vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto em1
iface em1 inet static
address 192.168.24.61
network 192.168.24.0
netmask 255.255.255.0
broadcast 192.168.24.255
gateway 192.168.24.1
# This is an autoconfigured IPv6 interface
iface em1 inet6 auto
# bridge network
auto br0
iface br0 inet static
address 192.168.24.61
network 192.168.24.0
netmask 255.255.255.0
broadcast 192.168.24.255
gateway 192.168.24.1
bridge_ports em1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
UbuntuのDesktop版で静的に設定してrestartをかけるとOSが吹っ飛んでたのはなぜなんだろうなあ。Server版では問題なっしんぐ。
sudo service networking restart
networking stop/waiting
networking start/running
転送をOKにしました。
sudo vi /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
net.ipv4.ip_forward = 1
イメージをゲットしました。今回はFreeBSD9です。
cd /var/lib/libvirt/images
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/ISO-IMAGES/9.2/FreeBSD-9.2-RELEASE-i386-dvd1.iso
まいど御馴染みの作成コマンドー。
sudo virt-install \
--name=t1001 \
-connect=qemu:///system \
--ram=512 \
--vcpus=1 \
--cdrom /var/lib/libvirt/images/FreeBSD-9.2-RELEASE-i386-dvd1.iso \
--os-type=unix \
--disk path=/var/lib/libvirt/images/t1001,size=8,sparse=false,format=qcow2 \
--network bridge=br0 \
--vncport=5901 \
--vnclisten=192.168.24.61 \
--keymap=ja \
--vnc
インストールの開始中...
割り当て中 't1001' | 8.0 GB 00:00
ドメインを作成中... | 0 B 00:00
WARNING Unable to connect to graphical console: virt-viewer not installed. Please install the 'virt-viewer' package.
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
sudo virsh list --all
Id 名前 状態
----------------------------------------------------
1 t1001 実行中
ブリッジが増えていきます。
takeken@takeken:~$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.4437e65b6e64 no em1
vnet0
以降はWindowsのVNCソフトから192.168.24.61:5901につないでFreeBSDのインストールをしました。ホストサーバーが軽いので、もしかしてベンチマークの結果も違うのだろうかと試してみました。
でるのか新記録。
まずは姫野ベンチで試してみた結果。
# curl -O http://accc.riken.jp/secure/4514/cc_himenobmtxp_mpi.lzh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4414 100 4414 0 0 15826 0 --:--:-- --:--:-- --:--:-- 15935
root@t1002:~/himeno # ll
total 8
-rw-r--r-- 1 root wheel 4414 Dec 22 21:16 cc_himenobmtxp_mpi.lzh
解凍します。
# lha e cc_himenobmtxp_mpi.lzh
himenobmtxps.c - Melted : oo
makefile.sample - Melted : o
param.h - Melted : o
paramset.sh - Melted : o
コンパイルします。
# chmod +x paramset.sh
# ./paramset.sh M 1 1 1
# cp makefile.sample Makefile
# cp himenobmtxps.c himenoBMTxps.c
# make
mpicc -c -O3 himenoBMTxps.c
himenoBMTxps.c: In function 'initcomm':
himenoBMTxps.c:292:5: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default]
mpicc -o bmt himenoBMTxps.o -O3
1回目の実行結果。
# ./bmt
Sequential version array size
mimax = 129 mjmax = 129 mkmax = 257
Parallel version array size
mimax = 129 mjmax = 129 mkmax = 257
imax = 128 jmax = 128 kmax =256
I-decomp = 1 J-decomp = 1 K-decomp =1
Start rehearsal measurement process.
Measure the performance in 3 times.
MFLOPS: 1823.937112 time(s): 0.225510 1.733593e-03
Now, start the actual measurement process.
The loop will be excuted in 798 times
This will take about one minute.
Wait for a while
cpu : 52.612772 sec.
Loop executed for 798 times
Gosa : 8.374181e-04
MFLOPS measured : 2079.531165
Score based on Pentium III 600MHz : 25.102984
2回目の実行結果。
MFLOPS measured : 2096.758950
Score based on Pentium III 600MHz : 25.310948
ゲスト2個同時に試した。
MFLOPS measured : 1978.751098
Score based on Pentium III 600MHz : 23.886421
同時でも対して変わらないらしい。
ではまいどのUnixBenchの結果。
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 15824536.9 1356.0
Double-Precision Whetstone 55.0 2687.4 488.6
Execl Throughput 43.0 3412.4 793.6
File Copy 1024 bufsize 2000 maxblocks 3960.0 236442.2 597.1
File Copy 256 bufsize 500 maxblocks 1655.0 104310.4 630.3
File Copy 4096 bufsize 8000 maxblocks 5800.0 478051.5 824.2
Pipe Throughput 12440.0 1279678.4 1028.7
Pipe-based Context Switching 4000.0 325060.1 812.7
Process Creation 126.0 8818.5 699.9
Shell Scripts (1 concurrent) 42.4 7187.8 1695.2
Shell Scripts (8 concurrent) 6.0 902.7 1504.6
System Call Overhead 15000.0 717455.8 478.3
========
System Benchmarks Index Score 835.9
いつもと一緒やった!!
残念というかなんというか、コンピュータらしいというか。これが完全仮想化ってことで。