Creating Virtual Machines For Xen, KVM, VMware Workstation 6, and VMware Server With vmbuilder On Ubuntu 8.10
Creating Virtual Machines For Xen, KVM, VMware Workstation 6, and VMware Server With vmbuilder On Ubuntu 8.10Version 1.0 vmbuilder is a tool (introduced on Ubuntu 8.10) that allows you to build virtual machines (with Ubuntu as the OS) for multiple virtualization techniques. Currently it supports Xen, KVM, VMware Workstation 6, and VMware Server. You can afterwards copy the virtual machines to another system (a Xen, KVM, VMware Workstation 6, or VMware Server host) and run them there. I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm using a machine with the hostname server1.example.com and the IP address 192.168.0.100 here as my host system. Because we will run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string sudo, or we become root right now by typing sudo su
2 Installing vmbuildervmbuilder can be installed as follows: apt-get install python-vm-builder
3 Installing apt-proxyWhenever vmbuilder builds a new VM, it has to download all packages from an Ubuntu mirror which can take quite some time. To speed this up, we install apt-proxy... apt-get install apt-proxy ... to cache the downloaded packages so that subsequent VM installations will be a lot faster. Now open /etc/apt-proxy/apt-proxy-v2.conf... vi /etc/apt-proxy/apt-proxy-v2.conf ... and replace the default Ubuntu mirror with a mirror close to you (e.g. http://de.archive.ubuntu.com/ubuntu if you are in Germany):
Then we restart apt-proxy: /etc/init.d/apt-proxy restart apt-proxy listens on port 9999, so we can pass our local apt-proxy "mirror" as an argument to the vmbuilder script.
4 Using vmbuilderTake a look at the following commands to learn how to use vmbuilder: vmbuilder xen ubuntu --help vmbuilder kvm ubuntu --help vmbuilder vmw6 ubuntu --help vmbuilder vmserver ubuntu --help I will now create four virtual machines with the name vm7, one for Xen, one for KVM, one for VMware Workstation 6, and one for VMware Server. I'm assuming that you are using bridging for your virtual machines. vmbuilder uses a template to create virtual machines - this template is located in the /etc/vmbuilder/libvirt/ directory. Because we must modify the template, we create a copy and modify that one: mkdir -p ~/vm7/mytemplates/libvirt Now we open ~/vm7/mytemplates/libvirt/libvirtxml.tmpl... vi ~/vm7/mytemplates/libvirt/libvirtxml.tmpl ... and change the network section from
to
because we want the VMs to use bridging (if you use NAT instead of bridging, then don't modify the template!). Now we come to the partitioning of our VM. We create a file called vmbuilder.partition... vi ~/vm7/vmbuilder.partition ... and define the desired partitions as follows:
This defines a root partition (/) with a size of 8000MB, a swap partition of 4000MB, and a /var partition of 20000MB. Of course, you are free to define whatever partitions you like (as long as you also define root and swap). I want to install openssh-server in the VM. To make sure that each VM gets a unique OpenSSH key, we cannot install openssh-server when we create the VM. Therefore we create a script called boot.sh that will be executed when the VM is booted for the first time. It will install openssh-server (with a unique key) and also force the user (I will use the default username administrator for my VMs together with the default password howtoforge) to change the password when he logs in for the first time: vi ~/vm7/boot.sh
Make sure you replace the username administrator with your default login name. (You can find more about this here: https://help.ubuntu.com/community/JeOSVMBuilder#First%20boot) (You can also define a "first login" script as described here: https://help.ubuntu.com/community/JeOSVMBuilder#First%20login)
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com





print: 
Recent comments
18 hours 48 min ago
20 hours 16 min ago
23 hours 51 min ago
1 day 2 hours ago
1 day 5 hours ago
1 day 6 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 9 hours ago