Wednesday, March 4, 2009

Virtualization Experiments

how to check if packages are installed or not :
dpkg -l grep

how to check if a library is installed or not

lsmod grep libvirt



Setting up proxy for apt-get



Acquire ::http::Proxy http:/http:///:@:'>/usename:passwd:proxy:port;







Creating Virtual Machines For Xen, KVM, VMware Workstation 6, and VMware Server With vmbuilder On Ubuntu 8.10

http://www.howtoforge.com/creating-virtual-machines-for-xen-kvm-vmware-workstation-6-vmware-server-with-vmbuilder-on-ubuntu-8.10



To create the new Virtual Image on the remote server:
------------------------------------------
1. Login to the remote server first. ( not on the controller )
vi /etc/network/interfaces
create another para for the 2nd bridge
/etc/init.d/networking restart
Initial Creation of the virtual server on the remote node.
---------------------------------------------------------
Login to the remote server first.
shashi@ubuntu-lab:~/vm1$ sudo mkdir -p ~/vm1/mytemplates/libvirt
shashi@ubuntu-lab:~/vm1$ sudo cp /etc/vmbuilder/libvirt/* /home/shashi/vm1/mytemplates/libvirt
shashi@ubuntu-lab:~/vm1$ sudo vi libvirtxml.tmpl
Here I changed just 3 things.



:shashi@ubuntu-lab:~/vm1$ sudo mv ../vmbuilder.partition
root 8000
swap 4000
---
/var 20000
shashi@ubuntu-lab:~/vm1$ sudo vi boot.sh
passwd -e shashi
apt-get update
apt-get install --qqy --force-yes openssh-server
shashi@ubuntu-lab:~/vm1$ sudo apt-get install apt-proxy // Ignore this if you have already done this...

shashi@ubuntu-lab:~/vm1$ vi /etc/apt-proxy/apt-proxy-v2.conf
Nothing was chnaged here.
shashi@ubuntu-lab:~/vm1$ sudo /etc/init.d/apt-proxy restart
sudo vmbuilder kvm ubuntu --help========> Important - here I am building a "KVM" - I can use the "xen also"
sudo vmbuilder kvm ubuntu --suite=intrepid --flavour=virtual --arch=i386 -o --libvirt=qemu:///system --tmpfs=-
--part=vmbuilder.partition --templates=mytemplates --user=shashi --pass=howtoforge --name=Administrator --addpkg=vim-nox
--addpkg=unattended-upgrades --addpkg=acpid --firstboot=boot.sh --mem=256 --hostname=vm1
3:56 PM 3/4/09 - upto -
Took about 10 minutes. - failed.
3/5/09 - 9:26AM - trying it with the new vm2 directory?
shashi@ubuntu-lab:~/vm1$ cd ~/vm1
shashi@ubuntu-lab:~/vm1$ cd ubuntu-kvm/
shashi@ubuntu-lab:~/vm1/ubuntu-kvm$ ls
disk0.qcow2 disk1.qcow2
There were 2 files that were created.



XXXXXXXXXXXXXXXXXXXXXX
shashi@ubuntu-lab:~/vm1/ubuntu-kvm$ sudo virsh --connect qemu:///system
Connecting to uri: qemu:///systemWelcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # list --all
Id Name State----------------------------------
- vm1 shut off

XXXXXXXXXX <--- You have to do sudo for the above command. virsh # start vm1 Domain vm1 started virsh # list Id Name State ---------------------------------- 1 vm1 running You can either destroy, suspend, resume the vm1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX to login to the remote server - this is what I had to do :::::::::::::::::: first I installed the virt-manager and virt-viewer on the base server, "http://www.howtoforge.com/kvm-guest-management-with-virt-manager-on-ubuntu-8.10"

sudo gedit /usr/bin/virt-manager

insert the word sudo

from the source server : System Tools -> Virtual Manager
OR
sudo virt-manager select QEMU and Remote tunnel over SSH type in the name and password
sudo passwd root <-- on the remote host...