Difference between revisions of "PhpVirtualBox"

From Amahi Wiki
Jump to: navigation, search
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{NeedsUpdate}}
 
[[category:apps]]
 
[[category:apps]]
 +
[[category:Virtualization]]
 
[http://www.amahi.org/apps/phpvirtualbox phpVirtualBox] has been packaged for Amahi and is currently in ''ALPHA'' testing.   
 
[http://www.amahi.org/apps/phpvirtualbox phpVirtualBox] has been packaged for Amahi and is currently in ''ALPHA'' testing.   
 +
 +
'''NOTE:'''  This tutorial has not been adapted for Amahi 7 or greater.
  
 
==== How to Install Manually: ====
 
==== How to Install Manually: ====
Line 6: Line 10:
 
* Navigate to the Amahi '''''Applications tab''''', create a web app called '''phpvb'''.   
 
* Navigate to the Amahi '''''Applications tab''''', create a web app called '''phpvb'''.   
 
* Become '''root''' user:
 
* Become '''root''' user:
{{Code|su -}}
+
su -
 
* Install dependency:
 
* Install dependency:
{{Code|yum -y install php-soap}}
+
yum -y install php-soap
 
* Download and extract the source file:
 
* Download and extract the source file:
{{Code|cd /var/hda/web-apps/phpvb
+
cd /var/hda/web-apps/phpvb
wget <nowiki>http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4-0.zip</nowiki>
+
wget <nowiki>http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-3.zip</nowiki>
unzip phpvirtualbox-4-0.zip
+
unzip phpvirtualbox-4.1-3.zip
mv phpvirtualbox-4-0/* html
+
mv phpvirtualbox-4.1-3/* html
chown -R apache:users html}}
+
chown -R apache:users html
* Edit '''''/var/hda/web-apps/phpvb/html/config.php''''' and change the values below to your user name and password (must be the same user name as added to the ''vboxusers'' group during VirtualBox install):
+
* Copy the example config file.
  var $username = 'ian';
+
cd /var/hda/web-apps/phpvb/html
  var $password = 'pass';
+
cp config.php-example config.php
 +
* Edit the copied '''''config.php''''' and change the values below to your user name and password (must be the same user name as added to the ''vboxusers'' group during VirtualBox install):
 +
  var $username <nowiki>=</nowiki> 'vbox';
 +
  var $password <nowiki>=</nowiki> 'pass';
 
* Start Web Service:
 
* Start Web Service:
{{Code|/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null}}
+
/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
  
 
* Enable Web Service start on boot:
 
* Enable Web Service start on boot:
 
Exit '''root''' user and edit crontab for your user (''whoami'' will display the current user name and must match the one in the previous step):
 
Exit '''root''' user and edit crontab for your user (''whoami'' will display the current user name and must match the one in the previous step):
{{Code|whoami
+
whoami
crontab -e}}
+
crontab -e
 
and add the following line. (to save, enter ''':''' followed by '''wq'''):
 
and add the following line. (to save, enter ''':''' followed by '''wq'''):
 
  @reboot /usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
 
  @reboot /usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
Line 30: Line 37:
 
* Create Web Service daemon (this will allow start/stop for updating VirutalBox versions):
 
* Create Web Service daemon (this will allow start/stop for updating VirutalBox versions):
 
As '''root''' user, create the file '''''/etc/init.d/vboxwebsrv''''' and add the following (ensure you replace ''username'' on line 6 with the same user name as added to the ''vboxusers'' group during VirtualBox install):
 
As '''root''' user, create the file '''''/etc/init.d/vboxwebsrv''''' and add the following (ensure you replace ''username'' on line 6 with the same user name as added to the ''vboxusers'' group during VirtualBox install):
  /usr/sbin:/usr/bin:/sbin:/bin
+
  #! /bin/sh
 +
PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
  DESC="VirtualBox Web Service"
 
  DESC="VirtualBox Web Service"
 
  NAME=vboxwebsrv
 
  NAME=vboxwebsrv
Line 90: Line 98:
 
  esac
 
  esac
 
Set permissions:
 
Set permissions:
{{Code|chmod 755 /etc/init.d/vboxwebsrv}}
+
chmod 755 /etc/init.d/vboxwebsrv
 
To use the service, do the following as '''root''' user (option:  start, stop, restart, force-reload, status):
 
To use the service, do the following as '''root''' user (option:  start, stop, restart, force-reload, status):
{{Code|service vboxwebsrv option}}
+
service vboxwebsrv option
 
* That's it.  You should now be able to access VirtualBox from your browser at <nowiki>http://phpvb</nowiki>.  It will restart automatically on reboot as well.  Be aware moving the mouse pointer in this app is quirky and often difficult to navigate.
 
* That's it.  You should now be able to access VirtualBox from your browser at <nowiki>http://phpvb</nowiki>.  It will restart automatically on reboot as well.  Be aware moving the mouse pointer in this app is quirky and often difficult to navigate.
 
* Refer to [http://code.google.com/p/phpvirtualbox/wiki/Installation phpVirtualBox Installation] for additional guidance.
 
* Refer to [http://code.google.com/p/phpvirtualbox/wiki/Installation phpVirtualBox Installation] for additional guidance.

Latest revision as of 02:30, 23 June 2020

Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.

phpVirtualBox has been packaged for Amahi and is currently in ALPHA testing.

NOTE: This tutorial has not been adapted for Amahi 7 or greater.

How to Install Manually:

  • Ensure Advanced Settings is be enabled on your HDA. This can be done via the Settings tab in the Amahi Dashboard.
  • Navigate to the Amahi Applications tab, create a web app called phpvb.
  • Become root user:
su -
  • Install dependency:
yum -y install php-soap
  • Download and extract the source file:
cd /var/hda/web-apps/phpvb
wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-3.zip
unzip phpvirtualbox-4.1-3.zip
mv phpvirtualbox-4.1-3/* html
chown -R apache:users html
  • Copy the example config file.
cd /var/hda/web-apps/phpvb/html
cp config.php-example config.php
  • Edit the copied config.php and change the values below to your user name and password (must be the same user name as added to the vboxusers group during VirtualBox install):
var $username = 'vbox';
var $password = 'pass';
  • Start Web Service:
/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
  • Enable Web Service start on boot:

Exit root user and edit crontab for your user (whoami will display the current user name and must match the one in the previous step):

whoami
crontab -e

and add the following line. (to save, enter : followed by wq):

@reboot /usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
  • Create Web Service daemon (this will allow start/stop for updating VirutalBox versions):

As root user, create the file /etc/init.d/vboxwebsrv and add the following (ensure you replace username on line 6 with the same user name as added to the vboxusers group during VirtualBox install):

#! /bin/sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="VirtualBox Web Service"
NAME=vboxwebsrv
SCRIPTNAME=/etc/init.d/$NAME
USER=username
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /etc/rc.d/init.d/functions
VBPID=`ps -U ${USER} --no-heading -o pid,cmd | grep vboxwebsrv | grep -v ${SCRIPTNAME} | grep -v  grep | tail -1 | awk '{ print $1 }'`
do_start()
{
  if [ "$VBPID" != "" ] && [ "$VBPID" -gt 0 ]; then
     echo $NAME already running with PID $VBPID
  else
     su ${USER} -c 'vboxwebsrv -b --logfile /dev/null >/dev/null'
  fi
}
do_stop()
{
  if [ "$VBPID" != "" ] && [ "$VBPID" -gt 0 ]; then
       echo Stopping $NAME ...
       kill $VBPID
  else 
       echo $NAME not running
  fi
}
do_status()
{
  if [ "$VBPID" != "" ] && [ "$VBPID" -gt 0 ]; then
       echo Running with pid $VBPID
  else
       echo $NAME not running
  fi
}
case "$1" in
 start)
   [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
   do_start
   ;;
 stop)
   [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
   do_stop
   ;;
 restart|force-reload)
   echo "Restarting $DESC" "$NAME"
   do_stop
   sleep 1
   VBPID=0
   echo Starting $NAME ...
   do_start
   ;;
 status)
   do_status
   ;;
 *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
   exit 3
   ;;
esac

Set permissions:

chmod 755 /etc/init.d/vboxwebsrv

To use the service, do the following as root user (option: start, stop, restart, force-reload, status):

service vboxwebsrv option
  • That's it. You should now be able to access VirtualBox from your browser at http://phpvb. It will restart automatically on reboot as well. Be aware moving the mouse pointer in this app is quirky and often difficult to navigate.
  • Refer to phpVirtualBox Installation for additional guidance.


NOTE: See Amahi on VirtualBox for detailed guidance on installing Amahi on a virtual machine (VM).