How to Use Xen to build a virtual machine in Linux

Source: Internet
Author: User


How to Use Xen to build a virtual machine in Linux this article explains 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, semi-virtualization is supported, check whether vmx (intel) or svm (amd) is available. 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.
2. Install Xen as follows: www.2cto.com 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 the basic xen function program yum install xen * 2. install virtualization management package yum-y install virt-manager3, install xen run kernel yum install kernel-xen * 4, modify system boot kernel to support xen kernel edit/etc/grub. change the default value to 0 in conf, which indicates that the first kernel is started. For specific modifications, see the red font below: # 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) www.2cto.com # kernel/vmlinuz-version ro root =/dev/sda2 # initrd/initrd-version.img # boot =/dev/sdadefault = 0 timeout = 5 splashimage = (hd0, 0) /grub/splash.xpm.gz hiddenmenutitle Red Hat Enterprise Linux Server (2.6.18-308.8.2.el5xen) root (hd0, 0) kernel/xen.gz-2.6.18-308.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.imgtitle 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 kernel6 supporting xen virtualization. Check whether the system has successfully loaded the kernel supporting virtualization and run the uname-a command to verify whether the kernel supports xen ECHO as follows: 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 www.2cto.com the xen has been successfully installed based on the echo information. 7. tips: xen start stop command xend start | stop | restart 3. Use xen to build your own virtual machine 1. Use 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, a block device, a virtual disk, or a specified directory. 3. Set up nfs to prepare the installation system image. (This article uses ftp, http, or nfs is the easiest way to install nfs. I use nfs) 4. install the Virtual Machine virt-install-n hello-r 256 -- vcpus = 1 -- prompt -- disk path =/dev/sdb \-l nfs: 102.102.188.55: /m # installed a windows operating system named "hello memory 256" installation path/dev/sdb with nfs interactive installation 5. Run the VM maintenance command to start xm create hello to close xm shutdown hello 4. problem 1. Check xm after the host is installed and restarted, the ERROR is as follows: error Internal ERROR: cocould not obtain handl E on privileged command interface (2 = No such file or directory) is followed by a row. Solution: www.2cto.com # less/proc/cpuinfo if it is Intel's CPU, in the flag bar, there should be vmx or tm if it is AMD's CPU, in the flag bar, because svm or tm does not exist, 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_eImportError:/usr/lib/libvirt. so.0: undefined symbol: audit_encode_nv_string solution after installing the yum install audit-libs-python.i386 fengzhanhai

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.