Title: VirtualBox
Date: 2013-08-25
Category: Tools
Tags: VirtualBox, Tools, Virtualization
Author: David Evans

[VirtualBox](https://www.virtualbox.org/) is a virtualization tool that
allows you to run a guest operating system on a host operating system.
The guest operating system interacts with a _virtual machine_, that is
implemented running on the host operating system and simulates the
physical hardware the guest operating system expects to run on (in this
case, an x86 or AMD64 processor and other hardware devices).  Later in
the course, we'll talk about virtualization techniques.

For the course, we will use Ubuntu, an operating system built on the
Linux kernel.  VirtualBox runs on Mac OS X, Windows, and [many
Linux](https://www.virtualbox.org/wiki/Linux_Downloads) variants, so we
expect everyone in the class will be able to have the same working
environment by using VirtualBox and the image we provide.  (If you do
not have reasonable access to a computer capable of running VirtualBox,
please let [me](mailto:evans@cs.virginia.ed) know right away.)

**Note:** You are not _required_ to use VirtualBox.  If you prefer to set up your
own native working environment that is fine and will have big
performance advantages, but if you run into troubles with things not
behaving as expected, the course staff is unlikely to be able to help
you unless you are using the standard environment.

## Setting up VirtualBox

1. Download VirtualBox from
[https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads).
(VirtualBox 4.3.6 was the latest version available when these
instructions were written.)  Binaries are provided for
[Windows](http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-Win.exe),
[OS
X](http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-OSX.dmg),
and [Linux](https://www.virtualbox.org/wiki/Linux_Downloads).  Follow
the instructions to install it on your machine.  (If you don't have
access to a suitable machine, contact the course staff to make other
arrangements.)

2. Download and install the [VirtualBox Extension Pack](http://download.virtualbox.org/virtualbox/4.3.6/Oracle_VM_VirtualBox_Extension_Pack-4.3.6-91406.vbox-extpack).

3. **This step is for Mac OS X and Linux only!** Run VirtualBox and set up a host-only network by selecting
`VirtualBox | Preferences` (or `VirtualBox | File | Preferences` on Linux) to open the Preferences dialog.  Select the `Network`
tab and click the `+` icon to "Add host-only network (lns)".  You should
see a network `vboxnet0` added to the list of networks.  Click `OK`.

4. Download [the cs4414
image](http://www.rust-class.org/resources/cs4414-ubuntu-12.04.2-32bit-vdi-rust0.9.zip).
This is a 2.9 GB zip file, so go get a coffee after starting the
download (even decaf should work fine for this, although it has not been
tested by the course staff).  Save the file wherever you want to do your
work for this course.

5. Extract it (for most systems this should happen automatically when
you double-click it, if not, use `unzip cs4414-ubuntu-12.04.2-32bit-vdi-rust0.9.zip`).  (Be patient, this will also
take a few minutes.)  This will create the
`cs4414-ubuntu-12.04.2-32bit-vdi` subdirectory wherever you do the
extraction. 

6. Open the `cs4414-ubuntu-12.04.2-32bit-on-Windows.vbox`
file in
that directory if you're using Windows, or open the
`cs4414-ubuntu-12.04.2-32bit-vdi-on-others.vbox` file instead if you are
using another OS.  (If you've installed VirtualBox, they should appear
with a blue VirtualBox icon.)  

    You should see something like this:

    <a href="../static/images/vbox-screenshot.png"><img
    src="../static/images/vbox-screenshot.png" alt="VirtualBox Screenshot"
    width=600 align="center"></img></a>

7. Start a new VM (click `Start`) using this image.  You might (or might not) get a few dialogs
from VirtualBox about input capture, and then will see a window running
Ubuntu.  

8. Login using password: `vm4student!` (the username should already be
filled in as _UVa student_)

You are now running Ubuntu on a virtual machine.  Try running some
programs in the VM.  You should be able to browse external web sites
using Firefox or Chrome, and start a shell using the Terminal.

## About the Image

The image contains this software that you will use to get started in
cs4414 pre-installed:

- [Rust 0.9](http://www.rust-lang.org/) - compiler and run-time tools
  for programming in Rust
- [GEdit](https://projects.gnome.org/gedit/) - a simple text editor,
  with added syntax highlighting for Rust
- [git](|filename|github.md) - distributed version control system
- Firefox and Chrome - web browsers

<div id="disqus_thread"></div>

<script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'rust-class'; // required: replace example with your forum shortname
	var disqus_url = 'http://www.rust-class.org/virtualbox.html';

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

