(Note, this will
probably only work with Sun VirtualBox 2.2.2)
My reasoning for this is I needed a (virtual) windows machine running
on at a remote location to perform various administrative tasks.
I can control the virtual machine using an RDP client (ie windows
Remote Desktop Connection). This way I can run network
applications as if I were in the office and am not tying up a physical
machine.
1. Download the following files to your server (it is a
good idea to keep these file around if you ever need to rebuild a
server)
wget
ftp://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/4/en/updates/i386/alsa-lib-1.0.6-5.RHEL4.i386.rpm
wget
ftp://ftp.pbone.net/mirror/ftp.centos.org/4.7/os/x86_64/CentOS/RPMS/SDL-1.2.7-8.i386.rpm
wget
http://download.virtualbox.org/virtualbox/2.2.2/VirtualBox-2.2.2_46594_rhel4-1.i386.rpm
wget
https://kevinps2003.tripod.com/vboxdrv-2.2.2.tar.gz
(Note: vboxdrv-2.2.2.tar.gz contains vboxdrv.ko and
vboxnetflt.ko, which was copied from a VirtualBox 2.2.2 installation on
a Cent OS 4.7 machine)
2. Install the dependencies for VirtualBox
rpm -Uvh
alsa-lib-1.0.6-5.RHEL4.i386.rpm
rpm -Uvh SDL-1.2.7-8.i386.rpm
3. Create a new group ‘vboxusers’ in the server manager and
assign the appropriate users.
4. Create a new ibay for the VirtualBox settings and hard
drive files. Set the Group to ‘vboxusers’ and User Access to
‘read=group, write=group’.
5. Install VirtualBox using the following command
rpm -Uvh
VirtualBox-2.2.2_46594_rhel4-1.i386.rpm
Note - You will get the following error message, which you can ignore,
we will manually copy and install the precompiled modules
Creating
group 'vboxusers'. VM users must be member of that
group!
No precompiled module for this kernel found -- trying to build one.
Messages
emitted during module compilation will be logged to
/var/log/vbox-install.log.
Compilation of the kernel module FAILED! VirtualBox will not start
until this
problem is fixed. Please consult /var/log/vbox-install.log to find out
why the
kernel module does not compile. Most probably the kernel sources are
not found.
Install them and execute
/etc/init.d/vboxdrv setup
as root.
6. Extract files from vboxdrv-2.2.2.tar.gz
tar
-zxvf vboxdrv-2.2.2.tar.gz
7. Copy precompiled virtualbox drivers to the appropriate
lib/modules/… folder
(use ‘uname –r’ to determine your current kernel)
cp
vboxdrv.ko /lib/modules/2.6.9-78.0.13.EL/
cp
vboxnetflt.ko /lib/modules/2.6.9-78.0.13.EL/
8. Change module permissions and owner using the following
commands (this step might not be required)
chown
root:root /lib/modules/2.6.9-78.0.13.EL/vboxdrv.ko
chown
root:root /lib/modules/2.6.9-78.0.13.EL/vboxnetflt.ko
chmod 644
/lib/modules/2.6.9-78.0.13.EL/vboxdrv.ko
chmod 644
/lib/modules/2.6.9-78.0.13.EL/vboxnetflt.ko
9. Test the kernel module, if there are no error messages,
you can keep going, if not, you may have to compile the modules for
yourself.
insmod
/lib/modules/2.6.9-78.0.13.EL/vboxdrv.ko
insmod
/lib/modules/2.6.9-78.0.13.EL/vboxnetflt.ko
10. Verify the kernel modules are loaded
lsmod
| grep vbox
Should result in
vboxnetflt
78504 0
vboxdrv
100008 1 vboxnetflt
11. Unload the kernel
rmmod
vboxnetflt
rmmod
vboxdrv
12. Edit the /lib/modules/2.6.9-78.0.13.EL/modules.dep
pico
/lib/modules/2.6.9-78.0.13.EL/modules.dep
Add the following two lines to the end and save
/lib/modules/2.6.9-78.0.13.EL/vboxdrv.ko:
/lib/modules/2.6.9-78.0.13.EL/vboxnetflt.ko:
/lib/modules/2.6.9-78.0.13.EL/vboxdrv.ko
13. Test that the kernel modules load properly with
the following command
modprobe
vboxnetflt
14. Verify the kernel modules are loaded
lsmod |
grep vbox
Should result in
vboxnetflt
78504 0
vboxdrv
100008 1 vboxnetflt
15. Remove the file that flags vboxdrv and vboxnetflt
module as not being installed properly
rm
/etc/vbox/module_not_compiled
16. Set Environment Variable (replace 'vbox_files'
with the ibay you created)
export
VBOX_USER_HOME=/home/e-smith/files/ibays/vbox_files/files/.VirtualBox
17. Permanently set Environment Variable
pico
/etc/profile.d/vboxpath.sh
Add the two lines below (replace 'vbox_files' with the ibay you created)
#
/etc/profile.d/vboxpath.sh - Set Virtual Box Settings Location
export
VBOX_USER_HOME=/home/e-smith/files/ibays/vbox_files/files/.VirtualBox
Change the permissions on the script to make it executable
chmod 755
/etc/profile.d/vboxpath.sh
18. Verify the environment variable is set
echo
$VBOX_USER_HOME
Should result in (replace 'vbox_files' with the ibay you created)
/home/e-smith/files/ibays/vbox_files/files/.VirtualBox
19. You can now create your own virtual machines using
VboxManage (located in /usr/bin/).
The link below should help you create your first virtual machine.
http://vmetc.com/wp-content/uploads/2008/07/headless-vm-creation-in-virtualbox-creating-an-ubuntu-804-server-vm.pdf
Tips/Hints
A) To create a virtual
machine, use the following command:
/usr/bin/VBoxManage
createvm -name "WinXP" –register
It should result in something similar to: (where 'vbox_files'
will be
the ibay you created)
Virtual
machine 'WinXP' is created and registered.
UUID: 3d07762d-acb9-4a0a-9df0-dd8a1d8ce0e8
Settings file:
'/home/e-smith/files/ibays/vbox_files/files/.VirtualBox/Machines/WinXP/WinXP.xml'
B) After configuring, start the virtual machine by using the
following
command: (replace 'WinXP' with the name you provided in the 'createvm'
command above)
VBoxHeadless
-startvm "WinXP"
C) To access the virtual machine, start your RDP Client (ie
‘Remote
Desktop Connection’ on Windows) and enter the IP Address or Name of
your SME Server (include the port, if necessary).
D) To give your virtual machine an IP Address from your local network
(ie DHCP provided by another machine), use the following commands to
change the Virtual NIC to use your LAN connection. If you server
as configured as a gateway, make sure that 'eth0' is the LAN port not
the WAN port.
VBoxManage
modifyvm "WinXP" -nic1 bridged
VBoxManage modifyvm "WinXP" -bridgeadapter1 eth0