As a web developer, I always need to test the application using different browsers like IE6, IE7, IE8, Firefox 2, Firefox 3, Safari and Chrome. Since I’m using Slackware 13.0 at home, I cannot test using the three different versions of Internet Explorer.
The solution is to use Sun VirtualBox and install Windows XP on it. I’ve gone through various packages and installations steps and I have to summary it like this:
Get the VirtualBox Package
Go to SlackBuilds.org and download the necessary VirtualBox packages and dependencies. Since I’m using Slackware Linux 13.0, I used the following:
Download the SlackBuild package and the source code. Install them in the order they appeared above since the first is a dependency of the second and so forth. Please note that they have different links. Once you have downloaded them, you need to extract the slackbuild package only.
Run SlackBuild and Install
For example you are going to install the acpica.tar.gz package, you only need to do the following:
1. Extract the package. I will only show the steps for the first package. The rest will be more or less the same.
tar xvzf acpica.tar.gz
It will extract to a directory name something like “acpica”.
2. Move the source to the “acpica” directory.
mv acpica-unix-20091214.tar.gz acpica/
3. Go to the “acpica” diectory.
cd acpica
4. Run slackbuild. You may now change use as root or maybe later when you need to install.
./acpica_what_ever_name_it_is.SlackBuild
5. It will prompt you where the tgz file is stored after the SlackBuild is complete. Install it using the installpkg command.
installpkg /tmp/the_name_of_the_acpica_package.tgz
The next steps are to install the virtualbox-kernel package and virtualbox-ose package. The installation for virtualbox-kernel package is just the same as what we’ve done in acpica package. Just a note on the install step for virtualbox-ose.
You need to create a group “vboxusers” and make your user a member to that group so that it will be able to run virtualbox.
To install virtualbox-ose package, you need to pass a few parameters to the SlackBuild script. This is what I do:
WEBSERVICE=yes ./virtualbox-ose.SlackBuild
Update
I forgot to mention that the the installation for my virtualbox-kernel package succeed, but the virtualbox-ose package failed! Yes it failed! The reason was that in the last part of the building process (compiling) it failed to copy the PDF file (I think it was named Manual.pdf).
Instead of waiting again to go to the office and download the manual, I just created a dummy Manual.pdf inside the current directory.
nano Manual.pdf # type nothing # press CTRL + O to save # press CTRL + X to exit
Then proceed with the slackbuilding step.
And also, take note of this from README.SLACKWARE
You’ll need to add the following lines to /etc/rc.d/rc.local:
# Start vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv start
fiThis will load the support kernel module for VirtualBox.
You’ll then need to add the following lines to /etc/rc.d/rc.local_shutdown:
# Stop vboxdrv
if [ -x /etc/rc.d/rc.vboxdrv ]; then
/etc/rc.d/rc.vboxdrv stop
fiAny user accounts that plan to use virtualbox will need to be members
of the “vboxusers” group.
A reboot maybe necessary so that kernel modules will be loaded.
Networking with the Guest
After successfully installing VirtualBox I immediately installed Windows XP SP2 as guest. Then installed Guest Add Ons for more features like mouse integration. I noticed that I cannot establish a network connection from host to client and vice versa. This would be a problem since that is the main purpose why I install VirtualBox.
After several trial and error playing with the NAT, Bridged connection, Internal Network and Host Only settings in VirtualBox network settings, I gave up and asked the Slackware Forum.
I’ve came up with the solution from one of the answer and here is it:
To use VirtualBox NAT you must set “eth0” to some other network address besides 10.0.2.nnn. That is because the NAT is a sort of network gateway/router and connects the two networks (host LAN and virtual machine LAN). The host and the guest SHOULD NOT be on the same IP sub-network.
eth0 (10.1.xxx.xxx/24) <===> NAT (10.0.2.2/24) <===> (10.0.2.yyy/24) PCNet Fast III Windows XP
NOTE: “/24” is the same as saying network mask “255.255.255.0”.
VirtualBox NAT assigns the virtual machine’s virtual adapters addresses of 10.0.2.yyy for the first adapter, 10.0.3.yyy for the second adapter, and so forth. In order for NAT routing to work, the host OS (Linux) cannot use the same network addresses for any network interfaces. NAT is different than the other virtual networking modes in that respect.
In order for the guest to connect to the host, the guest must use the VirtualBox NAT host address 10.0.nnn.2 (EX: 10.0.3.2), or the address assigned to one of the host’s hardware interfaces such as eth0 (EX: 10.1.4.5). The host cannot connect to the guest unless you forward ports using “vboxmanage”. The host also can’t ping the guest.
ALL the virtual machines that have NAT virtual interfaces will share the same set of addresses. In other words the first network interface of all virtual machines will use 10.0.2.yyy if configured for NAT and all of those virtual machines will be able to communicate with each other.
The default gateway for a guest OS should be set to the VirtualBox NAT host address 10.0.nnn.2 (EX: 10.0.3.2). That is usually done by the VirtualBox DHCP server. If the default gateway is not defined, then guests can only communicate with the host using the NAT host address 10.0.nnn.2.
Now I can browse happily my web application on the Guest. For file sharing, I just created a shared folder in virtual box. Can’t trust the reliability of Windows File Sharing.
Update: Here are some screenies:
Shown above are:
- Virtual Box configuration which I submit to the Slackware Forum, I did not change it though
- The guest desktop
- The shared folder showing music files from the host
Yay! More stories to come 😀