Free download ubuntu8.04(include amd64)
http://releases.ubuntu.com/8.04/
安装
1. 安装ubuntu-8.04.4-server-amd64.iso
a) UltraISO刻录成DVD,从光盘安盘
b) UltraISO制做U盘启动盘,通过U盘安装
2. 更新升级系统中的软件
a) 下载源地址在/etc/apt/sources.list文件中
b) atp-get update 获取软件更新
c) atp-get upgrade更新系统中的软件
3. 安装ubuntu desktop
a) apt-get install ubuntu-desktop
4. 确保所有必须的软件已安装
a) apt-get install gcc g++ makepatch libssl-dev bzip2 gettext \
zlib1g-dev python libjpeg62-dev libx11-dev \
libgcrypt11-devpkg-config bridge-utils bcc bin86 pciutils-dev \
libsdl-devpython-dev texinfo libc6-dev uuid-dev bison flex fakeroot \
build-essentialcrash kexec-tools makedumpfile libncurses5 \
libncurses5-deviasl gawk
5. 安装xen kernel和dom0
a) apt-get installubuntu-xen-server
b) 安装完后重启,切换到root
c) uname –r确认xen kernel已安装
d) xm list确认dom0已安装
6. 安装xen-4.0.1
a) http://www.xen.org/products/xen_source.html下载xen-4.0.1.tar.gz
b) tar –xvf xen-4.0.1.tar.gz
c) cd xen-4.0.1
d) make xen stubdom tools
e) make install-xen install-tools install-stubdom
f) vi /boot/grub/menu.lst将kernel从xen-3.3.gz改为xen-4.0.1.gz
g) 重启
h)xm info确认4.0.1已启用
8. 安装Linux PV Domain
a) 根据需要修改配置文件/etc/xen-tools/xen-tools.conf
dir = /VM
install-method = debootstrap
size = 4Gb # Disk imagesize.
memory = 512Mb # Memory size
swap = 512Mb # Swap size
fs = ext3 # use theEXT3 filesystem for the disk image.
dist = hardy # Default distribution toinstall.
image = sparse # Specify sparse vs. full diskimages.
dhcp = 1
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
arch = amd64 #arch =amd64 must be added for ubuntu amd64 installation.
mirror = http://cn.archive.ubuntu.com/ubuntu/ #cn mirror
mirror = http://ftp.us.debian.org/debian/
ext3_options = noatime,nodiratime,errors=remount-ro
ext2_options = noatime,nodiratime,errors=remount-ro
xfs_options = defaults
reiser_options = defaults
disk_device = xvda #default
b)cd/etc/xen-tools/
c) xen-create-image –hostname xen-pvm
d)cd /etc/xen
e)xm createxen-pvm.cfg
f) xm list 确认pvm已安装
8. 安装windows HVM domain
a) 准备windows iso
/root/en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso
b)创建镜象文件xenwinxp.img
dd if=/dev/zero of=/VM/domains/xenwinxp.img bs=1024k seek=10000count=0
c) 创建新的配置文件vi /etc/xen/xen-hvm.cfg
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 pervcpu.
shadow_memory = 8
name = "xen-hvm"
vif = [ 'type=ioemu, bridge=xenbr0' ]
acpi = 1
apic = 1
disk = [ 'file:/VM/domains/xenwinxp.img,hda,w', 'file:/root/en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso,hdc:cdrom,r']
device_model = '/usr/' + arch_libdir + '/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=''
serial='pty'
usbdevice='tablet'
d)xm createxen-hvm.cfg
e)xm list 确认hvm已安装
使用
1. 连接到linux pvm
xm console <pvm-id>
在svm中查询ip地址, 以后就可以通过ssh连接了
2. 连接到hvm
xm vncviewer <hvm-id>
windows安装的窗口会显示在桌面上,安装完windows配置网络后,以后就可以通过远程桌面连接hvm了.
Linux PVM 使用Pygrub
1. Change the config file/etc/xen/xen-pvm.cfg, add bootlaoder.
bootloader = "/usr/bin/pygrub"
#kernel = '/boot/vmlinuz-2.6.24-28-xen'
#ramdisk = '/boot/initrd.img-2.6.24-28-xen'
memory = '512'
root = '/dev/xvda1 ro'
disk = [
'file:/VM/domains/xen-svm/disk.img,xvda1,w', # disk image must be thefirst disk
]
name = 'xen-svm'
dhcp = 'dhcp'
vif = [ 'mac=00:16:3E:C2:83:2C']
on_poweroff= 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
extra ='2 console=xvc0'
2. Mount the virtual disk imagefile
>mount–o loop /VM/domains/xen-svm/disk.img /mnt
3. Copy vmlinuz and initrd tovirtual disk image.
>cp/boot/ vmlinuz-2.6.24-28-xen /mnt/boot/
>cp/boot/ initrd.img-2.6.24-28-xen/mnt/boot/
4. Generate a menu.lst for virtualdisk image
>mkdir–p /mnt/boot/grub
>touch/mnt/boot/grub/menu.lst
>vi/mnt/boot/grub/menu.lst
title Ubuntu 8.04.4 LTS, kernel 2.6.24-28-xen
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-28-xen root=/dev/xvda1 roquiet splash
initrd /boot/ initrd.img-2.6.24-28-xen
quiet
5. umount disk image file andstart the pvm
>umount/mnt
>cd/etc/xen
>xmcreate xen-pvm.cfg