Saturday, January 26, 2013

Installing VirtualBox on Ubuntu Server LTS

I decided to install VirtualBox on Ubuntu server so I can use it later with Cuckoo Sandbox for malware analysis.

The steps followed for this installation are:
  • Download and installation of Ubuntu Server LTS (current version 12.04.1)
  • VirtualBox and dependencies installation (current stable version 4.1.12)
  • Phpvirtualbox installation for headless servers (version 4.1-11)
  • VirtualBox extension pack installation for VRDP support
  • Starting VirtualBox and connecting to Phpvirtualbox web user interface

1.- Download and installation of Ubuntu Server LTS

I decided to use Ubuntu Server LTS as it is stable and does not require the installation of a Desktop environment, which I won't use for my purposes. The server used has a 64 bits CPU, 12GB RAM, and 514GB of hard disk space, what is more than enough to run several virtual machines in parallel.

A fresh Ubuntu Server image can be downloaded from: http://www.ubuntu.com/download/server

Then you can choose to run the ISO from a USB stick or CD-ROM drive. My recommendation is to install only the base system, so we keep the server clean from packages that we won't use. The only extra package I installed was the SSH server so I can access it remotely.

Once finished the installation processes lets also upgrade the Debian packages to the latest version by
running these commands:
 $ apt-get update  
 $ apt-get dist-upgrade  
As well I setup the hostname and network settings at /etc/hostname and /etc/network/interfaces.

2.- VirtualBox and dependencies installation

Installing Virtualbox with apt-get:
 $ apt-get install virtualbox  
Checking installed packages:
 $ dpkg -l | grep -i virtualbox  
 ii virtualbox             4.1.12-dfsg-2ubuntu0.2    x86 virtualization solution - base binaries  
 ii virtualbox-dkms          4.1.12-dfsg-2ubuntu0.2    x86 virtualization solution - kernel module sources for dkms  
 ii virtualbox-qt           4.1.12-dfsg-2ubuntu0.2    x86 virtualization solution - Qt based user interface  

3.- Installing Phpvirtualbox

First we need to install apache2 and php:
 $ apt-get install apache2  
 $ apt-get install php5  
Then we can install Phpvirtualbox, setting the permissions of the directory to your own username (mine is santiago):
 $ cd /var/www/  
 $ wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-11.zip  
 $ unzip phpvirtualbox-4.1-11.zip  
 $ chown -R santiago:santiago /var/www/phpvirtualbox/  
 $ cp /var/www/phpvirtualbox/config.php-example /var/www/phpvirtualbox/config.php  
Then edit /var/www/phpvirtualbox/config.php and set the username and password for the system user that runs VirtualBox:
 var $username = 'santiago';  
 var $password = 'yourpassword';  

4.- VirtualBox extension pack installation for VRDP support

Installing the extension pack will allow us to control the virtual machines desktop remotely.
 wget http://download.virtualbox.org/virtualbox/4.1.12/Oracle_VM_VirtualBox_Extension_Pack-4.1.12.vbox-extpack  
 vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.12.vbox-extpack  

5.- Starting VirtualBox and connecting to Phpvirtualbox user interface

The following command is used to start VirtualBox web services
 $ vboxwebsrv -b  
Then we can connect to the user interface from our browser at http://yourserverip/phpvirtualbox
user: admin
password: admin

We should be know able to use our fresh installation of VirtualBox.

References

http://www.virtualbox.org/manual/
http://codesupply.net/content/setup-ubuntu-1110-64bit-server-headless-virtualbox-host

8 comments:

  1. Thanks for an excellent guide, although phpVirtualBox has now moved to http://sourceforge.net/p/phpvirtualbox

    ReplyDelete
  2. http://sourceforge.net/projects/phpvirtualbox/files/latest/download/phpvirtualbox-4.2-8.zip

    ReplyDelete
  3. I have a problem with the '"Extension Pack": if I check the installation of it from terminal shell it's ok, but it doesn't exist from web browser (File -> Preferences).
    When I start a virtual machine with support USB 2.0 (EHCI), crashes. If I turn off this option, there are no problems!
    Why is this happening? Is normal? Can I add this control of the Extension Pack from web browser?

    ReplyDelete
  4. I have a problem with the '"Extension Pack": if I check the installation of it from terminal shell it's ok, but it doesn't exist from web browser (File -> Preferences).
    When I start a virtual machine with support USB 2.0 (EHCI), crashes. If I turn off this option, there are no problems!
    Why is this happening? Is normal? Can I add this control of the Extension Pack from web browser?

    ReplyDelete
  5. Great tutorial! If you want some video tutorials on how to install VirtualBox (on Linux Mint/Ubuntu Desktop) you can checkout this blog pages:
    http://www.liviubalan.com/install-virtualbox-on-linux-mint-using-synaptic-package-manager
    http://www.liviubalan.com/install-virtualbox-on-linux-mint-using-cli
    http://www.liviubalan.com/install-latest-version-of-virtualbox-on-linux-mint

    ReplyDelete
  6. If you want some video tutorials on how to install VirtualBox (on Linux Mint/Ubuntu Desktop) you can checkout this blog pages:
    http://www.liviubalan.com/install-virtualbox-on-linux-mint-using-synaptic-package-manager
    http://www.liviubalan.com/install-virtualbox-on-linux-mint-using-cli
    http://www.liviubalan.com/install-latest-version-of-virtualbox-on-linux-mint

    ReplyDelete
  7. Thanks Admin Amazing Post Keep UpDate.Thank You.

    Top 10 Most Popular Internet Marketing Vip SEO Tool and Website Traffic Bot Software Free Download Online Please Visit Our Website

    http://best-premium-seo-tools.blogspot.com

    ReplyDelete