https://wiki.xenproject.org/index.php?title=Binqbu2002:Xen4.0_installation&feed=atom&action=historyBinqbu2002:Xen4.0 installation - Revision history2024-03-29T10:05:14ZRevision history for this page on the wikiMediaWiki 1.31.3https://wiki.xenproject.org/index.php?title=Binqbu2002:Xen4.0_installation&diff=17502&oldid=prevBinqbu2002: Created page with "First,You should install CentOS 5.5 X86-64,You can refer Qian's guide CentOS5.5 Installation =Install Xen4.0.1= Of course,you should download xen-4.0.1.tar.g..."2017-02-27T10:28:03Z<p>Created page with "First,You should install CentOS 5.5 X86-64,You can refer Qian's guide <a href="/index.php?title=Qian:CentOS&action=edit&redlink=1" class="new" title="Qian:CentOS (page does not exist)">CentOS5.5 Installation</a> =Install Xen4.0.1= Of course,you should download xen-4.0.1.tar.g..."</p>
<p><b>New page</b></p><div>First,You should install CentOS 5.5 X86-64,You can refer Qian's guide [[Qian:CentOS|CentOS5.5 Installation]]<br />
<br />
=Install Xen4.0.1=<br />
<br />
Of course,you should download xen-4.0.1.tar.gz and target it.<br />
<br />
==Step 1: Necessary tarball list for Xen-4.0.1==<br />
<br />
*newlib-1.16.0.tar.gz <br />
*lwip-1.3.0.tar.gz <br />
*zlib-1.2.3.tar.gz <br />
*pciutils-2.2.9.tar.bz2 <br />
*grub-0.97.tar.gz<br />
<br />
You can get them on ftp://192.168.1.253:5501 <br />
<br />
Download and place them in xen-4.0.1/stumdom/ <br />
<br />
==Step 2: Install dependence==<br />
<br />
The necessary dependence are listed as following:<br><br />
:* gcc v3.4 or later <br />
:* make<br />
:* binutils<br />
:* development install of zlib (e.g., zlib-dev)<br />
:* development install of Python v2.3 or later (e.g., python-dev)<br />
:* development install of curses (e.g., libncurses-dev)<br />
:* development install of openssl (e.g., openssl-dev)<br />
:* development install of x11 (e.g. xorg-x11-dev)<br />
:* bridge-utils package (/sbin/brctl)<br />
:* iproute package (/sbin/ip)<br />
:* hotplug or udev<br />
:* gawk<br />
:* gettext<br />
:* texinfo<br />
:* transfig<br />
:* development install of libssl (e.g. libssl-dev)<br />
:* bcc<br />
:* ACPI ASL compiler (iasl)<br />
:* latex relevance (e.g. texlive-latex-xxx, tetex-xxx, latex2html, latex2pdf)<br />
:* mercurial (NOTE: This can be unnecessary if you don't need the ''hg'' support.)<br />
:* git (NOTE: This can be unnecessary if you don't need the Git support.)<br />
:* qemu<br />
<br><br />
<br />
of course ,the following are important.<br />
<br />
<pre><br />
yum install binutils zlib-devel python-devel<br />
yum install ncurses-devel openssl-devel bridge-utils <br />
yum install iproute gettext texinfo*<br />
yum install transfig dev86 vnc<br />
yum install latex*<br />
yum install mercurial<br />
</pre><br />
<br />
==Step 3: Prepare domain0 kernel==<br />
You should download the domain0 kernel:'''linux-xen.stable-2.6.32.x.tar.gz''' on ftp://192.168.1.253:5501 to xen-4.0.1.<br />
<pre><br />
tar zxvf linux-xen.stable-2.6.32.x.tar.gz <br />
</pre><br />
note:In our installation,we use that<br />
<br />
<pre><br />
DOM0=linux-2.6-pvops<br />
DOM0_SRC=linux-xen.stable-2.6.32.x.tar.gz<br />
DOM0_MODULES=2.6.32.12<br />
</pre><br />
<br />
<br><br />
<br />
==Step 4:Compile and Install==<br />
<br />
When all things are ready, you need to obtain root permission. OK, start sailing!<br />
<br />
<pre><br />
make clean<br />
make dist KERNELS=linux-2.6-pvops<br />
make install KERNELS=linux-2.6-pvops<br />
</pre><br />
After the installation finish, you can see "xend" and "xendomains" in /etc/init.d/ directory.<br />
<br><br />
<br />
==Step 5:Modify the config==<br />
<br />
Be careful that if you refuse this step,you could find this error when you reboot to Xen-4.0.1 :<br />
<pre><br />
RedHat nash Version 5.1.19.6 startingrver(2.6.33.3)<br />
mount: could not find filesystem ‘/dev/root’<br />
setuproot: moving /dev failed: No such file or directory<br />
setuproot: error mounting /proc: No such file or directory<br />
setuproot: error mounting /sys: No such file or directory<br />
switchroot: mount failed: No such file or directory<br />
Kernel panic – not syncing: Attempted to kill init!<br />
[Linux-initrd @ 0x1fc37000,0x228585 bytes]<br />
</pre><br />
<br />
so, after compiling,you should do the following step:<br />
<br />
*modify the '''.config''' on xen-4.0.1/build-linux-2.6-prvops_x86_64/<br />
*set<br> '''CONFIG_SYSFS_DEPRECATED_V2=y'''<br><br />
'''CONFIG_SYSFS_DEPRECATED=y'''<br />
and do<br />
<pre><br />
cd build-*<br />
make<br />
make modules_install<br />
make install<br />
</pre><br />
<br />
==Step 6 :Create booting==<br />
<br />
You should return to root to do this<br />
<br />
<pre><br />
<br />
su -<br />
depmod 2.6.32.12<br />
mkinitrd -v -f /boot/initrd-2.6.32.12.img 2.6.32.12 \<br />
--builtin=pata_marvell \<br />
--builtin=ehci-hcd --builtin=ohci-hcd --builtin=uhci-hcd --builtin=ahci --builtin=ata_piix<br />
<br />
<br />
</pre><br />
After this,you can find '''initrd-2.6.32.12.img''' in /boot<br />
<br />
Then,modify grub<br />
<br />
add Xen start<br />
<pre><br />
title Xen Dom0, kernel 2.6.32.12<br />
root (hd0,0)<br />
kernel /xen-4.0.1.gz dom0_mem=512M<br />
module /vmlinuz-2.6.32.12 root=LABEL=/ rhgb quiet<br />
module /initrd-2.6.32.12.img<br />
</pre><br />
NOTE:''' Details should be similar to other entries, e.g. the value of root.'''<br />
<br />
Ok,now ,reboot<br />
<br />
=Create Domain U=<br />
<br />
* PLEASE LOG IN AS root!!!!<br />
* First, create a hard disk .img file in console, "qemu-img" is a tool, "create" is the subcommand, "xxx.img" is the target image <br />
<br />
==Create a hard disk==<br />
(this way is faster)<br />
<pre><br />
qemu-img create xxx.img 20G<br />
</pre><br />
or<br />
(the old way, which is very slow and you will hear harddisk crying)<br />
<pre><br />
dd if=/dev/zero of=xxx.img bs=1024k count=2048<br />
</pre><br />
<br />
==xend start==<br />
<br />
so,you can excute<br />
<pre><br />
xend start<br />
</pre><br />
<br />
if you find the error<br />
<br />
<pre><br />
> ERROR Internal error: Could not obtain handle on privileged command <br />
> interface (2 = No such file or directory)<br />
> Traceback (most recent call last):<br />
> File "/usr/sbin/xend", line 36, in <module><br />
> from xen.xend.server import SrvDaemon<br />
> File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", <br />
> line 26, in <module><br />
> File "usr/lib/python2.5/site-packages/xen/xend/server/relocate.py", <br />
> line 28, in <module><br />
> File "usr/lib/python2.5/site-packages/xen/xend/XendDomain.py", line <br />
> 35, in <module><br />
> File "usr/lib/python2.5/site-packages/xen/xend/XendCheckpoint.py", <br />
> line 20, in <module><br />
> File "usr/lib/python2.5/site-packages/xen/xend/image.py", line 46, <br />
> in <module><br />
> xen.lowlevel.xc.Error: (1, 'Internal error', 'Could not obtain handle <br />
> on privileged command interface (2 = No such file or directory)')<br />
</pre><br />
<br />
you should do the following<br />
<br />
modify '''/etc/fstab''' by adding:<br />
<pre><br />
none /proc/xen xenfs defaults 0 0<br />
</pre><br />
<br />
more solution,you can refer [http://www.vpsee.com/2010/10/fail-to-start-xend-with-xen-4-0-1-on-ubuntu-10-04/ xend start problem]<br />
<br />
==create winxp config file==<br />
<br />
If you want to create a domainU and want to install winxp on it ,you should create a''' winxp''' config file and copy the following<br />
<pre><br />
import os, re<br />
<br />
arch = os.uname()[4]<br />
<br />
if re.search('64', arch):<br />
arch_libdir = 'lib64'<br />
else:<br />
arch_libdir = 'lib'<br />
<br />
kernel = "/usr/lib/xen/boot/hvmloader"<br />
<br />
builder='hvm'<br />
<br />
memory = 1024 <br />
<br />
name = "winxp"<br />
<br />
vcpus = 1<br />
#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3<br />
<br />
#vif = [ 'type=vnif, mac=00:16:3e:00:00:11' ]<br />
<br />
disk = ['file:/root/xxx.img,hda,w', 'phy:/dev/cdrom,hdc:cdrom,r']<br />
#disk = ['file:/var/lib/xen/images/winxp.img,hda,w','phy:/dev/cdrom,hdc:cdrom,r']<br />
<br />
on_poweroff = 'destroy'<br />
on_reboot = 'restart'<br />
on_crash = 'restart'<br />
<br />
device_model = '/usr/lib/xen/bin/qemu-dm'<br />
<br />
boot="dc"<br />
<br />
vnc=1<br />
localtime=1<br />
<br />
#cpuid = [ '0x40000002:edx=0x3' ]<br />
<br />
#mouse adjustment<br />
usb=1<br />
usbdevice='tablet'<br />
<br />
#guest os debug support<br />
serial = 'pty'<br />
#serial = 'tcp::4444,server,nowait'<br />
</pre><br />
Notice:disk = ['file:/root/xxx.img,hda,w', 'phy:/dev/cdrom,hdc:cdrom,r']<br />
'''the file path is your domain U path!!'''<br />
<br />
==launch xend==<br />
<pre><br />
xend start<br />
</pre><br />
* Launch a console, cd to the config file directory, type in: (winxp is the name of the config file)<br />
<pre><br />
xm create winxp<br />
</pre><br />
* Type following to "see" domain U. "xm create" only launches the domainU and runs it at "background", so you need to use vnc (a remote desktop) to connect to domainU display.<br />
<pre><br />
xm vnc winxp<br />
</pre><br />
If everything goes well, you can see the black booting screen in the Domain U.<br><br />
* Note: Sometimes, the domainU is created but disappear immediately. Please put a bootable CD in the CD-ROM in advance.<br />
* If there is nothing, you can use:<br />
<pre><br />
xm list<br />
</pre><br />
to check if winxp has been launched.<br><br />
<br />
OK,enjoy!<br />
<br />
=Qian's XEN4.0 Installation Script= <br />
Of course,Qian give a wonderful Installation Script of Xen-4.0.0,We should thanks to him and we can refer his scription<br />
<pre><br />
<br />
#!/bin/bash<br />
XEN=xen-4.0.0<br />
DOM0=linux-2.6-pvops<br />
DOM0_SRC=linux-xen.stable-2.6.32.x.tar.gz<br />
DOM0_MODULES=2.6.32.12<br />
<br />
echo "Deleting previous Xen directory."<br />
rm -rf $XEN<br />
<br />
echo "Extracting Xen source package ..."<br />
tar xzf $XEN.tar.gz<br />
echo "Extracting Dom0 kernel ..."<br />
tar xzf $DOM0_SRC -C $XEN<br />
echo "Preparing stubdom packages ..."<br />
cp stubdom_pkg/* $XEN/stubdom/<br />
<br />
cd $XEN/<br />
make clean<br />
make dist KERNELS=$DOM0<br />
make install KERNELS=$DOM0<br />
depmod $DOM0_MODULES<br />
mkinitrd -v -f /boot/initrd-$DOM0_MODULES.img $DOM0_MODULES \<br />
--builtin=pata_marvell \<br />
--builtin=ehci-hcd --builtin=ohci-hcd --builtin=uhci-hcd --builtin=ahci --builtin=ata_piix<br />
<br />
exit 0<br />
<br />
</pre><br />
<br />
=参考文档=<br />
<br />
*[http://wiki.xensource.com/xenwiki/XenDom0Kernels Xen Dom0 kernel: Quick Start]<br />
*[http://blog.chinaunix.net/u3/106900/showart_2105560.html xen实践手册]<br />
*[http://ppadala.net/blog/2010/09/how-to-setup-xen4-pvops-2-6-32-x-on-centos-5-5/ How to Setup Xen4 and pvops 2.6.32.x on CentOS 5.5]</div>Binqbu2002