VirtualBox 4.1.28 on SME Server 8*#

First Steps:


  1. Install SME Server

- 32 Bit or 64 Bit.

  1. Do a yum update.

yum update
  1. If any updates were applied, update and reboot the server - test functions after update advised.

signal-event post-upgrade
signal-event reboot
  1. Download and Install kernel-devel & Headers - required for dkms install.

- Hint - Use 'uname' to determine the correct kernel if you are unsure.
yum install gcc make kernel-PAE-devel kernel-headers
or
yum install gcc make kernel-devel kernel-headers
  1. Update SME, and reboot again

signal-event post-upgrade
signal-event reboot
  1. Change your kernel boot options (This is advised for all CentOS systems)

Optionally, for best results with SME 8.x and earlier versions, modify /etc/grub.conf, adding divider=10 to the kernel boot options in order to reduce the idle CPU load with VirtualBox. For example, if your kernel boot line is kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=/dev/main/root change it to kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=/dev/main/root divider=10

  1. To ensure dkms builds correctly - create a symbolic link

ln -s /usr/src/kernels/`uname -r`-`uname-m` /lib/modules/`uname -r`/build
  1. Install the Epel repository to add dkms support (allow installation)


/sbin/e-smith/db yum_repositories set epel repository \

Name 'Epel - EL5' \
BaseUrl 'http://download.fedoraproject.org/pub/epel/5/$basearch' \
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch' \
EnableGroups no \
GPGCheck yes \
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
Visible no \
status disabled


  1. Update the repository database (YUM)

signal-event yum-modify



  1. Install Dynamic Kernel Module Support (DKMS)

yum install --enablerepo=epel dkms
  1. Install the VirtualBox repository same as above


/sbin/e-smith/db yum_repositories set virtualbox repository \

Name 'RHEL/CentOS-$releasever / $basearch - VirtualBox' \
BaseURL 'http://download.virtualbox.org/virtualbox/rpm/rhel/$releasever/$basearch' \
EnableGroups no \
GPGCheck yes \
GPGKey http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc \
Visible no \
status disabled 
  1. Update the repository database (YUM) - again

	signal-event yum-modify
  1. Install VirtualBox - Using 4.1 for compatibility (Current Ver 4.1.28)

yum install --enablerepo=virtualbox VirtualBox-4.1
  1. Update SME again - reboot system

signal-event post-upgrade
signal-event reboot
  1. Setup VirtualBox as a service so it starts automatically after a reboot - please note: this is specific to this/these versions (double check your release of Linux/VirtualBox)

cp /etc/rc5.d/S20vboxdrv /etc/rc7.d/.
cp /etc/rc5.d/S35vboxballoonctrl-service /etc/rc7.d/.
cp /etc/rc5.d/S35vboxweb-service /etc/rc7.d/.
  1. Create a new ''vbox.cfg'' file on your /etc/vbox/ directory

nano /etc/vbox/vbox.cfg

Edit vbox.cfg as below:

VBOXWEB_USER='vboxuser'
VBOXWEB_HOST=127.0.0.1
VBOXWEB_PORT=18083
  1. Create a user account in the base OS (External to SME) to run VirtualBox in & set an appropriate password.

useradd -g users -G audio,floppy,disk,lp,games,mail,users,shared,vboxusers,sys,bin -s /bin/bash vboxuser

passwd vboxuser
  1. Make sure PHP-SOAP is installed - used by phpvirtualbox

yum install php-soap
  1. You can Update SME again if you like - reboot system - virtualbox services should start without error

signal-event post-upgrade
signal-event reboot
  1. Login to the server-manager page and create an ibay for phpVirtualBox.

Whatever name you wish - phpvirtualbox or phpvbox

Make sure it has web access and has a password set (you can set no-password for access still)



  1. Install phpVirtualBox

cd /tmp
wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
unzip phpvirtualbox-latest.zip
Note: at the time of the last update, the latest version was 4.1-2. Please adjust the following for later versions.
cd phpvirtualbox-4.1-2
cp -R * /home/e-smith/files/ibays/phpvbox/html
  1. Create a tmp folder inside the /phpvbox/html folder.

cd /home/e-smith/files/ibays/phpvbox/html
mkdir tmp
chmod 777 tmp/
  1. Create a config file using the example file provided.

cp config.php-example config.php
  1. Open ''config.php'' (located on your /phpvbox/html/ folder). Uncomment some lines (by removing the '#' at the beginning of the line). If you wish to user the secure user 'vboxuser' then also add the username and password - there is no need to uncomment 'var $noAuth = true'. (See next step - 25)

nano /home/e-smith/files/ibays/phpvbox/html/config.php

  1. Disable authentication of ''vboxwebsrv'' (this is not recommended, and should not be required if you use the vboxuser & password from above, however if phpvirtualbox will not connect to the virtualbox web service then make the following changes). Login into the server via SSH and type this command:

vboxmanage setproperty websrvauthlibrary null
  1. Install VirtualBox extension pack to enable support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards. Please install the extension pack with the same version as your installed version of VirtualBox!

You can find the extension packs here. The following commands download and install the extension pack for VirtualBox 4.1.2.

wget http://download.virtualbox.org/virtualbox/4.1.2/Oracle_VM_VirtualBox_Extension_Pack-4.1.2-73507.vbox-extpack
vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.2-73507.vbox-extpack
  1. Update SME, and reboot again

signal-event post-upgrade
signal-event reboot

At this point, VirtualBox should now be configured and running correctly. To check this, we will now log into the ibay we created for phpVirtualBox and attempt to create a new virtual machine. If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help  . For a list of available switches for VBoxManage, see http://www.virtualbox.org/manual/ch08.html this list.

Finally,

  1. Open a terminal window to the SME Server and create a directory to store the virtual machine images.

mkdir -p /var/lib/VirtualBox/VMs
  1. Download the VirtualBox Guest Additions iso for later installation into your virtual machine guests.

mkdir -p /var/lib/VirtualBox/addons
cd /var/lib/VirtualBox/addons
wget http://download.virtualbox.org/virtualbox/4.1.2/VBoxGuestAdditions_4.1.2.iso
  1. Using a web browser, go to http://yourdomain.com/phpvbox and connect to the phpVirtualBox web application.

Creating a Virtual Machine

  1. Using a web browser, go to http://yourdomain.com/phpvbox to create your virtual machine.

  1. Install the VirtualBox Guest Additions ISO into your newly setup VM.

Fingers crossed, all is working!

* Document produced as training / learning materials and is derived from many sources and some original content. All sourced material is subject to those individuals copywrite. Please feel free to use or update this example as required. 

# Example given is for those specific versions of software mentioned (SME Version 8 & VitrualBox 4.1.28), example may be need to be updated for current versions.