Installing VirtualBox (4.2) and phpVirtualBox (4.2.4) on headless Ubuntu Server (12.04 LTS)

Ubuntu 12.04 LTS Server is a headless server and does not have X-Window, therefore phpVirtualBox is needed to manage VirtualBox. There are two steps covered here in this post; one for instaling Virtualbox 4.2.4 and the other one for installing phpVirtualbox 4.2.4 (the most current version at the time of writing this post).

Step 1. Installing VirtualBox 4.2

  • Download the Oracle public key for apt-secure and register it as below:
  • Add VirtualBox repository to Ubuntu’s package resource list and update it
  • Install VirtualBox 4.2
    • sudo apt-get install virtualbox-4.2
  • Add a local user to the “vboxusers” group for using VirtualBox
    • sudo adduser <your-local-user> vboxusers
  • Create a config file for VirtualBox under “/etc/default” and add the local user as a VirtualBox web service user
    • sudo nano /etc/default/virtualbox
    • Locate the line starting with “VBOXWEB_USER” and change it as below
      • VBOXWEB_USER=<your-local-user>
  • Download and install the VirtualBox Extension Pack for the remote desktop connection to the virtual machines

Step 2. Installing phpVirtualBox 4.2.4

  • Install LAMP (Linux, Apache, Mysql, Php) components (keep the ‘^’ at the end)
    • sudo apt-get install lamp-server^
    • Check the web server installation
      • http://localhost
    • Check the PHP installion
      • echo “<?php phpinfo(); ?>” | sudo tee /var/www/testing.php
      • http://localhost/testing.php
  • Download phpVirtualBox according to the installed VirtualBox version (4.2)
    • wget
  • Unzip the contents of the
    • unzip
    • (If unzip is not installed: sudo apt-get install unzip)
  • Create a directory for phpVirtualBox under “/var/www” and copy the contents of unzipped there
    • sudo mkdir /var/www/phpvirtualbox
    • sudo cp -R phpvirtualbox-4.2-4/* /var/www/phpvirtualbox
  • Prepare the phpVirtualBox config file
    • sudo cp /var/www/phpvirtualbox/config.php-example /var/www/phpvirtualbox/config.php
  • Enter the local user’s credential to the “$username” and “$password” fields in the config file
    • var $username = ‘<your-local-user>’
    • var $password = ‘<your-local-user-pass>’
  • Start the VirtualBox web service
    • sudo /etc/init.d/vboxweb-service start
  • Restart the server
    • sudo shutdown -r now
  • Connect to the web interface of phpVirtualBox
    • http://localhost/phpvirtualbox
      • username: admin
      • password: admin

That’s the whole process to get phpVirtualBox work properly along with VirtualBox. I hope it also worked for you.

This entry was posted in Linux, Virtualization and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *