Difference between revisions of "VirtualBox"

From Amahi Wiki
Jump to: navigation, search
Line 68: Line 68:
 
* Enable start on Boot
 
* Enable start on Boot
 
There are two methods to enable automatic start on reboot.<br />
 
There are two methods to enable automatic start on reboot.<br />
<u>Option 1 (Cronjob):</u>   
+
<u>Option 1 (Cronjob):</u><br />   
 
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):
 
  whoami
 
  whoami

Revision as of 04:25, 4 December 2010

VirtualBox for Fedora 12 Host

This is a step by step tutorial on how to get VirtualBox 3 up and running on Fedora 12. Specifically, this guide was written using the VirtualBox 3.2.10 version and an i386 CPU (32-bit), but should work with all versions. It can be adapted to upcoming versions and different CPUs (64-bit). The folks at VirtualBox have made it easy to install for Fedora users and I’m going to show you how in a few easy steps. Right, open a terminal window and let’s get to it.

There are two options for install.

  1. VirtualBox repo: If you are selective or do not install Fedora updates, this is not the option for you. It will result in installation of ALL Fedora updates that your HDA requires.
  2. VirtualBox RPM: This will only install the RPM and any required dependencies or dependency updates your HDA requires. It is much faster and will not force ALL Fedora updates like Option 1.

Install Option 1 (VirtualBox Repo)

  • Become privileged (root user):
su -
  • Install the VirtualBox repo:
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo && cp virtualbox.repo /etc/yum.repos.d/
  • Enable the new repo:
yum clean all
yum update
  • Install VirtualBox (along with a few other required packages). If you’re having issues here, try installing kernel-PAE-devel first:
yum install -y VirtualBox-3.2 dkms gcc
  • Add yourself to the “vboxusers” group:
usermod -G vboxusers -a <yourusername>
  • (OPTIONAL) This will bring up the VirtualBox GUI on the HDA Desktop. Run and enjoy!
VirtualBox


NOTE: See how-to-install-virtualbox-3-on-fedora-12-tutorial for more info.

Install Option 2 (VirtualBox RPM)

  • Become privileged (root user):
su -
  • Download the applicable RPM for your system (32- or 64-bit):
wget http://download.virtualbox.org/virtualbox/rpm/fedora/12/i686/VirtualBox-3.2-3.2.8_64453_fedora12-1.i686.rpm
wget http://download.virtualbox.org/virtualbox/rpm/fedora/12/x86_64/VirtualBox-3.2-3.2.8_64453_fedora12-1.x86_64.rpm
  • Download and import the GPG key:
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
rpm --import oracle_vbox.asc
  • Add dependencies:
yum install dkms gcc
  • Install VirtualBox:
yum localinstall VirtualBox-3.2*
  • Add yourself to the “vboxusers” group:
usermod -G vboxusers -a <yourusername>
  • (OPTIONAL) This will bring up the VirtualBox GUI on the HDA Desktop. Run and enjoy!
VirtualBox

Web Front End (phpVirtualBox)

  • The application has been packaged for Amahi and is currently in ALPHA testing.

Manual Install

NOTE: This requires Advanced Settings to be enabled on your HDA and 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 -
  • Download and extract the source file:
cd /var/hda/web-apps/phpvb
wget http://code.google.com/p/phpvirtualbox/downloads/detail?name=phpvirtualbox-0.5.zip&can=2&q=
unzip phpvirtualbox-0.5.zip
mv phpvirtualbox-0.5/* 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):
var $username = 'ian';
var $password = 'pass';
  • Start the service:
/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null
  • Enable start on Boot

There are two methods to enable automatic start on reboot.
Option 1 (Cronjob):
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

Option 2 (Service): 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
  • Set permissions and enable service:
chmod 755 /etc/init.d/vboxwebsrv
chkconfig /etc/init.d/vboxwebsrv on
  • To use the service, do the following as root user (options: 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 pinter 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).

Portable VirtualBox for Windows XP/Vista/7 Host