[[PageOutline]]
{{{
#!html
Xen 4.0.1_rc6 Installation on Debian 6.0 Squeeze
}}}
= 【Step 1: 安裝 Xen hypervisor和 Xen-patched kernel】 =
* 在 Debian Squeeze Testing 版本上快速安裝 Xen-4.0.1 Hypervisor & Xen patched kernel - 2.6.32-5
{{{
$ sudo apt-get update
$ sudo apt-get install xen-linux-system-2.6.32-5-xen-amd64
}}}
----
= 【Step 2: 編輯 Xend 設定檔 & 開機選單】 =
* 編輯 xend 的設定檔 /etc/xen/xend-config.sxp
{{{
$ sudo su
# echo HWCLOCKACCESS=no >>/etc/default/rcS
# echo loop max_loop=100 >> /etc/modules
# echo blktap >> /etc/modules
[CTRL+D]
$ sudo vim /etc/xen/xend-config.sxp
}}}
{{{
#!sh
60 (xend-http-server yes)
61 (xend-unix-server yes)
62 (xend-tcp-xmlrpc-server yes)
64 (xend-relocation-server yes)
68 (xend-unix-path /var/lib/xend/xend-socket)
74 (xen-tcp-xmlrpc-server-port 8006)
84 (xend-port 8000)
88 (xend-relocation-port 8002)
107 (xend-address localhost)
125 (xend-relocation-hosts-allow '')
149 (network-script 'network-bridge netdev=eth1')
}}}
* 編輯 boot menu
{{{
$ sudo vim /boot/grub/grub.cfg
}}}
{{{
#!sh
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-xen-amd64' --class debian --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 5b161b4b-e438-4827-8227-4396d26acfe0
echo 'Loading Linux 2.6.32-5-xen-amd64 ...'
multiboot (hd0,1)/boot/xen-4.0-amd64.gz
module /boot/vmlinuz-2.6.32-5-xen-amd64 root=UUID=5b161b4b-e438-4827-8227-4396d26acfe0 ro quiet
echo 'Loading initial ramdisk ...'
module /boot/initrd.img-2.6.32-5-xen-amd64
}
}}}
* 重開機
{{{
$ sync ; sudo reboot
}}}
= 【Step 3: 安裝 Xen image 製作工具】 =
* 安裝 xen-tools
{{{
$ sudo apt-get install xen-tools
}}}
* 編輯 xen-tools 的設定檔
{{{
$ sudo vim /etc/xen-tools/xen-tools.conf
}}}
{{{
#!sh
45 dir = /home
83 install-method = debootstrap
128 size = 2Gb # Disk image size.
129 memory = 128Mb # Memory size
130 swap = 128Mb # Swap size
132 fs = ext3 # use the EXT3 filesystem for the disk image.
133 dist = lucid # Default distribution to install.
134 image = sparse # Specify sparse vs. full disk images.
163 gateway = 192.168.1.254
164 netmask = 255.255.255.0
165 broadcast = 192.168.1.255
233 passwd = 1
261 mirror = http://archive.ubuntu.com/ubuntu
313 serial_device = hvc0
331 output = /home/domains
}}}
= 【Step 4: Xen Information Check】 =
* Check Xen Information
{{{
$ sudo xm info
}}}
{{{
host : VMserver
release : 2.6.32-5-xen-amd64
version : #1 SMP Thu Aug 12 15:17:50 UTC 2010
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2826
hw_caps : bfebfbff:20100800:00000000:00000940:0408e3fd:00000000:00000001:00000000
virt_caps : hvm hvm_directio
total_memory : 8025
free_memory : 1509
node_to_cpu : node0:0-3
node_to_memory : node0:1509
node_to_dma32_mem : node0:813
max_node_id : 0
xen_major : 4
xen_minor : 0
xen_extra : .1-rc6
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline :
cc_compiler : gcc version 4.4.5 20100816 (prerelease) (Debian 4.4.4-9)
cc_compile_by : waldi
cc_compile_domain : debian.org
cc_compile_date : Tue Aug 17 21:17:33 UTC 2010
xend_config_format : 4
}}}
= 【Step 5: 安裝 XP VM】 =
* 安裝 Xen Qemu Device Model virtual machine hardware emulator
{{{
sudo apt-get install xen-qemu-dm-4.0
}}}
* 將"原廠" XP 光碟放入光碟機並製作印象檔
{{{
sudo dd if=/dev/cdrom of=/home/rider/xp.iso
}}}
* 製作一個空的 8GB image file
{{{
sudo dd if=/dev/zero of=/home/domains/xp/xp.img bs=1024M count=8
}}}
* 製作 XP 虛擬機器的設定檔
{{{
sudo vim /home/domains/xp.cfg
}}}
{{{
#!sh
import os, re
arch = os.uname()[4]
if re.search('64', arch):
arch_libdir = 'lib64'
else:
arch_libdir = 'lib'
kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 1024
# Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
shadow_memory = 8
name = "xp"
vif = [ 'type=ioemu, bridge=eth1' ]
disk = [ 'file:/home/domains/xp/xp.img,hda,w', 'file:/home/rider/xp.iso,hdc:cdrom,r' ]
device_model = '/usr/lib/xen/bin/qemu-dm'
#-----------------------------------------------------------------------------
# boot on floppy (a), hard disk (c) or CD-ROM (d)
# default: hard disk, cd-rom, floppy
boot="dc"
sdl=0
vnc=1
vncconsole=1
vncpasswd=''
stdvga=0
serial='pty'
usbdevice='tablet'
}}}
* 開啟虛擬機器開始安裝 Windows XP
{{{
sudo xm create xp.cfg
}}}
= 【Reference】 =
* [http://www.virtuatopia.com/index.php/Installing_and_Running_Windows_XP_or_Vista_as_a_Xen_HVM_domainU_Guest Installing and Running Windows XP or Vista as a Xen HVM domainU Guest ]