Building your own Desktop Cloud Environment


Published on

As developers we have seen these problems:

Our development environments accumulate lots of applications and libraries over a period of months.

We are usually in the habit of installing everything in one machine.

We fear that we may screw up our development environment and that means unproductive man-hours.

We forget that a multi-machine deployment is different from a single machine deployment.

How about virtualization in the desktop?

In this demo, I will take you through the steps to create a multi-VM development environment.

This demo will make use of QEMU, KVM and Virt Manager and show you how you can create a VM image, and then start servers with a set of commands, deploy your app, test everything and tear down the environment once you are happy - all this in the cosy comforts of your laptop or desktop.

The Jnaapti development environment is based on this setup.

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Building your own Desktop Cloud Environment

  1. 1. Building your ownDesktop Cloud EnvironmentGautham Pai, Founderjnaapti
  2. 2. The problems we face as developersOur development environments accumulate lots ofapplications and libraries over a period of months.We fear that we may screw up our developmentenvironment and that means unproductive man-hours.We are usually in the habit of installing everything inone machine.We forget that a multi-machine deployment is differentfrom a single machine deployment.
  3. 3. Solution?How about Desktop Virtualization?
  4. 4. Why Desktop Virtualization?Bringing our development environment as close to theproduction environment as possible.Replicable deployment - verify everything beforedeploying to staging or production.Containerising functionality."Dont panic" environment for experimentationEase of provisioning for new employees.
  5. 5. Virtualization or Cloud?What I am talking about is closer to virtualization thancloud computing.For example, we are not dealing with transparentscaling, spike load handling etc.
  6. 6. Why QEMU-KVM and not Virtualbox?KVM is part of the Linux KernelVirtualbox is from OracleKVM provides better performance
  7. 7. What we want to try outCreate a development environment with functionalitiespartitioned over separate VMs.Ensure that setting up this environment is not morethan a few hours job.Ensure that bringing up the environment does not takemore than a few minutes if not seconds.Ensure that the environment can run in a laptop withstandard configuration.
  8. 8. System Requirements A laptop/desktop with a processor that supports virtulization technology to use KVM a Debian Linux environment atleast 2GB of free RAM atleast 10G of free disk spaceThis will help us run as many as 5 VM images in parallel
  9. 9. Demo
  10. 10. The ApproachIn this demo, I will take you through the steps tocreate a multi-VM development environmentIn addition to our dev environment (dev-server), wewill have a separate code-server, a web-server and adb-server setup.We then run it end-to-end – write some code, check itin, pull it into the web server, deploy the code andthen test the new version of the app.
  11. 11. First, a look at a few terminologiesQEMU is a generic and open source machine emulatorand virtualizer.KVM (for Kernel-based Virtual Machine) is a fullvirtualization solution for Linux on x86 hardware.The Virtual Machine Manager application (virt-manager for short package name) is a desktop userinterface for managing virtual machines.
  12. 12. Demo
  13. 13. The ApproachWe first create a base VM and install the OS in it, usingthe standard Ubuntu 10.04.2 Server ISO imageWe then install a SSH server and setup passwordlessSSH accessWe then clone this system to as many systems as weneed and setup various servers(code/caching/web/etc) on them
  14. 14. Installing Pre-requisites$ sudo apt-get install virt-manager qemu-kvm
  15. 15. Starting Virt Manager$ sudo virt-manager
  16. 16. Networking RequirementsEvery VM should have its own IP address.Every VM should be accessible from every other VMand that includes host.Every VM must be able to connect to the Internet.Solution? Bridged Networking.
  17. 17. Setting up the Bridge Network
  18. 18. Name your Virtual Network
  19. 19. Choose an IPv4 Address Space
  20. 20. Select DHCP Range
  21. 21. Setup NAT forwarding
  22. 22. Review and finish the wizard
  23. 23. Create the Base VM
  24. 24. Choose the Distribution to Install
  25. 25. Set RAM and CPUs
  26. 26. Set the Disk Space
  27. 27. Finalize the VM Creation
  28. 28. Install the OS in the Base VM
  29. 29. Select Hostname
  30. 30. Select Disk
  31. 31. Confirm Disk Format
  32. 32. Installation Progress
  33. 33. Installation Progress
  34. 34. Create User
  35. 35. Set Username
  36. 36. Configure APT
  37. 37. Set Automatic Upgrades
  38. 38. Install Additional Software
  39. 39. Install Pre-defined Collections
  40. 40. Installation Progress
  41. 41. Install GRUB
  42. 42. Install GRUB
  43. 43. Installation Complete
  44. 44. Installation Complete
  45. 45. Verifying the Base VM InstallationLogin to the Base VMInstall the latest updatesMake sure you can connect to the host from guest andvice-versaSetup password-less SSH access(Update interface identifier)
  46. 46. Cloning the Base VMAdd the DNS server that we use for guest IP allocationto resolv.conf, so that you can address VMs using theirhostnamesUse virt-clone to clone the base VMStart the new VMChange the hostname of the new VMReboot the new VM
  47. 47. Starting and Stopping the VMs$ #Start the domains$ virsh start webserver && virsh start dbserver &&virsh start codeserver$ #Destroy the domains$ virsh destroy webserver && virsh destroydbserver && virsh destroy codeserver
  48. 48. Where to go from here?Setting up package mirrorsSnapshot creation on the flyYou can mimic things like S3, EBS etc
  49. 49. ResourcesMore detailed notes hereCode is over at GithubKVMVirtual Machine ManagerKVM NetworkingQEMU NetworkingQEMU Images
  50. 50. Courtesy Server image from OpenClipArt CD image from pr0gr4mm3r.comThanks to Pradeep Kumar, Ananth M, Kiran S, Ananda M,Madhukar Pai and Shrinivas S Kulkarni for reviewing the slides and providing valuable feedback
  51. 51. The Jnaapti development environment is based on this setup
  52. 52. This talk was first delivered in the “PHP Cloud” event organized by HasGeek
  53. 53. Thank you!Email:
  54. 54. Happy Hacking