Build xen virtualization environment

Source: Internet
Author: User
Tags intel i5 processor

Environment Introduction:

Hardware environment: Intel I5 processor platform (sandy brige)

Software environment: RedHat 6.2 Enterprise (64bit)

 

1. Set the motherboard BIOS and support virtualization technology

 

2. Configure the yum repo Environment

Configure the repo environment in the/etc/profile. d/directory as required.

 

3. Install public software packages

Yum install screen Vim wget tcpdump NTP ntpdate man smartmontools links Lynx ethtool xorg-x11-xauth cmake ruby-y

 

4. Install the Development Kit

Yum groupinstall "development tools" "additional development" "debugging tools" "System Administration Tools" "compatibility libraries" "console Internet tools" "desktop platform development"-y

 

5. install the software packages required for compiling xen

Yum install libaio-devel yajl-devel libuuid-devel dev86 IASL trousers-devel SDL-devel pciutils-devel mercurial-y

 

6. Install the latest yajl Software Package

Download the latest yajl package from the URL below

Http://lloyd.github.com/yajl/

This document uses version 1.0.12 as an example to compile and install the SDK.

Tar zxvf lloyd-yajl-1.0.12.tar.gz

CD lloyd-yajl-17b1790

./Configure

Make-J4

Make install

 

7. Download xen 4.2 source code and 3.4.0 Kernel

Download the xen source code from the following URL:

Http://xen.org/products/downloads.html

 

Kernel can be obtained from the following URL:

Http://kernel.org/

 

8. Compile the kernel

The kernel is not enabled by default. You need to manually set the driver for virtualization.

Config_x86_io_apic = y

Config_acpi = y

Config_acpi_procfs = Y (optional)

Config_xen_dom0 = y

Config_pci_xen = y

Config_xen_dev_evtchn = y

Config_xenfs = y

Config_xen_compat_xenfs = y

Config_xen_sys_hypervisor = y

Config_xen_gntdev = y

Config_xen_backend = y

Config_xen_netdev_backend = m

Config_xen_blkdev_backend = m

Config_xen_pcidev_backend = y

Config_xen_privileged_guest = y

Config_xen_balloon = y

Config_xen_scrub_pages = y

Config_xen_dev_evtchn = y

Config_xen_gntdev = y

Config_dmar_table = y

Config_intel_iommu = y

Config_intel_iommu_default_on = y

Config_intel_iommu_floppy_wa = y

Config_iommu_api = y

If it is 4.0, you can also refer to the configuration file in the attachment.

Http://download.csdn.net/detail/chen_chun_guang/4992614

Compile the kernel:

Make-J8

Make modules_install

Copy the compiled 3.4.0 + kernel and initramfs to the/boot folder.

Cp arch/x86_64/boot/bzimage/boot/vmlinux-3 .. 40

Mkinitrd-F/boot/initramfs-3.4.0 + 3.4.0 +

 

Compile xen 4.2

Make xen-J8

Make tools-J8

Make install-xen

Make install-Tools

Beixen.gz to the/boot directory

CP xen/xen.gz/boot/

 

9. Configure grub Information

Title xen

Root (hd0, 0)

Kernel/Boot/xen.gzDom0_mem = 1024 M iommu = 1 Msi = 1 hap_1gb = 1

Module/Boot/vmlinuz-3.4.0RO root =/dev/sda1

Module// Boot/initramfs-3.4.0 +

 

10. restart the system to enter the xen Option

After it is started, it enters the dom0 environment.

Start the xen service:

/Etc/init. d/xencommons start

 

11. Start xen guest

Xen has two types of guest: PV guest and hvm guest.

When xen guest is started, you need to configure the hvm configuration file

For the configuration file, refer to the following file:

/Etc/xen/xmexample. hvm

For PV guest, the configuration file is generally placed in the following directory.

/Etc/xen/xlexample. pvlinux

To create a guest, run the following command:

XL create xmexample. hvm

Or

XL create xlexample. pvlinux

12. Configure guest Disk

There are two methods to configure the guest Disk: one is to directly use the origin guest image, and the other is to use qcow to generate the qcow of the guest image. In the first method, the origin content will be changed for any modification. In the second method, the content of the qcow file will be changed for any modification, and the content of the origin image will not be modified.

Disk configuration in the first method

Disk = ['/Home/images/ia32e_ent.img, Raw, xvda, RW ']

The second method requires that the origin file be used first.Ia32e_ent.imgCreate the file rhel6u2. qcow in qcow2 format.

Qemu-IMG-xen create-B/Home/images/ia32e_ent.img-F qcow2/root/rhel6u2. qcow

The disk configuration is as follows:

Disk = ['Tap: qcow2:/root/rhel6u2. qcow, hda, W']

 

13. Connect to the started guest

There are two ways to display the Startup Process of guest, one is SDL, the other is VNC, and which method needs to be set in the configuration file.

The following describes how to connect using VNC.

Install the vnc rpm package

Yum install tigervnc. x86_64 tigervnc-server.x86_64-y

Disable firewall to use VNC

Enter the command setup

Set firewall disable

In addition, you need to disable SELinux, edit the configuration file, and set it to SELinux = disabled.

Vim/etc/SELinux/config

 

Run the xl list command to view

Use the following command to log on to guest using VNC:

Xl vnc vmid

As in the preceding example, if the guest ID is 1, you can use xl vnc 1 to log on to the guest VNC desktop.

 

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.