This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11066|Reply: 0

CentOS 6.5 system with Xen 4.1.2 virtual machine

[Copy link]
Posted on 1/27/2015 9:51:10 AM | | | |

Installing xen under centos is not very smooth, encountering a lot of problems. The installation process mainly refers to the following two documents:

?action=fullsearch&value=linkto%3A%22RHEL6Xen4Tutorial%22&context=180

This method can install xen normally, and points out that the problem encountered when installing xen under RedHat 6 is that the installation process is complicated and not the source code installation.

system andInstallationThe xen version is introduced above, and we have started to install xen.

1. Download the source code of Xen

wget

2. Install the required software packages

yum groupinstall "Development Libraries"
yum groupinstall "Development Tools"
yum install transfig wget texi2html libaio-devel dev86 glibc-devel
e2fsprogs-devel gitk mkinitrd iasl xz-devel
bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel
gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial libidn-devel
yum -y install glibc-devel.i686texinfo libuuid-devel iasl python-lxml
yum -y install openssl openssl-devel
yum -y install ncurses ncurses-*
yum -y install python-devel

3. Compile and install the Xen hypervisor

tar zxvf xen-4.1.. tar.gz
cd xen-4.1.
make world

You may encounter the following issues here:



Workaround: yum –y install texinfo

4. Add Xen to the startup script:

/sbin/chkconfig --add xend
/sbin/chkconfig --add xencommons
/sbin/chkconfig --add xendomains
/sbin/chkconfig xend on
/sbin/chkconfig xendomains on
/sbin/chkconfig xencommons on

5. CompilationInstallationLinux 3.1.2 kernel

wget
tar -jxvflinux-3.1..tar.bz2
make menuconfig
Processor type and features --- >
      Select Paravirtualized Guest Support
   Device Drivers --->
       Xen driver support --->
         Select All*
Modified: CONFIG_XEN_DEV_EVTCHN=y (if m, xencommons cannot be started on boot)

Note: The above is not enough, it also needs to be modified: otherwise you will encounter such a problem in the process of creating a virtual machine:



Note: Device 0 (vif) could not be connected. HotPlug scripts not working.

Make the following modifications in the .config file to solve the problem

CONFIG_XEN_BLKDEV_BACKEND=m
CONFIG_XEN_NETDEV_BACKEND=m

Next, I started compiling and installing:

make
make modules
make modules_install
make install
depmod 3.1.
mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod initramfs-3.1.. img 3.1.

6. Configure grub:

title Xen (3.1.-xen)
         root (hd0,)
         kernel /xen-4.1.. gz dom0_mem=512M
         module /vmlinuz-3.1. ro root=UUID=3f920108-b74b-46b9-81c2-aff834494381
rd_DM_UUID=ddf1_4c5349202020202010000055000000004711471100001450
rd_NO_LUKS rd_NO_LVM rd_NO_MD LANG=en_US. UTF-
SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
         module /initramfs-3.1.. img

This configuration is root=UUID after line 4 with your system

7. Install virt-manager

yum install libvirt virt-manager xorg-x11-xauth

8. Recompile libvirt

  In the first link at the beginning of the article, it is stated,redhat6 In the system, the default libvirt does not support xen, if you use the default one directly, the following problems will occur:

  Note that the '&' in virt-manager > this command represents the process running in the background

[root@el6 ~]# virt-manager &
[]
Unable to open connection to hypervisor URI 'xen:///':
no connection driver available for xen:///
Traceback (most recent call last):
   File "/usr/share/virt-manager/virtManager/connection.py", line , in _try_open
     None], flags)
   File "/usr/lib64/python2.6/site-packages/libvirt.py", line , in openAuth
     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: no connection driver available for xen:///

Start recompiling libvirt to fix the above problems.

The following operations are performed in non-XEN systems:

None of the systems encountered the same missing packages, and my system was still missing the xen-devel package, and it was in yum

[root@el6 ~]# cd /root/src
[root@el6 src]# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/
6Server/en/os/SRPMS/libvirt-0.8.1-27.el6.src.rpm
[root@el6 src]# rpm -i libvirt-0.8.-.el6.src.rpm
[root@el6 src]# wget
[root@el6 src]# cd /root/rpmbuild/SPECS
[root@el6 SPECS]# cp -a libvirt.spec libvirt.spec.orig
[root@el6 SPECS]# patch -p0 < ~/src/libvirt-spec-rhel6-enable-xen.patch
patching file libvirt.spec
[root@el6 SPECS]# rpmbuild -bb libvirt.spec
error: Failed build dependencies:
         libnl-devel >= 1.1 is needed by libvirt-0.8.-.el6.x86_64
         xhtml1-dtds is needed by libvirt-0.8.-.el6.x86_64
         libudev-devel >=  is needed by libvirt-0.8.-.el6.x86_64
         libpciaccess-devel >= 0.10. is needed by libvirt-0.8.-.el6.x86_64
         yajl-devel is needed by libvirt-0.8.-.el6.x86_64
         libpcap-devel is needed by libvirt-0.8.-.el6.x86_64
         avahi-devel is needed by libvirt-0.8.-.el6.x86_64
         parted-devel is needed by libvirt-0.8.-.el6.x86_64
         device-mapper-devel is needed by libvirt-0.8.-.el6.x86_64
         numactl-devel is needed by libvirt-0.8.-.el6.x86_64
         netcf-devel >= 0.1. is needed by libvirt-0.8.-.el6.x86_64
  [root@el6 SPECS]# yum install libnl-devel xhtml1-dtds libudev-devel
libpciaccess-devel yajl-devel libpcap-devel avahi-devel parted-devel
device-mapper-devel numactl-devel netcf-devel

Installation, No packages xen-devel available.

After replacing the yum source multiple times, the problem of the missing xen-devel package still cannot be solved.

The subsequent solutions are as follows:

Download the xen-devel rpm package online, install it and encounter dependency problems, then download the xen-libs rpm package, and then find other dependency problems.

Specific link: Search xen-devel to find the one that matches the system version


The version I downloaded is:
xen-devel-4.1.2_03-1.1.x86_64.rpm

Installing xen-devel also depends on other packages, such as:

xen-libs-4.1.2_03-1.1.x86_64.rpm

liblzma5-5.0.3-7.1.x86_64.rpm

glibc-common-2.14.90-14.x86_64.rpm

glibc-2.14.90-14.x86_64.rpm

Force the installation of packages as above.

If the dependency package is missing, download the corresponding version in turn to solve the problem. This process is very painful.

If all dependencies are installed, do the following:

[root@gb31 SPECS]# rpmbuild -bb libvirt.spec
After a while you'll see:
Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-0.8.-.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-client-0.8.-.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-devel-0.8.-.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-python-0.8.-.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/libvirt-debuginfo-0.8.-.el6.x86_64.rpm

If it is displayed as above, the installation is successful.

If you encounter a screen that says test. After getting stuck, uninstall it from the systemInstallationlibvirt package, and try again.
Then it is as follows: Note that the version may be different

If it still shows that there is a test failure, make failure, related to the libvirt version, this problem is very painful, try a few more versions. can be solved.

[root@el6 ~]# cd /root/rpmbuild/RPMS/x86_64/
[root@el6 x86_64]# rpm -Uvh --force libvirt-0.8.-.el6.x86_64.rpm libvirt-client-0.8.
-.el6.x86_64.rpm libvirt-python-0.8.-.el6.x86_64.rpm
Preparing...                ############# [%]
    :libvirt-client         ######### [ %]
    :libvirt                ######### [ %]
    :libvirt-python         ############ [%]

9. Enter the XEN system

Restart the system and enter the xen system.

Try entering the following commands: xm-list, xm-info

Then try the following command: virt-install to try to install the virtual machine

If the error displayed is as follows:

ERROR unable to connect to ‘localhost:′: Connection refused

The following changes need to be made:

Solution: Check whether the libvirtd service is started and shut downFirewall, in /etc/xen/xend-config.sxp
(xend-http-server yes)
# Port xend should use for the HTTP interface, if xend-http-server is set.
(xend-port )
Remove the comments in the two parentheses above, okay

Then restart the xend service

At this point, you can try to air the cylinder virtually on the desktopmachinemanager to create a virtual machine.
Creation process If the following questions occur:



You can find the corresponding path under usr/lib/xen/bin and put qemu-dm under lib64.

That's okay.

10. Configure the bridge bridging mode

Modify ifcfg-eth0 as follows:

DEVICE="eth0"
BOOTPROTO="static"
HWADDR="**********“
NM_CONTROLLED="no"

IPADDR="*******”
NETMASK="255.255.0.0"
GATEWAY="********"
TYPE=Ethernet
DNS1="8.8.8.8"
DNS2="8.8.4.4"
BRIDGE=br100

Create an ifcfg-br100 file with the following contents:

DEVICE="br100"
BOOTPROTO="static"
HWADDR="*********"
NM_CONTROLLED="no"

IPADDR="*******"
NETMASK="255.255.0.0"
GATEWAY="*******"
TYPE=Bridge
DEFROUTE=yes
DNS1="8.8.8.8"
DNS2="8.8.4.4"

11.Ok, so far, xen'sInstallationIt's over, and you can create virtual machines with confidence and boldness.






Previous:XenServer deployment series - Add shared storage
Next:30 points to improve SQL query speed
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com