Wednesday, October 7, 2009

Xen on RHEL 5.4

XEN on RHEL

When i was messing with Virtualization with Xen Kernel on RHEL 5.4, i took some notes myself, i'd like to share with you maybe it will be useful for you as well. I've googled thousands of webpages to get answers for my questions and i bind them all in couple of scripts.

Here you go,

#Installing Xen kernel in a non-Xen-awared OS, OS can be operated as Hypervisor/Dom0 after this step
yum install xen kernel-xen
#Install recommended virtualization packages (you need a GUI for VMM, so if you have one, please install with yum groupinstall "X Window System" "GNOME Desktop Environment")
yum install virt-manager libvirt libvirt-python python-virtinst
#You need to edit grub.conf for making Xen Kernel the default kernel
vim /etc/grub.conf
#Reboot with new Xen Kernel
reboot
#Ok we need Vnc access so, edit xstartup file and add "gnome-session &"
vim /root/.vnc/xstartup


#Other "need to know" stuff here
#Your local FTP directory should be like D:\ftp\xen\xen\images, ISO should be exracted in D:\ftp\xen\xen\ directory, you need to set all permissions in you FTP Server
#You need to point your FTP Server as ftp://192.168.1.13/xen
#VMM is a good GUI program but what if you don't want to use GUI, so virt-install and virsh will be the best option for you
#Some basic command examples,
#virt-install --prompt |for basic installation, if VMM stuck and doesn't install your OS, try this one
#virt-install \
--paravirt \
--name demo \
--ram 500 \
--file /var/lib/xen/images/demo.img \
--file-size 6 \
--nographics \
--location ftp://192.168.1.13/xen
#This is basic virt-install command for installing Paravirtual DomU with KS file
virt-install \
--paravirt \
--name demo \
--ram 512 \
--file /var/lib/xen/images/demo.img \
--file-size 6 \
--nographics \
--location ftp://192.168.1.13/xen \
--extra-args="console=xvc0 ip=192.168.1.215 netmask=255.255.255.128 gateway=192.168.1.129 dns=192.165.149.1 ks=ftp://192.168.1.13/catt_fc6.ks.cfg"
#virsh list
#virsh console DomU
#virsh autostart DomU
#virsh define DomUXML.cfg
#Basic Full Virtual DomU XML
<domain type='xen'>
<name>vA2E-0</name>
<uuid>971402c5-6275-0005-c2a2-fb9142f7adf9</uuid>
<memory>4188160</memory>
<currentMemory>4188160</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='xenfv'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/var/lib/xen/images/vA2E-0.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='phy'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:0c:7a:c2'/>
<source bridge='xenbr0'/>
<script path='vif-bridge'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>
#Basic Paravirtual DomU XML
<domain type='xen'>
<name>vA2E-0</name>
<uuid>a6469aa9-c50c-339a-f68d-3888cbc54ebc</uuid>
<memory>4188160</memory>
<currentMemory>4188160</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/var/lib/xen/images/vA2E-0.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:4b:07:d3'/>
<source bridge='xenbr0'/>
<script path='vif-bridge'/>
</interface>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>


I hope you find it usefull

Typhoon

No comments:

Post a Comment