UbuntuにXenをインストールする
準仮想化の環境を使いたくなったため、今回はUbuntuにXenの環境を用意することにしました。
Xenのインストール
Xen本体のインストールはパッケージを指定して終了です。
インストール後再起動して、Xenカーネルを起動させます。
$ sudo apt-get install xen-hypervisor-amd64
「/etc/network/interfaces」は以下のように設定しました。
auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.0 network xxx.xxx.xxx.0 broadcast xxx.xxx.xxx.255 gateway xxx.xxx.xxx.1 bridge_ports ether bridge_stp off bridge_fd off bridge_maxwait 0
次にvirt-installを使えるようにします。
$ sudo apt-get install virtinst
「/etc/xen/xend-config.sxp」の以下一行を変更します。
$ sudo vi /etc/xen/xend-config.sxp #(xend-unix-server no) → (xend-unix-server yes)
xendを再起動します。
$ sudo /etc/init.d/xend restart
OSのインストール
virt-install を使いました。
$ sudo virt-install --name centos6-test --vcpu 1 --ram 512 --file /opt/xen/centos6-test --file-size 10 --nographics --paravirt --location http://ftp.riken.jp/Linux/centos/6.3/os/x86_64
コンフィグファイルは「/var/lib/xend/domains
中身はこんな感じでした。
sxp (domain (domid 2) (vcpus_params ((cap 0) (weight 256))) (PV_args '') (memory_static_min 0) (HVM_boot_policy '') (PV_bootloader /us/lib/xen-default/bin/pygrub) (pool_name Pool-0) (auto_power_on False) (memory_static_max 536870912) (cpus (())) (actions_after_shutdown destroy) (memory_dynamic_max 536870912) (memory_sharing 0) (superpages 0) (is_a_template False) (PV_bootloader_args '') (memory_dynamic_min 536870912) (VCPUs_live 1) (target 0) (actions_after_crash restart) (uuid 4732dc64-63cf-095b-2493-3b6ce00d6cec) (PV_ramdisk '') (other_config ()) (name_label centos6) (PV_kernel '') (actions_after_reboot restart) (VCPUs_at_startup 1) (HVM_boot_params ()) (platform ((tsc_mode 0) (pci ()) (nomigrate 0))) (VCPUs_max 1) (Description '') (pool_name Pool-0) (bootloader /usr/lib/xen-default/bin/pygrub) (vcpus 1) (cpus (())) (on_poweroff destroy) (description '') (on_crash restart) (uuid 4732dc64-63cf-095b-2493-3b6ce00d6cec) (bootloader_args '') (name centos6-test) (on_reboot restart) (maxmem 512) (memory 512) (shadow_memory 0) (vcpu_avail 1) (features '') (on_xend_start ignore) (on_xend_stop ignore) (start_time 1262495682.45) (image (linux (kernel '') (superpages 0) (pci ()) (nomigrate 0) (tsc_mode 0) (notes (HV_START_LOW 18446603336221196288) (FEATURES '!writable_page_tables|pae_pgdir_above_4gb') (VIRT_BASE 18446744071562067968) (GUEST_VERSION 2.6) (PADDR_OFFSET 0) (GUEST_OS linux) (HYPERCALL_PAGE 18446744071578849280) (LOADER generic) (SUSPEND_CANCEL 1) (PAE_MODE yes) (ENTRY 18446744071591563776) (XEN_VERSION xen-3.0) ) ) ) (status 1) (state ------) (store_mfn 496791) (console_mfn 496790) (device (vif (bridge br0) (mac 00:16:3e:cb:3c:5d) (script /etc/xen/scripts/vif-bridge) (uuid 1cdcd1be-ed56-71ce-b8ed-e042160039a3) (backend 0) ) ) (device (vbd (protocol x86_64-abi) (uuid f4173f46-1ba6-c965-b63f-34a8aca61766) (bootable 1) (dev xvda:disk) (uname file:/opt/xen/centos6-test) (mode w) (backend 0) (VDI '') ) ) )
今日はこんなところで。