HOWTO : VirtualBox Headless with PHPVirtualBox
VirtualBox is a virtual machine which can be running on desktop and server. We can running VirtualBox as server (Headless mode) with PHPVirtualBox as front end. PHPVirutalBox can be running with Apache flawlessly. However, I would like it to be running on Hiawatha. There is no database required for the Headless mode.
Part A - Hardware
Motherboard : ASRock Rack C2750D4I server board
CPU : Intel Atom C2750
RAM : 4 x 8GB (32GB) DDR3-1600
Hard Drive : 2 x Western Digital 4TB WD4000F9YZ
Western Digital 4TB WD4000F9YZ is not certified by ASRock, so, it cannot boot from SATA3 ports. The SATA2 ports are used in this case.
The performance of C2750 is similar to Xeon E3-1220L. Please the comparison page at here.
The power consumption of this setup is between 30W to 80W.
Make sure you have enabled "Virtualization" (VT-x) in the BIOS.
Part B - Software
Operating System : Ubuntu Server 14.04.2 LTS
Virtual Machine : VirtualBox 4.3.28
Front End : PHPVirtualBox 4.3-3
Web Server : Hiawatha
RAID : Software RAID 1
Part C - Installation
Part C.1 - Operating System and Software RAID 1 Installation
RAID 1 requires two hard drivers for the installation. When you are installing Ubuntu Server 14.04.2 LTS, you are required to do the partitioning. Select "Automatically partitioning" for each drive. The partitions will be (1) 1MB for "biosgrub"; (2) Free Space for root directory; and (3) Free Space for SWAP.
Then select "Configure Software RAID" to configure the Software RAID 1 on Free Space for root directory and Free Space for SWAP partitions. Do not RAID the "biosgrub" partitions. Set the "Free Space for root directory" to be mount at "/" and use as "Ext4 jouraling file system". Set the "Free Space for SWAP" to be used as "SWAP".
Finally, you should select to install "
After the installation, your box can be booted up as expected. You can check the status of Software RAID 1 by the following commands :
Make sure to change
Add "
Part C.2 - VirtualBox Installation
After the Ubuntu Server 14.04.2 LTS is installed, you can install VirtualBox on it.
Append the following line to it :
Save it.
To uninstall Extension Pack :
Part C.3 - Hiawatha Web Server Installation
Make changes as is.
Append the following to the php-fpm.conf.
Make sure to change the "Hostname" to your IP address.
Part C.4 - PHPVirtualBox Installation
Enter password when prompted.
Change "
Change "
Uncoment (remove "#" in the front) "
Append the following line :
Now, you can browse to http://[your-server-ip]/index.html, e.g. http://192.168.1.120/index.html.
Log in with "
You can copy the iso files to /home/samiux/iso for example by scp command.
Make sure you have installed "Guest Additions" to the all virtual desktop guests. Meanwhile, you need Flash to run the guest VNC.
If you want to browse with http://[your-server-ip]/ only, you need to do the following :
If the network interface occasionally cannot be detected, you can :
Make sure only the interfaces are as below :
That's all! See you.
Part A - Hardware
Motherboard : ASRock Rack C2750D4I server board
CPU : Intel Atom C2750
RAM : 4 x 8GB (32GB) DDR3-1600
Hard Drive : 2 x Western Digital 4TB WD4000F9YZ
Western Digital 4TB WD4000F9YZ is not certified by ASRock, so, it cannot boot from SATA3 ports. The SATA2 ports are used in this case.
The performance of C2750 is similar to Xeon E3-1220L. Please the comparison page at here.
The power consumption of this setup is between 30W to 80W.
Make sure you have enabled "Virtualization" (VT-x) in the BIOS.
Part B - Software
Operating System : Ubuntu Server 14.04.2 LTS
Virtual Machine : VirtualBox 4.3.28
Front End : PHPVirtualBox 4.3-3
Web Server : Hiawatha
RAID : Software RAID 1
Part C - Installation
Part C.1 - Operating System and Software RAID 1 Installation
RAID 1 requires two hard drivers for the installation. When you are installing Ubuntu Server 14.04.2 LTS, you are required to do the partitioning. Select "Automatically partitioning" for each drive. The partitions will be (1) 1MB for "biosgrub"; (2) Free Space for root directory; and (3) Free Space for SWAP.
Then select "Configure Software RAID" to configure the Software RAID 1 on Free Space for root directory and Free Space for SWAP partitions. Do not RAID the "biosgrub" partitions. Set the "Free Space for root directory" to be mount at "/" and use as "Ext4 jouraling file system". Set the "Free Space for SWAP" to be used as "SWAP".
Finally, you should select to install "
OpenSSH
" when asked.After the installation, your box can be booted up as expected. You can check the status of Software RAID 1 by the following commands :
cat /proc/mdstat
mdadm --detail /dev/md0
mdadm --detail /dev/md1
Make sure to change
/etc/network/interfaces
:Add "
allow-hotplug p119p1
" just below "auto p119p1
".Part C.2 - VirtualBox Installation
After the Ubuntu Server 14.04.2 LTS is installed, you can install VirtualBox on it.
sudo nano /etc/apt/sources.list.d/vbox.list
Append the following line to it :
deb http://download.virtualbox.org/virtualbox/debian trusty contrib
Save it.
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install dkms unzip
sudo apt-get install virtualbox-4.3
wget http://download.virtualbox.org/virtualbox/4.3.28/Oracle_VM_VirtualBox_Extension_Pack-4.3.28-100309.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.28-100309.vbox-extpack
To uninstall Extension Pack :
sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
Part C.3 - Hiawatha Web Server Installation
sudo apt-get install php5-cgi php5 php5-cli php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache apache2-utils php5-fpm
sudo apt-get install libc6-dev libssl-dev dpkg-dev debhelper fakeroot libxml2-dev libxslt1-dev
wget http://www.cmake.org/files/v3.2/cmake-3.2.3.tar.gz
tar -xvzf cmake-3.2.3.tar.gz
cd cmake-3.2.3
./configure
make
sudo make install
wget http://www.hiawatha-webserver.org/files/hiawatha-9.13.tar.gz
tar -xzvf hiawatha-9.13.tar.gz
cd hiawatha-9.13/extra
./make_debian_package
cd ..
sudo dpkg -i hiawatha_9.13_amd64.deb
sudo nano /etc/php5/fpm/php.ini
Make changes as is.
zlib.output_compression = On
zlib.output_compression_level = 6
Append the following to the php-fpm.conf.
sudo nano /etc/php5/fpm/php-fpm.conf
[www]
user = www-data
group = www-data
listen.mode = 0666
listen = /var/run/php5-fpm.sock
pm = static
pm.max_children = 100
chdir = /
sudo nano /etc/hiawatha/hiawatha.conf
sudo mkdir /etc/hiawatha/enable-sites
sudo mkdir /etc/hiawatha/disable-sites
sudo nano /etc/hiawatha/enable-sites/vbox.local
Make sure to change the "Hostname" to your IP address.
Part C.4 - PHPVirtualBox Installation
sudo adduser --ingroup vboxusers vbox
Enter password when prompted.
wget "http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-3.zip/download" -O phpvirtualbox-4.3-3.zip
sudo unzip phpvirtualbox-4.3-3.zip -d /var/www/
sudo mv /var/www/phpvirtualbox-4.3-3 /var/www/vbox
cd /var/www/vbox
sudo cp config.php-example config.php
sudo nano config.php
Change "
$username
" to "vbox
" and "$password
" to the password you just entered.Change "
$consoleHost
" to your IP address, such as "192.168.1.120"Uncoment (remove "#" in the front) "
$enableAdvancedConfig = true;
" and "$startStopConfig = true;
"sudo nano /etc/default/virtualbox
Append the following line :
VBOXWEB_USER=vbox
sudo cp /var/log/vbox/vboxinit /etc/init.d/vboxinit
sudo update-rc.d vboxinit defaults
sudo /etc/init.d/vboxweb-service start
Now, you can browse to http://[your-server-ip]/index.html, e.g. http://192.168.1.120/index.html.
Log in with "
admin
' as username and 'admin
" as password.You can copy the iso files to /home/samiux/iso for example by scp command.
Make sure you have installed "Guest Additions" to the all virtual desktop guests. Meanwhile, you need Flash to run the guest VNC.
If you want to browse with http://[your-server-ip]/ only, you need to do the following :
sudo cp /var/www/vbox/index.html /var/www/vbox/index.php
If the network interface occasionally cannot be detected, you can :
sudo cp /etc/network/interfaces /etc/network/interfaces-original
sudo nano /etc/network/interfaces
Make sure only the interfaces are as below :
# This file describes the network interfaces available on you system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interace
auto lo
iface lo inet loopback
# The primary network interface
auto p119p1
allow-hotplug p119p1
iface p119p1 inet dhcp
That's all! See you.