Install VirtualBox on Ubuntu Server

We have all used VirtualBox which is essentially a personal use virtualization software. We have typically used it on a Desktops, both windows and linux. Generally, on a Ubuntu 14.04 with Unity Desktop. about 1 GB to 1.5 GB of RAM is used up and with notorious compiz, the utilization increases without explanation sometimes. Below one can find a simple way to install Oracle VirtualBox on a Ubuntu 14.04 server without GUI as an Ubuntu server when fully installed uses about 250 MB of memory which easily gives you about 1.2 GB additional RAM which you can give to other demanding VMs. You can access the Virtualbox interface using a browser of your choice and carryout all operations as you do with a standard virtualbox installation on a desktop.

Below are steps that you need to follow sequentially. For obvious steps and dependencies, there is no explanation. Wherever required, explanation is provided

  1. Install Ubuntu 14.04.01 LTS – 64 bit. I am assuming your CPU has more than 4 GB RAM and you will install many VMs in the VirtualBox for testing
  2. sudo apt update && sudo apt upgrade -y
  3. sudo apt install build-essential dkms unzip -y
  4. Add Virtualbox Repository & repository certificate
    1. sudo nano /etc/apt/sources.list
    2. add the repository at the end of the file: deb http://download.virtualbox.org/virtualbox/debian trusty contrib
    3. Save the file and exit ( Cntl O & Cntl X)
    4. add the certificate : wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add –
    5. sudo apt update
  5. Update and install Virtualbox along with the dependencies
    1. sudo apt install virtualbox-4.3 -y
    2. This will download a good 100 MB to 110 MB worth files and dependencies
  6. Add the system user in the vboxusers group. Virtualbox can be accessed by users who are part of the vboxusers group. vboxusers group is created when VirtualBox is installed on the server. You do not have to create vboxusers group.
    1. testuser is a system user which I have used to log into the server using ssh
    2. sudo usermod -aG vboxusers testuser
  7. Check the status :
    1. sudo /etc/init.d/vboxdrv status. It should show this output on the screen……………………..VirtualBox kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) are loaded.
    2. if above output is not seen, run: sudo /etc/init.d/vboxdrv setup
  8. Download & Install VirtualBox extension Pack
    1. wget http://download.virtualbox.org/virtualbox/4.3.12/Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack
    2. sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack
  9. Download & Install phpvirtualbox along with apache & php5 and php-soap
    1. sudo apt install apache2 php5 php-soap
    2. wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip
    3. unzip phpvirtualbox-4.3-1.zip
    4. sudo mv phpvirtualbox-4.3-1 /var/www/html/phpvirtualbox
    5. sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php
    6. sudo nano /var/www/html/phpvirtualbox/config.php
    7. Replace the vbox user with
      […]
      var $username = ‘testuser’;
      var $password = ‘test’;
      […]
    8. Save & Exit
    9. Create a new file as below in step 1 and add the line as in step 2 replacing testuser with whatever you are using
      1. sudo nano /etc/default/virtualbox
      2. VBOXWEB_USER=testuser
      3. Save & Exit
  10. sudo /etc/init.d/vboxweb-service start
  11. Accessing Virtual box from another machine
    1. Open a browser and navigate to http://<ip-address>/phpvirtualbox.
    2. Default user id is ‘admin’ and password is ‘admin’ (both without quotes)
  12. Complete and enjoy your installation. If you are using Chromium and having issues with Flash while connecting to the console on the right, I suggest you use Firifox or fix the flash issue with Chromium

If you got this to work and you liked this post, please appreciate by clicking on the Like button below.

Cheers

For Ubuntu 16.04 need to do the additional stuff

sudo apt-get install libapache2-mod-php php-xml php

In ubuntu 16.04, php5 is no linger installed. It is by default php 7. As usual …cutting edge and the latest. Why keep using old stuff 🙂

Enjoy your Virtualbox and php installation.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s