VirtualBox: Difference between revisions
| No edit summary | No edit summary | ||
| Line 72: | Line 72: | ||
|   KERNEL=="vboxdev", NAME="%k", MODE="0660", GROUP="vboxusers" |   KERNEL=="vboxdev", NAME="%k", MODE="0660", GROUP="vboxusers" | ||
|   EOF |   EOF | ||
| Create a helper script that will start VBoxSVC and then execute the specified client: | |||
|  cat > /opt/VirtualBox/VBox.sh << "EOF" | |||
|  #!/bin/sh | |||
|  INSTALL_PATH="/opt/VirtualBox" | |||
|  export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH+:}${INSTALL_PATH}" | |||
|  SERVER_GET_PID="eval SERVER_PID=\$(ps -U $(whoami) | grep VBoxSVC | awk '{ print \$1 }')" | |||
|  $SERVER_GET_PID | |||
|  if [ "$1" = "shutdown" -a -n "$SERVER_PID" ]; then | |||
|    kill -TERM $SERVER_PID | |||
|    exit 0 | |||
|  fi | |||
|  if [ ! -x "$INSTALL_PATH/VBoxSVC" ]; then | |||
|    echo "$INSTALL_PATH/VBoxSVC does not exist! Can not continue." | |||
|    exit 1 | |||
|  fi | |||
|  APP=$(which $0) | |||
|  APP=${APP##/*/} | |||
|  if [ ! -x "$INSTALL_PATH/$APP" ]; then | |||
|    echo "$INSTALL_PATH/$APP does not exist!" | |||
|    exit 1 | |||
|  fi | |||
|  case "$APP" in | |||
|    VirtualBox|VBoxManage|VBoxSDL|VBoxVRDP) | |||
|      EXEC_APP="$INSTALL_PATH/$APP" | |||
|    ;; | |||
|    *) | |||
|      echo "Unknown application - $APP" | |||
|    ;; | |||
|  esac | |||
|  if [ -z "$SERVER_PID" ]; then | |||
|     rm -rf /tmp/.vbox-$(whoami)-ipc | |||
|     "$INSTALL_DIR/VBoxSVC" --daemonize | |||
|  fi | |||
|  $SERVER_GET_PID | |||
|  if [ -z "$SERVER_PID" ]; then | |||
|    echo "VBoxSVC failed to start. Can not continue" | |||
|    exit 1 | |||
|  fi | |||
|  exec "$EXEC_APP" "$@" | |||
|  EOF | |||
| A script similar to the one above is shipped with the binary version. | |||
| Link the binaries we want to run to the script: | |||
|  for file in VirtualBox VBoxManage VBoxSDL VBoxVRDP; do | |||
|    [ -f "/opt/VirtualBox/$file" ] && ln -sfv "../../opt/VirtualBox/VBox.sh" "/usr/bin/$file" | |||
|  done | |||
Revision as of 08:41, 16 April 2007
| Download Source: | http://www.virtualbox.org/download/1.3.8/VirtualBox-OSE-1.3.8.tar.bz2 | 
|---|
Introduction to VirtualBox
VirtualBox is a general-purpose full virtualizer for x86 hardware. Targeted at server, desktop and embedded use, it is now the only professional-quality virtualization solution that is also Open Source Software.[1]
Dependencies
VirtualBox only supports x86 and x86_64.
Required
Optional
Creating the vboxusers Group
groupadd -g 29 vboxusers
Users that are going to use VirtualBox should be added to this group.
Non-Multilib
Compile VirtualBox:
sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
./configure --with-xerces="-lpthread -lxerces-c" \
    --with-qt-dir=$QTDIR &&
source env.sh &&
kmk
Build the kernel module:
cd out/linux.*/release/bin/src && make
Install the kernel module:
make install
Install VirtualBox:
cd .. && install -m755 -d -v /opt/VirtualBox && cp -av * /opt/VirtualBox
Multilib
ToDo
Configuring
The kernel module needs to be loaded for VirtualBox to function. Make sure it gets loaded on boot:
echo "vboxdrv" >> /etc/sysconfig/modules
Also lets create a udev rule so that /dev/vboxdev can be accessed by the users in the vboxusers group.
cat > /etc/udev/rules.d/90-vboxdev.rules << "EOF" KERNEL=="vboxdev", NAME="%k", MODE="0660", GROUP="vboxusers" EOF
Create a helper script that will start VBoxSVC and then execute the specified client:
cat > /opt/VirtualBox/VBox.sh << "EOF"
#!/bin/sh
INSTALL_PATH="/opt/VirtualBox"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH+:}${INSTALL_PATH}"
SERVER_GET_PID="eval SERVER_PID=\$(ps -U $(whoami) | grep VBoxSVC | awk '{ print \$1 }')"
$SERVER_GET_PID
if [ "$1" = "shutdown" -a -n "$SERVER_PID" ]; then
  kill -TERM $SERVER_PID
  exit 0
fi
if [ ! -x "$INSTALL_PATH/VBoxSVC" ]; then
  echo "$INSTALL_PATH/VBoxSVC does not exist! Can not continue."
  exit 1
fi
APP=$(which $0)
APP=${APP##/*/}
if [ ! -x "$INSTALL_PATH/$APP" ]; then
  echo "$INSTALL_PATH/$APP does not exist!"
  exit 1
fi
case "$APP" in
  VirtualBox|VBoxManage|VBoxSDL|VBoxVRDP)
    EXEC_APP="$INSTALL_PATH/$APP"
  ;;
  *)
    echo "Unknown application - $APP"
  ;;
esac
if [ -z "$SERVER_PID" ]; then
   rm -rf /tmp/.vbox-$(whoami)-ipc
   "$INSTALL_DIR/VBoxSVC" --daemonize
fi
$SERVER_GET_PID
if [ -z "$SERVER_PID" ]; then
  echo "VBoxSVC failed to start. Can not continue"
  exit 1
fi
exec "$EXEC_APP" "$@"
EOF
A script similar to the one above is shipped with the binary version.
Link the binaries we want to run to the script:
for file in VirtualBox VBoxManage VBoxSDL VBoxVRDP; do [ -f "/opt/VirtualBox/$file" ] && ln -sfv "../../opt/VirtualBox/VBox.sh" "/usr/bin/$file" done