Basic installation method of Xen virtual machine under Ubuntu System (code creation)

Source: Internet
Author: User
Tags svm aliyun

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)

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.