Custom Search
Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts

Sunday, March 10, 2013

How To Create a PV Guest VM on Ubuntu Virtual Machine with Xen hypervisor

How To Create a PV Guest VM on Ubuntu Virtual Machine with Xen hypervisor

Manually creating a PV Guest VM
=======================


In this section we will focus on Paravirtualized (or PV) guests.
PV guests are guests that are made Xen-aware and therefore can be optimized for Xen.

As a simple example we'll create a PV guest in LVM logical volume (LV) by doing a network installation of Ubuntu (other distros such as Debian, Fedora, and CentOS can be installed in a similar way).



1)
Install LVM

#sudo apt-get update
#sudo apt-get install lvm2


2)
Create Volume Group and Logical Volume.

#sudo mkdir /mnt/vmdisk
#sudo dd if=/dev/zero of=/mnt/vmdisk/mydisk1 bs=100M count=10
#sudo losetup /dev/loop1 /mnt/vmdisk/mydisk1
#sudo pvcreate /dev/loop1
#sudo vgcreate -s 512M myvolume-group1 /dev/loop1
#sudo lvcreate -L 512M -n mylogical_volume1 myvolume-group1
#ls /dev


3)
Get netboot images

#sudo mkdir -p /var/lib/xen/images/ubuntu-netboot
#cd /var/lib/xen/images/ubuntu-netboot
#sudo wget http://mirror.anl.gov/pub/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/initrd.gz
#sudo wget http://mirror.anl.gov/pub/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/vmlinuz


4)
Set up the initial guest configuration

#vim /etc/xen/ubuntu.cfg
name = "ubuntu"
memory = 256
disk = ['phy:/dev/myvolume-group1/mylogical_volume1,xvda,w']
vif = [' ']
kernel = "/var/lib/xen/images/ubuntu-netboot/vmlinuz"
ramdisk = "/var/lib/xen/images/ubuntu-netboot/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"


5)
Start the VM and connect to console (-c).

#sudo xm create -c /etc/xen/ubuntu.cfg

6)
List VMs

#sudo xm list

How to Configure Network on Ubuntu Virtual Machine with Xen hypervisor

How to Configure Network on Ubuntu Virtual Machine with Xen hypervisor

Network Configuration
================


This section describes how to set up linux bridging in Xen.
It assumes eth1 is both your primary interface to dom0 and the interface you want your VMs to use.
It also assumes you're using DHCP.

1)
Install Bridge utils

#sudo apt-get install bridge-utils

2)
Stop Network Manager

#sudo /etc/init.d/network-manager stop


3)
Edit Interface

#vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto xenbr0
iface xenbr0 inet dhcp
bridge_ports eth1

auto eth1
iface eth1 inet dhcp


4)
Restart networking to enable xenbr0 bridge.

#sudo /etc/init.d/networking restart

Friday, February 22, 2013

KVM How to Install Configure and Create Virtual Machine on Ubuntu

1)
Check whether CPU has hardware virtualization support.


KVM only works if your CPU has hardware virtualization support –
either Intel VT-x or AMD-V. To determine whether your CPU includes these features,
run the following command:

#sudo grep -c "svm\|vmx" /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization,
while a 1 or more indicates that it does.


2)
Install KVM and supporting packages.


Virt-Manager is a graphical application for managing your virtual machines —
you can use the kvm command directly, but libvirt and Virt-Manager simplify the process.

#sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager


3)
Create User.


Only the root user and users in the libvirtd group have permission to use KVM virtual machines.
Run the following command to add your user account to the libvirtd group:

#sudo adduser saju 
#sudo adduser saju libvirtd

After running this command, log out and log back in as saju

4)
Check whether everything is working correctly.


Run following command after logging back in as saju and you should see an empty list of virtual machines.
This indicates that everything is working correctly.

#virsh -c qemu:///system list

5)
Open Virtual Machine Manager application and Create Virtual Machine


#virt-manager

http://virt-tools.org/
http://virt-manager.org/