Because from the RHEL6 version, RedHat does not support Xen natively, and instead goes to the embrace of KVM. Although KVM claims to support the full virtualization of HVM technology, KVM started late after all and is far less mature than Xen technology. System crashes often occur when running multiple instances. Of course, it does not exclude the possibility that KVM will be more efficient in the future. So there are only two ways to install Xen. One is to download the source code and compile it yourself, but this method is too energy-consuming, so ignore it, and the other is to install it using a third-party software source. There are a large number of third-party sources and open source organizations on the Internet to provide compiled source code. The Xen made Easy open source project provides us with the installation of Xen4 on RHEL6/CentOS6. This article uses the third-party installation source provided by the Xen Made Easy project website, which is convenient and quick. .
1. surroundings
Hardware: HP DL360 G6 (E5520, 16G, 2*146GB)
System version: CentOS-6.6-x86_64-minimal.iso
2. system initialization
wget http://blog.linuxeye.com/lnmp-full.tar.gz
tar xzf lnmp-full.tar.gz
cd lnmp./install.sh #All select nochkconfig iptables off#Close iptables
3. Install bridge-utils
yum -y install bridge-utils
4. Install crc.id.au installation source
yum -y install http://au1.mirror.crc.id.au/repo/el6/x86_64/kernel-xen-release-6-7.noarch.rpm
5. Install xen virtualization
yum -y install xen
ls -l /boot/xen.gz
lrwxrwxrwx 1 root root 12 Dec 118:42/boot/xen.gz -> xen-4.2.5.gz
6. Install xen kernel
yum -y install kernel-xen
Note: The installation of kernel-xen depends on kernel-xen-firmware. Because these two packages are relatively large, it is recommended to download to the local and use yum -y localinstall kernel-xen* to complete the installation
cat /boot/grub/grub.conf #As shown in the figure below, next time it will be booted with xen kernel
chkconfig xend on #After restarting the system, it is found that the xend server is not configured to start automatically
7. Configure the network card in bridge mode
Create a new file /etc/sysconfig/network-scripts/ifcfg-xenbr0 and keep the content as follows:
DEVICE=xenbr0
TYPE=BridgeONBOOT=yes
DELAY=0NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.3.20NETMASK=255.255.255.0GATEWAY=192.168.3.1
Modify /etc/sysconfig/network-scripts/ifcfg-eth0 and keep the content as follows:
DEVICE=eth0
HWADDR=F4:CE:46:85:64:34TYPE=EthernetUUID=c27373b9-a698-4ac8-9afe-a4dee87f5704
ONBOOT=yes
BRIDGE=xenbr0
NM_CONTROLLED=no
service network restart #Restart network
8. Restart the server
Restart the system and enter the Xen kernel Linux, test as shown below:
9. Install virtualization management tool set
yum -y install libvirt
libvirt provides a hypervisor agnostic API to safely manage the guest operating system running on the host. Libvirt itself is not a tool, it is an API that can build tools to manage guest operating systems. Libvirt itself is built on an abstract concept. It provides common APIs for common functions implemented by supported hypervisors. Libvirt was originally a management API designed specifically for Xen, and was later extended to support multiple hypervisors.
service libvirtd start
yum -y install python-virtinst
Contains a Python module that uses libvirt to start and install the operating system version inside the virtual machine (such as commands: virt-install, virt-clone)
10. Configure operating system installation source
Mount CentOS-6.6-x86_64-minimal.iso at 192.168.3.10:81, and copy the files inside to centos6.6 under the root directory of the apache website, so that http://192.168.3.10:81 can be passed on 192.168.3.20 /centos6.6 access to the installation image
Note: The image file .treeinfo lacks a line, which results in the kernel not being found when installing the system. Keep the middle section as follows:
[ images-xen]kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
11. Install CentOS with character interface
mkdir -p /data/xen
virt-install -n vm21 -r 2048--vcpus=2--nographic --disk path=/data/xen/vm21.img,size=20 \-l http://192.168.3.10:81/centos6.6/--bridge=xenbr0,model=virtio
virt-install command parameters:
- n --name=Client virtual machine name-r --ram=Memory allocated by the client virtual machine-u --uuid=Client UUID--vcpus=2 The number of vcpus on the client-v --hvm full virtualization-p --paravirt-l --location=localdir installation source--vnc use vnc-c --cdrom=CD-ROM installation method-s --file-size=The size unit of the disk image used is GB-f --file=Files used as disk images--disk=Use different options to use installation media as disks
12. Clone image
virt-clone -o vm21 -n vm22 -f /data/xen/vm22.img
Recommended Posts