Ubuntu VirtualBox Server Redux

In: Linux|VirtualBox
Written by: Taylor Gerring


16 Mar 2010

Both VirtualBox and Ubuntu have drastically changed since I wrote HOWTO: Ubuntu VirtualBox Server. In fact, they’ve change to such a degree that the previous article isn’t even relevant. Fret not, as I’ve rebuilt the guide from scratch based on Ubuntu 9.10 Karmic Koala and VirtualBox 3.1.2, which has since been upgraded to 3.1.4.

The only assumptions I’m making is that a fresh, recent version of Ubuntu is installed on some relatively recent hardware and you have an ISO of the OS installation. Ideally, you’re using an Intel Core 2 Duo or better. I installed it with a normal Desktop Edition, but this guide is targeted at command-line management. You’re welcome to install Server Edition in which you’re getting a command-line only version of Ubuntu to reduce system requirements and operate with utmost efficiency.

Install VirtualBox

  1. Add VirtualBox repositories to apt’s sources (this assumes they’re not already there)
    printf "\n# VirtualBox\ndeb http://download.virtualbox.org/virtualbox/debian karmic non-free\n" | sudo tee -a /etc/apt/sources.list
  2. Install the public key
    wget -q -O - http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc |  sudo apt-key add -
  3. Update repo contents and upgrade
    sudo apt-get update && sudo apt-get upgrade
  4. Install main VirtualBox package
    sudo apt-get install virtualbox-3.1

That’s all there is to getting VirtualBox installed. Unfortunately, it’s not too useful without any virtual machines or operating systems, so that will be our next step.

Create a Virtual Machine

  1. Create a Virtual Machine named “LAMP1″ and keep it registered
    VBoxManage createvm --name "LAMP1" --register
  2. Configure the new VM. The setting should be somewhat obvious, so feel free to tweak as necessary. Memory = 256MB, ACPI, hardware virtualization, and VRDP enabled. Set the VRDP port to 3391. Make NIC1 be of type bridged and bind that bridge to eth0. If you’re using wireless, you might need to change this to wlan0 or something similar.
    VBoxManage modifyvm "LAMP1" \
    --memory 256 \
    --acpi on \
    --hwvirtex on \
    --vrdp on \
    --vrdpport 3391 \
    --nic1 bridged \
    --bridgeadapter1 eth0
  3. Create a new hard drive file of size 10GB and remember it.
    VBoxManage createhd --filename LAMP1.vdi --size 10000 --remember
  4. Add a SATA storage controller to the VM for the hard disk to attach to.
    VBoxManage storagectl "LAMP1" --name "SATAController" --add sata
  5. Now, bind the VDI file to the SATA controller. This is like plugging the hard drive into a SATA port.
    VBoxManage storageattach "LAMP1" --storagectl "SATAController" --port 0 --device 0 --type hdd --medium "LAMP1.vdi"
  6. Also add an IDE controller for things like ISO mounting
    VBoxManage storagectl "LAMP1" --name "IDEController" --add ide
  7. Attach OS installation media to the IDE controller.
    VBoxManage storageattach "LAMP1" --storagectl "IDEController" --port 0 --device 0 --type dvddrive --medium ~/ubuntu-9.10-server-i386.iso

That’s it, you’re done! Well, mostly. Depending on your exact circumstances, you may have to tweak a few things.

Verify and Start

  1. Verify everything looks good
    VBoxManage showvminfo "LAMP1"
  2. Start the Virtual Machine.
    VBoxHeadless --startvm "LAMP1"

The major component to managing virtual machines on the command-line is simply knowing the correct commands and parameters to configure everything. I plan to write an addendum which addresses some advanced features such as USB, remote management, and automated startup/shutdown.

Update: The addendum for extra features is up.

2 Responses to Ubuntu VirtualBox Server Redux

Avatar

HOWTO: Ubuntu VirtualBox Server | Idea Excursion

March 16th, 2010 at 11:15 am

[...] UPDATE 2: I having (finally) posted a new guide, utilizing Ubuntu 9.10 Karmic Koala and VirtualBox 3.1.2. As this HOWTO is sorely out-of-date, please follow Ubuntu VirtualBox Server Redux [...]

Avatar

Ubuntu VirtualBox Server Redux Addendum | Idea Excursion

May 25th, 2010 at 5:25 am

[...] the last article on running a VirtualBox server gets you up and running with a minimum installation, there are several things that can be [...]

Comment Form

@TaylorGerring


Unless specified otherwise, this website is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.
Stop SOPA
Unless specified otherwise, this website is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.