今日の作業
kvmは前にインストール済み。どうやってインストールしたが忘れてしまった。確かkvmをインストールしたあと、ユーザにkvmグループを登録したような。。。
/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 allow-hotplug eth0 iface eth0 inet dhcp
変更後の設定
# 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 #allow-hotplug eth0 #iface eth0 inet dhcp auto eth0 iface eth0 inet static address 0.0.0.0 auto br0 iface br0 inet static address 192.168.1.5 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
イメージを作成
% mkdir /vm/centos % cd !$ % qemu-img create -f qcow2 centos4.img 15G
CentOS4.8のDVDイメージをダウンロード。
http://ftp.riken.jp/Linux/centos/4.8/isos/x86_64/CentOS-4.8-x86_64-binDVD.iso
イメージからCentOS4.8をインストール
% kvm -localtime -no-acpi \ -cdrom ~/download/iso/CentOS-4.8-x86_64-binDVD.iso \ -hda centos4.img -boot d -m 512 &
インストールはカスタムの最小で。
インストール後、メディアを取り出して再起動してね、と言われたのでて再起動したけど、再起動時に何か言われて(忘れた。。)再起動できなかった。一旦度終了して、コマンドラインから起動。
% sudo kvm -localtime \ -hda /vm/centos/centos4.img -m 512 \ -net nic,macaddr=52:54:00:12:34:56 \ -net tap,script=/etc/kvm/kvm-ifup
sudoしないと、
warning: could not configure /dev/net/tun: no virtual network emulation
と怒られる。
起動時に、Kudzuというので、ネットワークの変更関連をする。MACアドレスが変わったからかなぁ。ログインプロンプトが出てrootでログイン(インストール時にユーザアカウントの作成とかってしなかったなぁ、何か見逃したのかも、あるいはインストール後の再起動とかでやるのかな)。ログイン後、pingして、ホストOSに接続できるし、googleにもpingできた。
シャットダウンして、今度はvirt-managerを使用してみることにする。
virt-managerをインストール。
% sudo apt-get install virt-manager
いろんなパッケージがインストールされた。
libvirtグループを user1 に登録。
% sudo adduser user1 libvirt
一旦ログアウトして、ログインし直す。
% virt-manager
で起動して、centos4.imgを使用して作った。
今日はここまで。