2009年3月22日

Debian lenny 建立XEN虛擬機器

Environment : Debian lenny
CPU : Intel Core 2 Duo E6550

Step 1:
#apt-get install xen-hypervisor-i386 xen-tools xen-docs-3.2 xen-shell xen-utils-3.2-1 xen-utils-common libc6-xen
xen-linux-system-2.6.26-1-xen-686 linux-headers-2.6.26-1-xen-686
bridge-utils

Step 2:
檢查/boot/grub/menu.list
default=0 //對應XEN核心版本Kernel Image
重新開機以XEN核心版本Kernel開機。

Step 3:
#nano /etc/xen/xend-config.sxp
修改如下區段
#(network-script network-dummy) //註解本行
(network-script network-bridge) //增加本行
(vif-script vif-bridge)

Step 4:
設定預設GuestOS建立環境
#nano /etc/xen-tools/xen-tools.conf
dir = /home/xen
size = 8Gb
memory = 512Mb
swap = 1024Mb
fs = ext3
dist = lenny
gateway = "gateway.ip"
netmask = "netmask.ip"
broadcast = "broadcast.ip"
passwd = 1
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
mirror = http://ftp.de.debian.org/debian/
serial_device = hvc0
disk_device = xvda

Step 5:
建立GuestOS
#xen-create-image --hostname=debian-guest01 --ip=ip --role=udev
過程會要求輸入root的密碼

Step 6:
#xm create /etc/xen/debian-guest01.cfg //啟動GuestOS(debian-guest01)
#xm list //列出虛擬機狀態
#xm console debian-guest01 //登入GuestOS

Step 7:
自動啟動GuestOS
#ln -s /etc/xen/debian-guest01.cfg /etc/xen/auto

參考資料:
Virtualization With Xen On Debian Lenny (AMD64)
Xen on Debian Etch 安裝

沒有留言: