VirtualBox 4.3 and phpVirtualBox on Debian wheezy
With this tutorial we are going to explain how to install VirtualBox 4.3 and phpVirtualBox for remote management on Debian wheezy.
As in my previous post VirtualBox 4.2 and phpVirtualBox on Debian this installation is done on a fresh Debian 7.2.0 server. Some of the parts are changed so this installation can work with simple copy/paste.
Installing VirtualBox 4.3
We need to add the Debian repository for add the public key and install VirtualBox 4.3
vi /etc/apt/sources.list.d/virtualbox.list
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
Run the following commands to add the VirtualBox public key for the VirtualBox apt source:
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add - apt-get update apt-get install virtualbox-4.3
For different versions of Debian you can use the following repositories
deb http://download.virtualbox.org/virtualbox/debian precise contrib deb http://download.virtualbox.org/virtualbox/debian oneiric contrib deb http://download.virtualbox.org/virtualbox/debian natty contrib deb http://download.virtualbox.org/virtualbox/debian maverick contrib non-free deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free deb http://download.virtualbox.org/virtualbox/debian karmic contrib non-free deb http://download.virtualbox.org/virtualbox/debian hardy contrib non-free deb http://download.virtualbox.org/virtualbox/debian wheezy contrib deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free deb http://download.virtualbox.org/virtualbox/debian lenny contrib non-free
Now we need to install VirtualBox Extension Pack, you can find the latest version here: https://www.virtualbox.org/wiki/Downloads
cd /tmp wget http://download.virtualbox.org/virtualbox/4.3.2/Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
We need to create vbox user for VirtualBox and phpVirtualBox and add it to vboxusers group
useradd -d /home/vbox -m -g vboxusers -s /bin/bash vbox passwd vbox
Create the file /etc/default/virtualbox and put the following lines so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user vbox
vi /etc/default/virtualbox
VBOXWEB_USER=vbox
Next we need to set vboxweb-service to start on boot
update-rc.d vboxweb-service defaults /etc/init.d/vboxweb-service start
Installing phpVirtualBox for VirtualBox 4.3
We are going to install nginx and PHP to support phpVirtualBox
apt-get install nginx php5-common php5-mysql php5-fpm php-pear unzip /etc/init.d/nginx start
Make changes to nginx default site so you can access your phpVirtualBox website
vi /etc/nginx/sites-available/default
server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } # Only for nginx-naxsi : process denied requests #location /RequestDenied { # For example, return an error code #return 418; #} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
/etc/init.d/nginx reload
Now we are going to install phpVirtualBox
cd /usr/share/nginx/www wget http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-0.zip unzip phpvirtualbox-4.3-0.zip
Copy the config file and set the user and password for your vbox user
cp config.php-example config.php vi config.php
/* Username / Password for system user that runs VirtualBox */ var $username = 'vbox'; var $password = 'yourpassword';
That’s it. Open your browser and login using the default username and password which is admin
VirtualBox: https://www.virtualbox.org/
phpVirtualBox: http://code.google.com/p/phpvirtualbox/
Hey Nikola! Good post, I have followed all the steps but the login web interface appears only with margins. I attach screenshot, strange true? Tested on Ubuntu 12.04 x64 and Debian 7.2 x64 and the same on both cases. It seems strange… Keep you posted. Anyway, you have some information about the cause? Thanks!
Please check your /var/log/nginx/error.log maybe your php is not working i changed the default TCP fastcgi_pass to Debian default unix:/var/run/php5-fpm.sock;
It is set in: /etc/php5/fpm/pool.d/www.conf under listen = /var/run/php5-fpm.sock
I’ve done this tutorial installing it on Debian 7.2 i don’t know what are ubuntu’s default settings.
My PHP version is PHP 5.4.4-14+deb7u5
Regards
Solved, it was other PHP issue. Anyway thanks!
What was it? I’m a newbie and am getting the same thing. Thanks
How do I post my log file? the text is longer than PuTTYs window, I can only copy what is visible.
$m, client: 192.168.1.5, server: _, request: “GET /js/phptest.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host: “192.168.1.110”$
I’m having the same issue as Raul, my browser looks the same. I am running Ubuntu 12.04 x64. I have errors in my log, but Putty will not let me copy the whole line as it is longer that the window.
Pretty clean guide, thank you!
Some minor improvements:
1. In order to have a download link for phpVirtualBox that always works, you may change to:
wget ‘http://sourceforge.net/projects/phpvirtualbox/files/latest/download’
and
unzip phpvirtualbox-*.zip
2. In a headless environment (where the power of phpVirtualBox is stronger), you may append “–no-install-recommends” to VirtualBox installation command, so that no useless x11 related components is installed. In addition, it would be good to install dkms too so that, when VirtualBox gets upgraded by the system, the kernel is updated with the new vboxdrv module:
apt-get install dkms virtualbox-4.3 –no-install-recommends
K.
The above wget address gets trimmed automatically, make sure you get the full address.
thank you for your very clear tutorial, I’m an italian IT developer and I manage so many VB istances in my job but I never found a bugless WEBUI, so I ended up to use only cli that is obviously very time expensive! with this I think that my job is half reduced! thank you! just some tips: 1 – as kostas katsaros sad, in a completely headless environment the best installation is apt-get install dkms virtualbox-4.3 –no-install-recommends (only 90MB vs 300MB) 2 – if you already have installed on your machine an apache web server, is useless to install… Read more »
Please note that phpvirtualbox development is now managed on GitHub and the Sourceforge links are outdated.
New releases can be found here: https://github.com/phpvirtualbox/phpvirtualbox/releases