* Refer to [http://code.google.com/p/phpvirtualbox/wiki/Installation phpVirtualBox Installation] for additional guidance.
===== (''OPTIONAL'') Start Service on Reboot Boot =====* To There are two methods to enable automatic start on reboot, exit .* Option 1: 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
@reboot /usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
* Option 2:
As '''root''' user, create the file /etc/init.d/vboxwebsrv and add the following:
#! /bin/sh
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="VirtualBox Web Service"
NAME=vboxwebsrv
SCRIPTNAME=/etc/init.d/$NAME
USER=username
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /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 }'`
# | tail -1 | awk '{ print $1 }'`
# Function that starts the daemon/service
#
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
}
#
# Function that stops the daemon/service
#
do_stop()
{
if [ "$VBPID" != "" ] && [ "$VBPID" -gt 0 ]; then
echo Stopping $NAME ...
kill $VBPID
else
echo $NAME not running
fi
}
#
# Display "State" field from showinfo action
#
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)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
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