WARNING: This pages is using the global variables.php file. All 240 course websites after Fall 2018 should use a relative path to a variables.php file in the semester's root directory instead!

CS 240 - Fall 2018

VirtualBox Tutorial


Step 1: Downloading Linux
Step 2: Downloading and Installing VirtualBox
Step 3: Setting up a Virtual Machine
Step 4: Installing Ubuntu on the Virtual Machine
Step 5: Installing the Ubuntu Guest Additions
Step 6: Go Exploring!

VirtualBox is a free program that can be used to run Linux inside a virtual machine on a Windows computer. This tutorial should help you get started with VirtualBox and set up a Linux machine so that you can program on your own computer in a Linux environment. Please note that the TA's will not help you with VirtualBox or other virtual machine problems--this tutorial is provided for the adventurous and is by no means required, nor is this the only way to run Linux on your own computer. This is just one fairly simple way to do it.

Step 1: Downloading Linux

The first thing you're going to want to do is start downloading a Linux distro, because that generally takes the most time. Ubuntu is a free Linux based OS available for download that seems to be fairly user friendly, and is a pretty good choice for getting used to Linux. The way that Ubuntu does their versions can be kind of confusing at first. It might be good to read the first part of this Wikipedia article that explains it, including the Naming Convention.

When downloading Ubuntu, you basically have two options for the version

Note that sometimes these are the same version. I would recommend getting the LTS release, especially if you are new to Linux.

ubuntu

Make sure to download the .iso file from the section marked "Download and Install." I would recommend NOT downloading the Windows installer (Wubi), because it uses its own virtualization/booting program, and it sometimes causes problems. We want the .iso CD image file that has the Ubuntu installer on it, which we'll attach to our virtual machine later.

Step 2: Downloading and Installing VirtualBox

Once you have Ubuntu downloading, the next step is to get VirtualBox and install it. Go to the VirtualBox Download page and download the latest version of VirtualBox for Windows hosts.

virtualbox download

Run the installer once it's downloaded and follow the instructions to install the program. When the installer gives you the warning about resetting the network connection, click Yes (your Ubuntu download should be fine).

warning

Step 3: Setting up a Virtual Machine

When you run the program for the first time, there won't be any virtual machines in your list. Click on the New button to create one.

Vbox New

Click next on the first page of the wizard, and then enter a Name for the new virtual machine. Select Linux for the Operating System type and Select Ubuntu for the Version (if you downloaded the 64 bit Ubuntu, select "Ubuntu (64 bit)"). Then click next to continue the wizard.

vm name

Now you need to select how much Memory to give to the virtual machine. Depending on how much RAM you have in your computer, you'll want to give the VM a decent amount of memory (1 or 2 GB will probably work in most cases). Just be careful not to give more than half the available memory to the VM, since your host OS needs memory to run, too. When you're finished specifying the amount of memory, click next.

vmname

We want to create a new (virtual) hard disk for the VM, and so just click next.

hard disk

Click next on the first page of the Virtual Hard Disk Wizard, and choose the kind of hard disk file you want. I would recommend the default--dynamically expanding storage.

storage

On the next page of the wizard, give a name to your virtual hard disk--the default is the same name as your VM name. Also pick how big you want the hard disk of the virtual machine to be. Ubuntu doesn't require too much hard disk space itself, and the files you'll create for this class shouldn't take up too much space, but I'd go ahead and give it 8 to 10 GB if you've got it to spare.

disk size

Finally, click Finish in both wizards to complete the creation of the virtual machine.

Step 4: Installing Ubuntu on the Virtual Machine

Before starting your virtual machine for the first time, you'll want to set it up to boot from the .iso image file that contains the Ubuntu installer. Click on Storage in the panel on the right to bring up the Storage Settings and click on the CD icon that says "Empty" next to it. Over on the right, click the CD icon to bring up the drop down menu and click "Choose a virtual CD/DVD disk file..."

attach cd

Browse to the .iso file that you downloaded earlier and click Open and then OK to attach it to the VM. Now you can click the Start button to start your virtual machine. You will get several informational dialogs that will pop up, which would be a good idea to read through once. When the Ubuntu install window comes up, click on "Install Ubuntu" instead of "Try Ubuntu." Follow the onscreen instructions to install Ubuntu on the virtual machine's hard disk.

install ubuntu

The instructions are fairly self explanatory except when you need to choose where on the hard disk to install the operating system. Since this is inside our virtual machine, it is referring to the virtual hard disk we created, and not the actual hard disk in the computer. Just leave the default settings of "Erase and use the entire disk" and click Forward. Don't worry about losing any data--this only affects the virtual hard disk file.

partitions

Step 5: Installing the Ubuntu Guest Additions

Ubuntu will behave better if you tell it that it's running inside a virtual machine. To do this, click on the Devices menu in the VirtualBox window your VM is running in and select "Install Guest Additions..."

install guest additions

Click OK when Ubuntu asks if it can autorun the VirtualBox Additions, and then click Run to start the installation. You'll have to give your password in order to continue.

autorun

After you're done, you can eject the VirtualBox Additions CD File from your Ubuntu machine by right clicking on the CD icon on the desktop and clicking Eject. When you restart your computer, you should be able to use the fullscreen feature, etc.

Step 6: Go Exploring!

Now for my favorite part--exploring the brand new world just opened up to you. There's lots to learn about Ubuntu and Linux in general, and from here on out, the hand-holding ends and you're on your own. I would strongly suggest going through the Linux Tutorial to get your feet wet with the basics. Another great resource is the Ubuntu Forums, where you can find answers to lots of questions that people have already had. Whether your question is general or specific, try searching the forums and see what you come up with. If that doesn't work, you can usually find links to good forum entries on a Google search.

A couple quick tips before concluding: