Xen install virtual machines on Ubuntu
Method One
DD an empty disk
sudo dd if=/dev/zero of=/home/vm1.img bs=1g count=8
Download the Xen VM Common profile
sudo wget http://mirrors.aliyun.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/xm-debian.cfg \
-o/etc/xen/vm1.conf
Modify the downloaded configuration file accordingly
Memory = 256
Name = "VM1"
disk = [' Tap2:tapdisk:aio:/home/vm1/vm1.img,xvda1,w ']
Execute the Install command
sudo xm create-f/etc/xen/vm1.conf-c install=true \
install-kernel= "Http://mirrors.aliyun.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/vmlinuz" \
Install-ramdisk= "http://mirrors.aliyun.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/ Xen/initrd.gz "\
Install-mirror= "Http://mirrors.aliyun.com/ubuntu"
Method Two
DD an empty disk
sudo dd if=/dev/zero of=/home/vm1.img bs=1g count=8
Format disk
sudo dd if=/dev/zero of=/home/vm1.img bs=1g count=8
Mount Disk
sudo mkdir/mnt/vm1
sudo mount-o loop/home/vm1.img/mnt/vm1
Create Domainu file system with Domain0 file system
#!/bin/bash
Cat >/tmp/exclude.list <<eof
/proc
/tmp/
/lost+found
/sys
/mnt
/media
/dev
/tmp
/home
/var/cache/apt
/var/cache/apt-xapian-index
/var/lib/apt
eof</p>< p> #注意vmdisk变量后面的/
vmdisk= '/mnt/'
Rsync-arv--progress--exclude-from=/tmp/exclude.list/$vmdisk
Mkdir-p ${vmdisk}/home ${vmdisk}/mnt ${vmdisk}/tmp ${vmdisk}/dev ${vmdisk}/proc ${vmdisk}/sys
Uninstalling a virtual machine disk
sudo umount/mnt/vm1
name = ' VM1 '
Vcpus = 1
Memory = ' 2048 '
disk = [' Tap2:tapdisk:aio:/home/vm1/vm1.img,xvda,w ']
Vif = ["]
On_reboot = ' Restart '
On_crash = ' Restart '
Kernel = "/home/vm1/vmlinuz"
RAMDisk = "/home/vm1/initrd.img"
Extra = "Ks=http://www.opstool.com/files/man/vm-ks.cfg"
Start a virtual machine
sudo xm create-c/etc/xen/vm1.conf
determine if the CPU supports virtualization
The Intel CPU flag is the VMX,AMD CPU is the SVM. If the CPU itself is supported but cat/proc/cpuinfo is not visible, check to see if the BIOS shuts down Intel's VT or AMD's SVM
Cat/proc/cpuinfo | grep--color-e (VMX|SVM)
View the Xen version
Cat/sys/hypervisor/version/major
Cat/sys/hypervisor/version/minor
Cat/sys/hypervisor/version/extra
Basic installation method of Xen virtual machine under Ubuntu System (code creation)