CentOS 5.X Xen Virtual machine installation configuration and basic use _xen

Source: Internet
Author: User
Tags svm centos

CentOS 5.X Installation configuration Xen virtual machine and basic usage

1. Prerequisite Requirement

1.1. Introduction
Xen is free software released under the GNU GPL and is designed to provide a system environment that is highly efficient, capable of supporting the simultaneous operation of different operating systems and independent of each operating system, and Xen is a virtual machine controller developed based on the X86 architecture Machine Hypervisor). Xen virtualization consists of two virtualization approaches, semi-virtualization (para-virtualization) and full virtualization (fully-virtualization). Both of these virtualization require CPU support. Semi-virtualization Architecture diagram:

Determine if the CPU supports Xen running:

Semi-virtualization:

x86_64 CPUs can support a semi virtualized environment. The x86 CPU needs to support the physical Address Extension PAE in order to support it. View Way:


Full virtualization: Full virtualization requires CPU support, Intel provides VT technology, AMD provides SVM technology.


VMX tags are required on Intel CPUs

The AMD CPU needs to have a SVM tag

2, two ways to install Xen

2.1. Install when installing new operating system

If it is a newly installed operating system, you can choose virtualization in the process of installation, the other steps, the system is installed, restart can be.

2.2. Install with RPM Package Manager

RPM? IVH xen* xen-devel* virt-manager* kernel-xen*

Note: The installation process requires a manual solution to package dependencies, so the actual installation process will vary slightly depending on the environment. It is recommended to set up internal Yum source, use Yum installation, one-step.

3. Start using Xen

3.1. Start Xen

Reboot the machine, at the beginning of grub to select a startup with Xen tags, after landing using the command to view Xen Health, currently because the client does not install, so you can only see a "Domain-0", which is to control the platform of other virtual machines. In fact it is also a virtual machine that starts together when the xend is started.


3.2. Create a virtual machine

1. Create a LV as a block device for a virtual machine
[Root@xenserver ~]# lvcreate-l 5g-n/dev/volgroup/logvol_domain-3 volgroup
Note: You can use a separate hard disk partition, system files, etc. as a block device for the virtual machine, here use the LV as an example.

2. Ready to install the source, support the way has HTTP,NFS, etc., this place uses NFS

Copy all the content from the installation CD of the Linux operating system you want to install to a directory and share it with NFS. The directory used in this example is/usr/local/src/centos5.4, as shown in the following illustration:

3. Install virtual machines using the Virt-install tool

Virt-install N Domain-3 R 256 f/dev/volgroup/logvol_domain-3 l nfs:10.100.2.202:/usr/local/src/centos5.4
Description

-n Specifies the virtual machine name
-r Specifies memory size
-f Specifies a block device
-L Specify installation media

After the appearance of the interface, just follow the normal installation steps to complete.

4. Start the virtual machine. After the installation completes, the virtual opportunity shuts down automatically, need to restart the virtual machine manually, note that in the previous installation process, a configuration file "Domain-3" has been automatically generated under/etc/xen.

Use the command XM create/etc/xen/domain-3 to start the virtual machine and use the XM List view.

3.3. Analyze virtual machine configuration file

Name = "Domain-3"
UUID = "A24d5012-bc4d-8692-7d46-a7a661874b74"
MAXMEM = 256 #虚拟机可以使用的最大内存, maximum cannot exceed this size when dynamically allocated with command
Memory = 256 #启动虚拟机时的初始化分配的内存
Vcpus = 1 #虚拟cpu的个数, maximum 32
bootloader = "/usr/bin/pygrub" #虚拟器引导文件
On_poweroff = "Destroy"
On_reboot = "Restart"
On_crash = "Restart"
disk = ["Phy:/dev/volgroup/logvol_domain-3,xvda,w"] #虚拟机使用的块文件
Vif = ["Mac=00:16:36:75:07:00,bridge=xenbr0,script=vif-bridge"] #虚拟网卡参数

3.4. Partial optimization (optional, for reference)

1. Modify/boot/grub/menu.lst and add dom0_mem=512m after kernel Dom0_max_vcpus=1

The amount of memory that dom0_mem reserved for Domain-0 to use
Dom0_max_vcpus limit Domain-0 Maximum number of visible CPUs

2. Assign a CPU to a specific virtual machine

XM Vcpu-pin <Domain> <VCPU> <CPUs>

3. Adjust the priority of the virtual machine

XM sched-credit-d <Domain> [-w[=weight]|-c[=cap]]

3.5. Common Orders

XM Create/path/to/config_file
XM shutdown domainname
XM reboot domainname
XM pause DomainName
XM Resume DomainName
XM console domainname

More commands please use Xm-help to view

Thank you for reading, I hope to help you, thank you for your support for this site!

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.