Author Topic: Zentyal + PhpVirtualBox  (Read 4874 times)

Mittelerde

  • Zen Warrior
  • ***
  • Posts: 153
  • Karma: +8/-0
    • View Profile
Zentyal + PhpVirtualBox
« on: August 24, 2012, 10:53:36 am »
Hello,
heres a manual to add PHPVirtualbox to Zentyal Server
then you are able to manage your VirtualBox VM`s in a browser ;)


First we add the Virtualbox repository & key
see (https://www.virtualbox.org/wiki/Linux_Downloads)

open a terminal and do:

Code: [Select]
sudo -s
echo "deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free" >> /etc/apt/sources.list
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -
apt-get update && apt-get upgrade



Virtualbox
I use the version 4.1 - found there https://www.virtualbox.org/wiki/Downloads

Code: [Select]
apt-get install virtualbox-4.1 && apt-get install dkms
optional (remove old Packages)
Code: [Select]
apt-get autoremove
exit
   

Now install the VirtualBox extension pack https://www.virtualbox.org/wiki/Downloads

Code: [Select]
cd ~/Downloads (Points you in your Username/Downloads Folder)
Code: [Select]
wget http://download.virtualbox.org/virtualbox/4.1.20/Oracle_VM_VirtualBox_Extension_Pack-4.1.20-80170.vbox-extpack
sudo VBoxManage extpack install ./Oracle_VM_VirtualBox_Extension_Pack-4.1.20-80170.vbox-extpack

Now install PHPVirtualBox http://code.google.com/p/phpvirtualbox/downloads/list

Code: [Select]
wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-8.zip
sudo unzip -q phpvirtualbox-4.1-8.zip -d /var/www/
sudo mv /var/www/phpvirtualbox-4.1-8/ /var/www/phpvirtualbox

Now,  copy & edit the PHPVirtualBox config file
Code: [Select]
sudo cp /var/www/phpvirtualbox/config.php-example /var/www/phpvirtualbox/config.php
My Username: Gandalf
My Password: gollum

Remember: My Username have the permissions to run the VirtualBox VM - Normally its your Zentyal login & password

Code: [Select]
sudo nano /var/www/phpvirtualbox/config.php
search following lines and replace with your username & password

        /* Username / Password for system user that runs VirtualBox */
        var $username = 'Gandalf';
        var $password = 'gollum';

Optional:
       /* Console tab keyboard layout. Currently Oracle's RDP client only supports EN $
      var $consoleKeyboardLayout = 'DE';

and replace with your needs, default is EN

save & exit with strg&x + y

now  configure the vboxwebsrv autostart with a initscript
download it
Code: [Select]
wget http://phpvirtualbox.googlecode.com/files/vboxwebsrv
now edit the downloaded for vboxwebsrv and replace the username with yours
for me it looks like this
Code: [Select]
nano vboxwebsrv       
       
        NAME=vboxwebsrv
        SCRIPTNAME=/etc/init.d/$NAME
        USER=Gandalf

save & exit with strg&x + y

now move the script to the right place and give the permissions

Code: [Select]
sudo mv ./vboxwebsrv /etc/init.d/
sudo chown root:root /etc/init.d/vboxwebsrv
sudo chmod +x /etc/init.d/vboxwebsrv

update init (autostart)
Code: [Select]
sudo update-rc.d vboxwebsrv defaults
now you can access PHPVirtualBox in your browser

    http://yourserver/phpvirtualbox

username: admin
password: admin

Change it after first login
File - change passwort

now you can enable the remote display

i connect with linux with rdesktop

Code: [Select]
sudo apt-get install rdesktop
simple connect on a shell with

Code: [Select]
rdesktop yourserverip:remotedesktopport
dont forget to open the rdp port in the zentyal firewall settings

Programm versions:
Zentyal Core version 2.2.7
virtualbox-4.1-8-
Oracle_VM_VirtualBox_Extension_Pack-4.1.20-80170.vbox-extpack
phpvirtualbox-4.1-8.zip


References:
http://www.heise.de/open/artikel/Toolbox-Virtualbox-im-Browser-mit-phpVirtualbox-1668019.html
https://www.virtualbox.org/wiki/Linux_Downloads
http://code.google.com/p/phpvirtualbox/downloads/list
https://www.virtualbox.org/wiki/Licensing_FAQ


that's it, thanks for the attention ;)
« Last Edit: August 24, 2012, 04:07:38 pm by Mittelerde »

robb

  • Guest
Re: Zentyal + PhpVirtualBox
« Reply #1 on: August 24, 2012, 04:36:26 pm »
Hi Mittelerde,

Very cool you took the time to write this howto. Applaud +1 from me.. :)

I would like to ask you if you could do us, the community, another huge favour and put this in the howto section of the Community Documentation in TRAC. (and while you are busy, update to Zentyal 3.0(RC1)?  ::)

I think a lot of people would like to try out this feature, since it has uses the easy-to-use Virtualbox VM environment instead of KVM.

thnx again for your work!

Just a quick remark:
Wouldn't it be safer to create a user that only has rights to use Virtualbox and not the rest of the Zentyal server? And how would you configure such a user?
« Last Edit: August 24, 2012, 04:42:34 pm by robb »

Mittelerde

  • Zen Warrior
  • ***
  • Posts: 153
  • Karma: +8/-0
    • View Profile
Re: Zentyal + PhpVirtualBox
« Reply #2 on: August 24, 2012, 08:52:29 pm »
Thank you :)

ok, i extend the manual with a extra user for VirtualBox (Security)
and a autostart/autoshutdown Script for a VM (Luxury)

.....good to have some Time ;)
« Last Edit: September 03, 2012, 02:06:24 pm by Mittelerde »

sjuzer

  • Zen Apprentice
  • *
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Zentyal + PhpVirtualBox
« Reply #3 on: November 12, 2015, 04:31:53 pm »
HI!
After done steps above, I get this message:
Exception Object
(
    [message:protected] => Could not connect to host (http://127.0.0.1:18083/)
    [string:Exception:private] =>
    [code:protected] => 64
    [file:protected] => /var/www/phpvirtualbox/lib/ajax.php
    [line:protected] => 123
    [trace:Exception:private] => Array
        (
        )

    [previous:Exception:private] =>
)

Its the virtualbox4.3.3

Could you tell how can i autostart/autoshutdown VM?
thanks!

sjuzer

  • Zen Apprentice
  • *
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Zentyal + PhpVirtualBox
« Reply #4 on: November 13, 2015, 11:45:15 am »
I know that is an old topic, but anybody can help?