%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %deffont "standard" xfont "helvetica-medium-r" %deffont "thick" xfont "helvetica-bold-r" %deffont "typewriter" xfont "courier-medium-r" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Default settings per each line numbers. %% %default 1 area 90 90, leftfill, size 2, fore "gray20", back "white", font "standard", hgap 0 %default 2 size 7, vgap 10, prefix " ", ccolor "black" %default 3 size 2, bar "gray70", vgap 10 %default 4 size 5, fore "gray20", vgap 30, prefix " ", font "standard" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Default settings that are applied to TAB-indented lines. %% %tab 1 size 4.5, fore "black", vgap 40, prefix " ", icon box "darkblue" 50 %tab 2 size 3.5, fore "darkblue", vgap 40, prefix " ", icon arc "blue" 50 %tab 3 size 3, fore "maroon", vgap 40, prefix " ", icon delta3 "maroon" 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" %center, fore "darkblue", font "standard", hgap 60, size 12 VirtualBox %size 8, fore "black", hgap 20 Turning one computer into many %size 6, fore "darkblue" Jonathan Marsden %size 5 jmarsden@fastmail.fm 09 January 2010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 0. Contents %size 4, fore "darkblue" 1. What is Virtualization? 2. Uses for Virtualization 3. Virtualbox Overview 4. Virtualbox Hardware Requirements 5. Installing Virtualbox on Ubuntu 6. Creating a virtual machine 7. Running the virtual machine 8. Networking 9. Virtual Disks 10. Snapshots 11. Guest Additions 12. Guest Additions - Shared Folders 13. Limitations of Virtualbox OSE 14. Further Ideas and Resources 15. Summary and Questions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 1. What is Virtualization? Very generally, virtualization is turning a real physical thing into a software-only digital version of that thing Virtualization: "the abstraction of computing resources" Virtual Machine (VM): a software implementation of a machine (computer) that executes programs like a real machine In the PC and Ubuntu Linux context, generally we are creating one or more "virtual" computers that run on one real computer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 2. Uses for Virtualization Separate applications (or users) onto different VMs For security or to meet application needs Consolidate physical servers onto one powerful one Save power and cooling and rack space costs Software testing and development Run many different OSes at once Try out things that might "break" your PC Even try out Linux on a Windows PC! Rapid deployment Creating new (virtual) machines almost instantly Run an OS intended for one CPU on a machine with a different CPU cross-platform virtualization - not part of this talk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 3. Virtualbox Overview "PC" virtualization software from Sun (now Oracle) Two editions, one free software, one not Use the free one, virtualbox-ose (Open Source Edition) Runs on Linux or Windows (or Mac OS X, or even OpenSolaris) host OSes Friendly GUI interface to get you started easily "Serious server" virtualization is not the primary goal Such uses may do better using KVM instead %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 4. Virtualbox Hardware Requirements No special CPU requirements for 32bit use (unlike KVM) VT-x support is needed for 64bit virtualization %font "typewriter" egrep '(vmx|svm)' /proc/cpuinfo %font "standard" The more CPU cores the better (At least) 1 core per simultaneous VM is wise The more RAM the better Add the RAM use of host + each VM Disk I/O will become a bottleneck if you push things hard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 5. Installing Virtualbox on Ubuntu Just one command: %font "typewriter", fore "darkblue" sudo apt-get install virtualbox-ose -y %font "standard", fore "black" Installation on Windows or other Linux distros is similarly easy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 6. Creating a virtual machine Applications -> Accessories -> Virtualbox OSE New (follow the wizard, make a new virtual disk) Plenty of options for the techies to tweak Defaults work well for newcomers They work for techies too, mostly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 7. Running the virtual machine Double click it to start Follow the First Run Wizard (first time only) Use it. Reboot it, shut it down when done. Mounting and unmounting CDs/ISO images Command line interface exists: VBoxManage, VBoxHeadless, ... %font "typewriter", fore "darkblue" vboxmanage --help # Use this for help %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 8. Networking Virtual Machines NAT by default Fine for outbound, no use at all inbound Bridged host interface Works way better that NAT, once set up (can SSH in, etc.) Setup is automatic in newer versions of Virtualbox Internal network Just network between VMs on one physical machine %size 4 https://help.ubuntu.com/community/VirtualBox/Networking %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 9. Virtual Disks Normally just (big) files on a real hard disk Can be created in two ways: Full size -- higher performance Dynamically expanded as needed - more convenient 8 GBytes is a workable size for most "normal" uses In practice as low as 2.5 GBytes to 5 GBytes is often fine Disk file formats: VDI (VirtualBox), VMDK (VMware), VHD (MS), HDD (Parallels) OVF (proposed new standard, via conversion tools) Raw disk or raw partition access can be used Get it wrong, and you will trash your system Get it right, and your VM will have faster disk access %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 10. Snapshots Allows "undo everything since I made a snapshot" Creates a secondary disk file containing only changes In Virtualbox 3.1.x you can have many snapshots: Trees of snapshots This can be useful, or it can become confusing... Handy for quick "experimental" changes to VMs Can let you duplicate someone else's setup Great for doing remote tech support And then revert to your own setup in that VM later %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 11. Guest Additions If you can modify the guest OS you can have better integration with the host OS Better video integration Screen resolution changes Full screen use Mouse integration Copy and paste between VMs and host machine Time synchronization Shared folders Seamless windows Automated Windows guest logons Needs locally built kernel modules in each guest In Ubuntu, DKMS does this automatically Devices -> Install Guest Additions %font "typewriter" sh /media/cdrom0/VBoxLinuxAdditions-amd64.run %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 12. Guest Additions - Shared Folders Useful for moving files to and from VMs Can be permanent or transient To mount a shared folder with your user's UID, do: %font "typewriter", fore "darkblue" sudo mount -t vboxsf FOLDERNAME /PATH/TO/MOUNT-POINT/ -o uid=`id -u` %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 13. Limitations of Virtualbox OSE No built in RDP or VNC access to VMs Non-free edition provides RDP No access to USB devices Non-free edition provides USB pass-through Full Graphical UI at all resolutions Needs (free) Guest Additions Even then, does not always work 100% Will not coexist with KVM virtualization %font "typewriter", fore "darkblue" sudo service kvm stop # Fixes this on Ubuntu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 14. Further Ideas and Resources Teleportation (!) Moving virtual machines around between physical computers, live New feature introduced in VirtualBox 3.1.x Network Tracing Per VM packet capture facilities included See http://www.virtualbox.org/wiki/Network_tips Resources: %size 4 http://www.virtualbox.org %size 4 http://download.virtualbox.org/virtualbox/3.1.2/UserManual.pdf %size 4 https://help.ubuntu.com/community/VirtualBox %size 4 http://www.techthrob.com/2009/03/02/virtualization-in-linux-a-review-of-four-software-choices/ %size 4 http://en.wikipedia.org/wiki/Virtualization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %bgrad 0 0 256 0 0 "white" "aquamarine" 15. Summary and Questions Summary: virtualbox-ose is an open source free and (relatively) easy way to create and use virtual machines under Linux (or even Windows). Useful for: all manner of testing, and using multiple (virtual) machines at once without needing to buy extra hardware Any questions? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%