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:
- wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add –
- Add VirtualBox repository to Ubuntu’s package resource list and update it
- sudo sh -c ‘echo “deb http://download.virtualbox.org/virtualbox/debian precise contrib” >> /etc/apt/sources.list’
- sudo apt-get update
- 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
- wget http://download.virtualbox.org/virtualbox/4.2.4/Oracle_VM_VirtualBox_Extension_Pack-4.2.4-81684.vbox-extpack
- VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.4-81684.vbox-extpack
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 https://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.2-4.zip
- Unzip the contents of the phpvirtualbox-4.2.4.zip
- unzip phpvirtualbox-4.2-4.zip
- (If unzip is not installed: sudo apt-get install unzip)
- Create a directory for phpVirtualBox under “/var/www” and copy the contents of unzipped phpvirtualbox-4.2.4.zip 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
- http://localhost/phpvirtualbox
That’s the whole process to get phpVirtualBox work properly along with VirtualBox. I hope it also worked for you.