Saturday, April 4, 2015

Xen step1

##########################################
##########################################
sudo vim /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo em1 xenbr0
iface lo inet loopback

# The primary network interface
#auto em1
#iface em1 inet dhcp

iface xenbr0 inet dhcp
bridge_ports em1
iface em1 inet manual

##########################################
#
#cat > /etc/xen/n0-hvm.cfg
##########################################
builder = "hvm"
name = "n0-hvm"
memory = "10240"
vcpus = 1
vif = ['']
disk = ['phy:/dev/vg0/lv0,hda,w','file:/home/hadoop/ubuntu-14.04.2-server-amd64.iso,hdc:cdrom,r']
vnc = 1
boot="dc"

xl create /etc/xen/n0-hvm.cfg

##########################################
#Connect to the installation process using VNC
##########################################
sudo apt-get install gvncviewer
gvncviewer localhost:0

##########################################
#list Virtual Machines
##########################################
xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 53285    12     r-----      81.2
n0-hvm                                       2 10240     1     r-----       8.4


##########################################
##########################################
sudo apt-get install virtinst virt-viewer

#"-r 10240": 10240MB memory
#"-n n0": name of this virtual machine
#"-f /dev/vg0/lv0": LV disk path
#"-c /home/hadoop/ubuntu-14.04.2-server-amd64.iso": path to the ISO
#"--vcpus 1": use 1 CPU
#"--network bridge=xenbr0": use xenbr0 as network

virt-install -n n0 \
--vcpus 1 \
-r 1024 \
--network bridge=xenbr0 \
-f /dev/vg0/lv0 \
-c /home/hadoop/ubuntu-14.04.2-server-amd64.iso

No comments:

Post a Comment