Tutorial on using Xen to build a virtual machine in Centos

Source: Internet
Author: User
Tags svm
This article explains the following content: 1. installation steps of xen; 2. how to use xen to build your own virtual machine; 3. problems encountered during installation. 1. check before installation 1) Check whether your host cpu supports virtualization: enter the command cat/proc/cpuinfo | grepflags to check whether there is a pae in the result. If yes, semi-virtualization is supported, check whether vmx (intel) or s has explained the following content: 1. how to install xen; 2. how to use xen to build your own virtual machine; 3. problems encountered during installation.
1. check before installation
1) Check whether your host cpu supports virtualization: enter the command cat/proc/cpuinfo | grep flags to check whether there is a pae in the result. If yes, it supports semi-virtualization and check whether there is a vmx (intel) or svm (amd). If yes, full virtualization is supported. This should be done before xen is installed. after installation, vms/svm is invisible by default.
2) confirm that the Virtualization switch is enabled in the BIOS.
To quickly install the Xen virtualization software, I use yum to quickly install and deploy the software.
II. Xen The installation steps are as follows:
First, use rpm-qa | grep xen to check whether the system has installed xen related packages. if not, continue with the following operations:
1. install basic xen functions
Yum install xen *
2. install the virtualization management package
Yum-y install virt-manager
3. install xen to run the kernel
Yum install kernel-xen *
4. modify the system startup kernel to support xen kernel.
Edit/etc/grub. conf
Change default to 0, indicating that the first kernel is started.
For specific changes, see the red font as follows:
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/sda2
# Initrd-version.img/initrd
# Boot =/dev/sda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux Server (2.6.18-308.8.2.el5xen)
Root (hd0, 0)
Kernel/xen.gz-2.6.18-308.8.2.el5
Module/vmlinuz-2.6.18-308.8.2.el5xen ro root = LABEL =/rhgb quiet
Module/initrd-2.6.18-308.8.2.el5xen.img
Title Red Hat Enterprise Linux Server (2.6.18-8. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-8.el5 ro root = LABEL =/rhgb quiet
Initrd/initrd-2.6.18-8.el5.img
5. save and exit the system and reboot the host to load the kernel supporting xen virtualization.
6. check whether the system has successfully loaded the kernel supporting virtualization.
Run the uname-a command to verify whether the kernel supports xen.
Echo the following information:
Linux sdlp.com 2.6.18-308.8.2.el5xen #1 SMP Tue Jun 12 11:16:34 EDT 2012 i686 i686 i386 GNU/Linux
Verify that the xen has been installed successfully based on the Echo information.
7. tips: xend start | stop | restart
3. use xen Build your own virtual machine
1. use the xm list command to confirm the xen working status echo information as follows:
Name ID Mem (MiB) VCPUs State Time (s)
Domain-0 0 879 1 r ----- 447.8
Indicates that the virtual domain is normal.
2. confirm the installation path and installation space. the installation space can be a file, block device, virtual disk, or specified directory.
3. set up nfs to prepare the installation system image. (This article uses ftp, http, or nfs for installation because of the semi-virtualization used. as nfs is the easiest to set up, I use nfs.)
4. use xen to install virtual machines
Virt-install-n hello-r 256 -- vcpus = 1 -- prompt -- disk path =/dev/sdb \-l nfs: 102.102.188.55:/m
# The above installation is a windows OS named "hello Memory 256 installation path/dev/sdb interactive installation with nfs"
# How to Install using an image file
# Dd if =/dev/zero of =/cc/windows. img bs = 1 M count = 10000 create a virtual image
# Virt-install-n hello-r 256 -- vcpus = 1 -- prompt-f/cc/windows. img http: // 10.0.209.172/solr/# WindowsServer2003SP2ISO. iso
 
5. VM Maintenance Commands
Start xm create hello
Disable xm shutdown hello
IV. problems encountered
1. check xm after installing and restarting the host. the error is as follows:
ERROR Internal error: cocould not obtain handle on privileged command interface (2 = No such file or directory) is followed by a row.
Solution:
# Less/proc/cpuinfo
For Intel CPUs, there should be vmx or tm in the flag bar.
For amd cpu, in the flag column, the svm or tm
If not, your host does not support virtualization.
Otherwise, you may forget to change the default value in the grub. conf file to the value with the xen core startup. Note that it starts with 0.
2. the following error is reported:
File "/usr/sbin/virt-install", line 31, in? Import libvirt
File "/usr/lib/python2.4/site-packages/libvirt. py", line 25, in? Raise lib_e
ImportError:/usr/lib/libvirt. so.0: undefined symbol: audit_encode_nv_string
Solution Installation
Solved problems after yum install audit-libs-python.i386
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.