Difference between revisions of "VirtualBox"

From CBLFS
Jump to navigationJump to search
(Corrected the main download link)
 
(36 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
|-
 
|-
 
!Download Source:
 
!Download Source:
| http://download.virtualbox.org/virtualbox/{{VirtualBox-Version}}/VirtualBox-{{VirtualBox-Version}}_OSE.tar.bz2
+
| http://download.virtualbox.org/virtualbox/{{VirtualBox-Version}}/VirtualBox-{{VirtualBox-Version}}.tar.bz2
 
|-
 
|-
 
!Download Guest Additions:
 
!Download Guest Additions:
| http://download.virtualbox.org/virtualbox/{{VirtualBox-Version}}/VBoxGuestAdditions_{{VirtualBox-Version}}_OSE.iso
+
| http://download.virtualbox.org/virtualbox/{{VirtualBox-Version}}/VBoxGuestAdditions_{{VirtualBox-Version}}.iso
 
|}
 
|}
  
Line 11: Line 11:
  
 
{{Package-Introduction|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.|http://www.virtualbox.org/wiki/VirtualBox}}
 
{{Package-Introduction|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.|http://www.virtualbox.org/wiki/VirtualBox}}
 
+
 
== Dependencies ==
 
== Dependencies ==
 
{{Note|VirtualBox only supports x86 and x86_64.}}
 
{{Note|VirtualBox only supports x86 and x86_64.}}
  
 
=== Required ===
 
=== Required ===
 +
* [[Which]]
 
* [[Dev86]]
 
* [[Dev86]]
* [[IASL]]
+
* [[ACPICA]]
 
* [[LibXSLT]]
 
* [[LibXSLT]]
* [[Xalan-C++]]
+
* [[Qt4]]
* [[Qt3]]
 
 
* [[libIDL]]
 
* [[libIDL]]
 +
* [[X Window System]]
 
* [[SDL]]
 
* [[SDL]]
 
* [[ALSA]]
 
* [[ALSA]]
 +
* [[NSPR]]
 +
 
=== Optional ===
 
=== Optional ===
* [[GCC-3.3]] (Requred for command 'kmk' while compiling)
+
* [[PulseAudio]]
 +
* [[Python]]
 +
* [[GCC-3.3]] (Required for command 'kmk' while compiling)
  
 
== Creating the vboxusers Group ==
 
== Creating the vboxusers Group ==
Line 38: Line 43:
  
 
  sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
 
  sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
  ./configure --with-xerces="-lpthread -lxerces-c" \
+
  sed -i "/PKG_CONFIG_PATH=.*qt4/d" configure --disable-qt3 &&
    --with-qt-dir=$QTDIR &&
+
./configure --disable-qt3 --disable-python --disable-pulse \
 +
    --with-qt4-dir=${QT4DIR} &&
 
  source env.sh &&
 
  source env.sh &&
 
  kmk
 
  kmk
 +
 +
Install VirtualBox:
 +
 +
cd out/linux.*/release/bin &&
 +
install -m755 -d -v /opt/VirtualBox &&
 +
cp -av * /opt/VirtualBox
  
 
Build the kernel module:
 
Build the kernel module:
  
  cd out/linux.*/release/bin/src &&
+
  cd src &&
 
  make
 
  make
  
Line 52: Line 64:
 
  make install
 
  make install
  
Install VirtualBox:
+
If you downloaded the Guest Additions ISO install that with the following command:
 +
 
 +
install -m644 -v ../../../../../VBoxGuestAdditions_{{VirtualBox-Version}}.iso \
 +
    /opt/VirtualBox/additions/VBoxGuestAdditions.iso
 +
 
 +
Execute the following command to ensure that all the files are owned by root.
 +
 
 +
chown -Rv root:root /opt/VirtualBox
 +
 
 +
If you built VirtualBox against [[Qt4]] execute the following command to make VirtualBox Suid root:
  
  cd .. &&
+
  chmod u+s /opt/VirtualBox/VirtualBox
install -m755 -d -v /opt/VirtualBox &&
 
cp -av * /opt/VirtualBox
 
  
If you downloaded the Guest Additions ISO install that with the following command:
+
If you built against [[Qt3]] execute the following command to make VirtualBox Suid root and create a link to the proper path:
  
  install -m644 -v ../../../../../VBoxGuestAdditions_{{VirtualBox-Version}}_OSE.iso \
+
  chmod u+s /opt/VirtualBox/VirtualBox3
    /opt/VirtualBox/additions/VBoxGuestAdditions_OSE.iso
+
ln -sfv /opt/VirtualBox/VirtualBox{3,}
  
 
== Multilib ==
 
== Multilib ==
Line 70: Line 89:
  
 
  sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
 
  sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
  ./configure --with-xerces="-lpthread -lxerces-c" \
+
  sed -i "/PKG_CONFIG_PATH=.*qt4/d" configure &&
     --with-qt-dir=$QTDIR &&
+
sed -i "/LIBQT4=/s@/lib@&64@" configure &&
 +
sed -i "/LIBX11/s@/lib @/lib64 @" configure &&
 +
sed -i "s/VBOX_LIBPATH32_X11/VBOX_LIBPATH_X11/" src/VBox/Additions/x11/xclient/Makefile.kmk &&
 +
PKG_CONFIG_PATH="${PKG_CONFIG_PATH64}" ./configure --disable-qt3 \
 +
    --disable-python --disable-pulse \
 +
     --with-qt4-dir=${QT4DIR} &&
 
  source env.sh &&
 
  source env.sh &&
 
  kmk
 
  kmk
 +
 +
Install VirtualBox:
 +
 +
cd out/linux.*/release/bin &&
 +
install -m755 -d -v /opt/VirtualBox &&
 +
cp -av * /opt/VirtualBox
  
 
Build the kernel module:
 
Build the kernel module:
  
  cd out/linux.*/release/bin/src &&
+
  cd src &&
 
  make
 
  make
  
Line 84: Line 114:
 
  make install
 
  make install
  
Install VirtualBox:
+
If you downloaded the Guest Additions ISO install that with the following command:
 +
 
 +
install -m644 -v ../../../../../VBoxGuestAdditions_{{VirtualBox-Version}}.iso \
 +
    /opt/VirtualBox/additions/VBoxGuestAdditions.iso
 +
 
 +
Execute the following command to ensure that all the files are owned by root.
 +
 
 +
chown -Rv root:root /opt/VirtualBox &&
 +
 
 +
If you built VirtualBox against [[Qt4]] execute the following command to make VirtualBox Suid root:
  
  cd .. &&
+
  chmod u+s /opt/VirtualBox/VirtualBox
install -m755 -d -v /opt/VirtualBox &&
 
cp -av * /opt/VirtualBox
 
  
If you downloaded the Guest Additions ISO install that with the following command:
+
If you built against [[Qt3]] execute the following command to make VirtualBox Suid root and create a link to the proper path:
  
  install -m644 -v ../../../../../VBoxGuestAdditions_{{VirtualBox-Version}}_OSE.iso \
+
  chmod u+s /opt/VirtualBox/VirtualBox3
    /opt/VirtualBox/additions/VBoxGuestAdditions_OSE.iso
+
ln -sfv /opt/VirtualBox/VirtualBox{3,}
  
 
== Configuring ==
 
== Configuring ==
Line 118: Line 155:
 
   
 
   
 
  if [ ! -c /dev/vboxdrv ]; then
 
  if [ ! -c /dev/vboxdrv ]; then
echo "/dev/vboxdrv does not exist. Load the kernel module then try again."
+
  echo "/dev/vboxdrv does not exist. Load the kernel module then try again."
exit 1
+
  exit 1
 
  fi
 
  fi
 
  if [ ! -r /dev/vboxdrv -o ! -w /dev/vboxdrv ]; then
 
  if [ ! -r /dev/vboxdrv -o ! -w /dev/vboxdrv ]; then
echo "User $USER can not read and/or write to /dev/vboxdrv."
+
  echo "User $USER can not read and/or write to /dev/vboxdrv."
exit 1
+
  exit 1
 
  fi
 
  fi
 
   
 
   
 
  echo "/dev/vboxdrv exists and $USER can access it."
 
  echo "/dev/vboxdrv exists and $USER can access it."
 
   
 
   
  SERVER_GET_PID="eval SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')"
+
  SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
+
  if [ "$1" = "shutdown" ]; then
$SERVER_GET_PID
+
  if [ -n "$SERVER_PID" ]; then
  if [ "$1" = "shutdown" -a -n "$SERVER_PID" ]; then
+
    echo "Terminating VBoxSVC with PID $SERVER_PID."
echo "Terminating VBoxSVC with PID $SERVER_PID."
+
    kill -TERM $SERVER_PID
kill -TERM $SERVER_PID
+
  else
exit 0
+
    echo "VBoxSVC Not Currently Running."
 +
  fi
 +
  exit 0
 
  fi
 
  fi
 
   
 
   
 
  if [ ! -x "$INSTALL_PATH/VBoxSVC" ]; then
 
  if [ ! -x "$INSTALL_PATH/VBoxSVC" ]; then
echo "$INSTALL_PATH/VBoxSVC does not exist! Can not continue."
+
  echo "$INSTALL_PATH/VBoxSVC does not exist! Can not continue."
exit 1
+
  exit 1
 
  fi
 
  fi
 
   
 
   
Line 146: Line 185:
 
   
 
   
 
  if [ ! -x "$INSTALL_PATH/$APP" ]; then
 
  if [ ! -x "$INSTALL_PATH/$APP" ]; then
echo "$INSTALL_PATH/$APP does not exist!"
+
  echo "$INSTALL_PATH/$APP does not exist!"
exit 1
+
  exit 1
 
  fi
 
  fi
 
  case "$APP" in
 
  case "$APP" in
VirtualBox|VBoxManage|VBoxSDL|VBoxVRDP)
+
  VirtualBox|VBoxManage|VBoxSDL|VBoxVRDP)
EXEC_APP="$INSTALL_PATH/$APP"
+
    EXEC_APP="$INSTALL_PATH/$APP"
;;
+
  ;;
*)
+
  *)
echo "Unknown application - $APP."
+
    echo "Unknown application - $APP."
;;
+
  ;;
 
  esac
 
  esac
 
   
 
   
 
  if [ -z "$SERVER_PID" ]; then
 
  if [ -z "$SERVER_PID" ]; then
rm -rf /tmp/.vbox-$USER-ipc
+
  rm -rf /tmp/.vbox-$USER-ipc
echo "Starting VBoxSVC for $USER."
+
  echo "Starting VBoxSVC for $USER."
"$INSTALL_PATH/VBoxSVC" --daemonize
+
  "$INSTALL_PATH/VBoxSVC" --daemonize
 
  fi
 
  fi
 
   
 
   
  $SERVER_GET_PID
+
  SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
 
  if [ -z "$SERVER_PID" ]; then
 
  if [ -z "$SERVER_PID" ]; then
echo "VBoxSVC failed to start! Can not continue"
+
  echo "VBoxSVC failed to start! Can not continue"
exit 1
+
  exit 1
 
  fi
 
  fi
 
   
 
   

Latest revision as of 13:29, 26 July 2013

Download Source: http://download.virtualbox.org/virtualbox/4.2.16/VirtualBox-4.2.16.tar.bz2
Download Guest Additions: http://download.virtualbox.org/virtualbox/4.2.16/VBoxGuestAdditions_4.2.16.iso

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.

Project Homepage: http://www.virtualbox.org/wiki/VirtualBox

Dependencies

Caution.png

Note

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 *) &&
sed -i "/PKG_CONFIG_PATH=.*qt4/d" configure --disable-qt3 &&
./configure --disable-qt3 --disable-python --disable-pulse \
   --with-qt4-dir=${QT4DIR} &&
source env.sh &&
kmk

Install VirtualBox:

cd out/linux.*/release/bin &&
install -m755 -d -v /opt/VirtualBox &&
cp -av * /opt/VirtualBox

Build the kernel module:

cd src &&
make

Install the kernel module:

make install

If you downloaded the Guest Additions ISO install that with the following command:

install -m644 -v ../../../../../VBoxGuestAdditions_4.2.16.iso \
    /opt/VirtualBox/additions/VBoxGuestAdditions.iso

Execute the following command to ensure that all the files are owned by root.

chown -Rv root:root /opt/VirtualBox

If you built VirtualBox against Qt4 execute the following command to make VirtualBox Suid root:

chmod u+s /opt/VirtualBox/VirtualBox

If you built against Qt3 execute the following command to make VirtualBox Suid root and create a link to the proper path:

chmod u+s /opt/VirtualBox/VirtualBox3
ln -sfv /opt/VirtualBox/VirtualBox{3,}

Multilib

64Bit

Compile VirtualBox:

sed -i "s@/usr/X11R6@${XORG_PREFIX}@g" $(grep -lr /usr/X11R6 *) &&
sed -i "/PKG_CONFIG_PATH=.*qt4/d" configure &&
sed -i "/LIBQT4=/s@/lib@&64@" configure &&
sed -i "/LIBX11/s@/lib @/lib64 @" configure &&
sed -i "s/VBOX_LIBPATH32_X11/VBOX_LIBPATH_X11/" src/VBox/Additions/x11/xclient/Makefile.kmk &&
PKG_CONFIG_PATH="${PKG_CONFIG_PATH64}" ./configure --disable-qt3 \
    --disable-python --disable-pulse \
    --with-qt4-dir=${QT4DIR} &&
source env.sh &&
kmk

Install VirtualBox:

cd out/linux.*/release/bin &&
install -m755 -d -v /opt/VirtualBox &&
cp -av * /opt/VirtualBox

Build the kernel module:

cd src &&
make

Install the kernel module:

make install

If you downloaded the Guest Additions ISO install that with the following command:

install -m644 -v ../../../../../VBoxGuestAdditions_4.2.16.iso \
    /opt/VirtualBox/additions/VBoxGuestAdditions.iso

Execute the following command to ensure that all the files are owned by root.

chown -Rv root:root /opt/VirtualBox &&

If you built VirtualBox against Qt4 execute the following command to make VirtualBox Suid root:

chmod u+s /opt/VirtualBox/VirtualBox

If you built against Qt3 execute the following command to make VirtualBox Suid root and create a link to the proper path:

chmod u+s /opt/VirtualBox/VirtualBox3
ln -sfv /opt/VirtualBox/VirtualBox{3,}

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=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
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}"

export USER=$(whoami)

if [ ! -c /dev/vboxdrv ]; then
  echo "/dev/vboxdrv does not exist. Load the kernel module then try again."
  exit 1
fi
if [ ! -r /dev/vboxdrv -o ! -w /dev/vboxdrv ]; then
  echo "User $USER can not read and/or write to /dev/vboxdrv."
  exit 1
fi

echo "/dev/vboxdrv exists and $USER can access it."

SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
if [ "$1" = "shutdown" ]; then
  if [ -n "$SERVER_PID" ]; then
    echo "Terminating VBoxSVC with PID $SERVER_PID."
    kill -TERM $SERVER_PID
  else
    echo "VBoxSVC Not Currently Running."
  fi
  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-$USER-ipc
  echo "Starting VBoxSVC for $USER."
  "$INSTALL_PATH/VBoxSVC" --daemonize
fi

SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
if [ -z "$SERVER_PID" ]; then
  echo "VBoxSVC failed to start! Can not continue"
  exit 1
fi

echo "VBoxSVC is running for user $USER with PID $SERVER_PID."

echo "Starting $EXEC_APP."
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

Create a desktop file:

cat > /usr/share/applications/VirtualBox.desktop << "EOF"
[Desktop Entry]
Encoding=UTF-8
Version=4.2.16
Name=InnoTek VirtualBox
GenericName=Virtual Machine
Type=Application
Comment=Run several virtual systems on a single host computer
Exec=VirtualBox
TryExec=VirtualBox
Path=
Icon=/opt/VirtualBox/VBox.png
Categories=Application;Emulator;System
EOF