Jar Bar guide to install Linux in VirtualBox by Yucca Nel
It seems to me that VirtualBox has endless usages for me as a developer. To give value to my other tutorials and to promote this tool, this guide takes you through a VirtualBox install.
How and why I use VirtualBox at The Jar Bar
=VirtualBox offers the user an opportunity to slice the HOST system into numerous GUEST systems. This is extremely useful for anyone needing more than just a single system or even just as a means to run a safer system (like Unix), a free system (most unixes again), a way to run another system without worrying about voiding any warranties or just as a means to have capabilities and advantages of multiple systems in your hands. In fact, it's this feature that I personally love exploiting that makes using VirtualBox a pleasant experience. Each operating System has it's pros and cons. Windows is my host System for starters and I am able to run non Unix supported applications on it such as: Adobe Photoshop, Camtasia screen recorder and more importantly do important developer tasks like testing web applications in Safari and Internet Explorer browsers. I am also tied down to Windows like many others because of poor support from companies like Nokia who don't value their Unix loving customers. The truth however is that I also love Unix as it has it's own perks. From an Ubuntu perspective, I find that configuration and installation of simple products like The Gimp, Java JDK and tasks like shell scripting are far easier than windows. Developing on Ubuntu is also a breeze and fun thanks to the features of Compiz window decorator.
VirtualBox is free, but costs you system resources
Using a VirtualBox system may come at a price. You certainly may want to run a system at full performance and perhaps that's one drawback to VirtualBox as it's probably not an option for users with lower end systems. I hope to help with the instructions below to manage a more efficient install of a VirtualBox guest.
Ubuntu VirtualBox guest example
This tutorial demonstrates the setup of an Ubuntu Linux based guest on a Windows 7 Host. I chose Ubuntu because it is a well documented, fun, free (as in money), free (as in allows you to modify how it works) system with many variations like "Xubuntu", "Kubuntu" and "Ubuntu" and numerous spin offs like the Mint distros that are all available in multiple languages. At the bottom of this page is a Link to a fabulous site for Linux at "distrowatch.com" for almost anything Linux related. You can also get Ubuntu from the link below. Finally, it makes sense to pin VirtualBox to your dock/taskbar if you plan on using it often.
VirtualBox can save you money
Ubuntu and it's variants all come with a ton of free software that usually cost nothing and are constantly improving thanks to strong communities and businesses supporting them. Examples of applications that come free with Ubuntu are: music/dvd burner, image editor, office suite, games, tools for development and the powerful shell/terminal. And finally, Ubuntu comes without the need for an anti virus suite. VirtualBox is free and provides a safe means to run a Linux system like Ubuntu.
Java (or other) development in VirtualBox
For developers like Java based developers, common tools like "Maven", the "JDK", "Netbeans", and "Tomcat" are easy to install and the command line interface comes with a secure shell(ssh) client for interaction with remote production servers.
To create a new VirtualBox Guest...
Select "New" as depicted in the image below:
Confirm that you wish to create a new box
The next screen confirms that you intend to create a new VirtualBox guest so just select "Next":
Give the VirtualBox guest a name
Provide a name and type for your guest system. There are some nice defaults to certain names, so just type in "Ubuntu" if you plan on using Ubuntu and VirtualBox will fill in the rest:
Assign VirtualBox RAM
Next, provide memory for your guest. Don't be too generous as your host system needs to continue to run smoothly too. In other words, keep what's optimal or recommended for your host operating system and only give your guests the excess RAM that is unused. You can share the excess between your guests and you can always change it later in the guest "Settings". For Windows 7 I keep 3GB RAM for my guest out of a total 6GB, giving me 3GB RAM to share between guest systems and 3GB to run any memory intensive programs on Windows as well as my guest System along with it's own memory needs. You may be wondering if it's a good idea to run VirtualBox at this point given the needs, but additional memory is cheap and systems like Ubuntu need very little RAM to run smoothly. If you're reading this tutorial as a developer, then simple adjustments in software can help save you performance like using Gimp instead of Photoshop, but that's purely up to you. There are also tools available to monitor and log your RAM if you need to calculate the appropriate RAM needed by your host. This is very important though as failure to correctly set RAM can render the host unusable:
Configure a Virtual Disk
We now need to configure a virtual hard disk for our system. Options include creating a new disk, using an existing one or even a custom one pre configured with certain software like the ones from Oracle that come pre configured with Linux and Java for development. These are available from the "VirtualBox" website in the "Links" section below. The default location of Hard Disks are in your VirtualBox home directory in your user directory. This is useful if you're looking for an existing disk. To create a new Hard Disk, see the User Interface which is well documented. The recommended option is a ".vdi" dynamic Hard Disk. By default the size is usually just big enough to install your guest Operating System on and then as per the documentation when using a dynamic disk, the disk will grow as needed but will NOT shrink when space is freed. Creating a "fixed" size disk takes much longer though:
Select the Virtual disk type
Select the type of virtual disk:
Select Dynamic or Fixed Virtual Disk type
Select whether you want a fixed or dynamic disk size:
Specify the VirtualBox Virtual disk size
Select the initial size you want for your VirtualBox disk. The default size is usually only big enough to install the guests Operating System:
Confirm the VirtualBox disk creation
Confirm the creation of the new disk details. This window allows you to confirm the selection:
Finish the creation of the VirtualBox disk
Finish the creation of the guest disk by choosing "Create":
The guest resources are set but...
You've successfully configured the basic resources to run a guest system, but you're not done! The next window confirms the basic setup of your guest, but you don't have an Operating System installed on it yet and there are a lot of "Settings" and enhancements that can still be made:
Fine tuning our VirtualBox guest
Select the VirtualBoxguest in the list of guests and select "Settings". We are going to fine tune our guest to work as good as it can with our hardware:
Tuning the MotherBoard
Under "System", we can select "Motherboard" to choose which devices we want to let our guest use. You can also modify the RAM here in future:
Processor Settings for the VirtualBox
The "System" "Processor" settings allow you to assign number of processors to your guest. A regular user will not know how to assign processors. You will need to read online documentation to understand your processor. A heads-up is that processors like the "Core 2 Duo" is a single processor that can handle 2 threads and is seen as "2" processors by your system. A newer processor like an "i7 series" one contains "4" processors that are each dual threaded so are seen as "8" processors by your system:
Processor technology
The "System" "Acceleration" settings allow you to use extra technology allowed by your processors. Again you will need to consult online documentation to see if your chip supports these options. These settings will benefit your performance and should be enabled if available to you. They may also require adjustments in your BIOS settings. This can usually be done by the option that appears when you boot your native system by pressing "F12" or similar:
VirtualBox Display
The "System" "Display" settings enhance the display settings of VirtualBox guest. It is wise to select "3D" and to adjust the video RAM to something a little higher if you can:
VirtualBox System Storage Settings
The "System" "Storage" settings are important. In this section we modify the boot order of some devices and get to pick a Hard Disk (if you change Hard Disk) and more importantly get to assign an .iso Image to be used as the disk for our Operating System install. Typically you DON'T want your VirtualBox guest's Hard Disk under "SATA" if your disk is IDE, so remove it:
Change the disk type to represent your disk type
Pick the correct disk type":
Locate the guest disk
Select "Choose existing disk" to locate the virtual disk:
VirtualBox disks are stored in...
VirtualBoxcan be found in your home directory within "VirtualBox VMs", under the name you chose for your system:
Select the Correct disk type
Select the disk as your "IDE Primary Master":
Setting up a VirtualBox virtual CD
Next, setup your virtual "CD/DVD Device". We are going to use the Ubuntu install image we downloaded as a disk. The major plus here is that you don't even need to burn Ubuntu to a CD or DVD as VirtualBox will install it for you from the file!:
Picking a file as a VirtualBox CD/DVD
Select the "Choose a virtual CD/DVD disk file...":
Picking an ISO file to install as the Guest Operating System
Navigate to & pick the .iso containing the Operating System. It is possible, but unecessary to burn it to a CD/DVD. Usually the image is in your home directory in the "Downloads" directory:
Set the CD/DVD as a Secondary Master
Ensure that the disk is selected as your "IDE Secondary Master" device:
VirtualBox Shared Folders
Finally, I show you how to add a shared folder between your host and guest. I use the Music folder in this example as it's a good file to demonstrate the "type" of sharing we want. Given that I purchase and control my Music on my host system, I would like to keep it that way. I most likely don't want my guest system modifying my Music albums and so forth. VirtualBox allows us to share folders in various ways. First we select the "Add Shared Folder" option:
Sharing a Read-Only File to the Guest
Select "Read-only" and "Other" to navigate to your file. Enabling "Read-only" on your file to be shared makes it unmodifiable by your guest system. Disabling it does the logical opposite. Sharing files between guest and host is subject to the install of the "Guest Additions". You can find a tutorial in the "Links" section at the bottom of your page to show you how:
Pick the Shared Folder from the Host
Pick the location of the file you wish to share between host and guest:
List of VirtualBox Shared Folders
The folder should be added in your list of "Shared Folders" it should also be assigned a default name. This is explained in greater detail in the The jar Bar File-Share guide:
Launch your new VirtualBox Guest
You are ready to start your VirtualBox guest . Select the guest and "Start" or simply double-click it. You should now begin a self explanatory install of the Operating System on your guest machine. This install should be once off if you followed these instructions correctly: