Create a virtual machine for software bundling or reproducible research
Dealing with complex software packages is a major challenge of scientific computing, particularly on the research front. Systems that are designed to run in a Linux environment are often difficult to assemble. Furthermore, porting to other operating systems may not be feasible.
In general, a virtual machine installation provides multiple instances of an operating system on just one computer. This increases your compute power without the cost and space burden of installing multiple machines. In addition, virtual machines provide a way to:
- run a different operating system than your computer’s native system (e.g., to run Linux on a Windows machine or vice versa, or to run Linux or Windows on a Mac).
- bundle a set of software and the operating system the software runs on so that the user must only download and install VirtualBox, rather than all the dependencies of the software.
- archive the programs and operating system that were used to obtain a set of computational results for a publication (or for any other situation in which you must exactly reproduce results at a later time).
The example given below shows how to create an Ubuntu virtual machine. In this specific instance, the goal was to provide a lightweight Linux installation on a virtual hard drive, which could be redistributed with all necessary software components preconfigured. Jonathan Claridge, the student who developed this virtual machine implementation, used the open source VirtualBox virtualization software (although the pre-compiled versions may include some useful features whose source has not yet been released).
While taking AMATH 574 during Winter 2009, Claridge developed low-footprint virtual machines to assist with distributing Clawpack software across other operating systems. This solution has since been used extensively in AMATH 483/583, for distributing complex, course-specific software, and is a standard means for distributing Clawpack distribution.
Read on for instructions on setting up a low-footprint system for similar purposes.
Building a Low-Profile Virtual Machine
This instructions guide you through setting up a low-profile virtual machine with a minimal desktop installed. These instructions are for a 32-bit virtual machine, and should work whether the host machine is 32- or 64-bit. If you want to create a 64-bit virtual machine, the only difference is the .iso file you download.
After you install the virtual machine, other software packages may be installed. This blueprint has proved effective in a class of about 100 students, with a large portion using the virtual machine.
The Ubuntu development community provides documentation on the installation of low-memory systems, which heavily informed this installation. However, Claridge didn’t always choose the lightest weight components, because, part of the goal was to provide the end user with a familiar desktop environment.
Create a new virtual machine
1. Download the CD image (.iso file) for Ubuntu's Alternate Install CD from the Ubuntu Releases page. First select the latest version and follow the link for PC (Intel x86) alternate install CD. (Although Intel is indicated, you can run this on non-Intel machines.) This will download a file named ubuntu-XX.XX-alternate-i386.iso, where XX.XX denotes the version.
2. To create a new virtual machine and a new virtual hard drive, in VirtualBox, click New. A wizard will step you through the creation of both.
3. In the left sidebar, select the virtual machine you just created and click Start. When given the option Select Installation Media, browse to the file ubuntu-XX.XX-alternate-i386.iso that you downloaded before.
4. After the virtual machine boots, select your language. When the title screen appears, press F4 to to select Install a command-line system. This begins the installation of the minimal set of components, avoiding the components of a standard installation that you don’t need (media players, etc.).
5. Select Install Ubuntu. Proceed through the installer.
Now that you have created a new virtual machine and specified a command-line system, you will install basic desktop components.
Install desktop components
To install desktop components, you’ll first run the apt-get command, and then run a separate installation for the VirtualBox Guest Additions, which create a much smoother interface to the virtual machine.
The packages available with apt-get are:
- xorg: Window manager; needed for graphical interface
- xfce4: Desktop system
- xfce4-terminal: The terminal that goes with xfce4
- xfce4-appfinder: Application that's useful for setting up panel shortcuts
- firefox: Web browser
- gdm: Login manager, gives you a pretty login interface
- build-essential: Includes gcc and make, among other things
Install apt-get packages
Use this single command to install all the apt-get packages simultaneously:
$ sudo apt-get install xorg xfce4 xfce4-terminal xfce4-appfinder firefox gdm build-essential
- sudo gives this command super-user privileges and will require you to enter
the password that you created when you installed Linux.)
- $ indicates the command line prompt, and the line break is just here for legibility.
Install the VirtualBox Guest Additions
1. Restart your virtual machine, and log in to get to the desktop.
2. In VirtualBox, on the Devices menu, click Install Guest Additions.
3. Allow the CD to autorun.
4. Restart the virtual machine to prompt the Guest Additions to take effect.
Note: If you are unable to connect to the Internet after moving a Linux virtual machine to a new computer,
open a terminal window and type the following commands:
$ cd /etc/udev/rules.d
$ cat 70-persistent-net.rules
If the last part of the text displayed says anything other than NAME="eth0", then type:
$ sudo rm 70-persistent-net.rules
Reboot the virtual machine. Linux should recreate this file correctly.
Also in... Get Help Now
Latest eScience News
Please help us support your research by including the following acknowledgment in publications to which we have contributed:
Supported in part by the University of Washington eScience Institute.