Here is how I setup a VirtualBox Virtual Machine (VM) running Ubuntu 9.10 Server edition for ColdFusion development on my MacBook Pro.
Step 1: Download Needed Files
The first step is to download all the files you will need. Since the downloads usually take some time we’ll get them out of the way first.
For my installation I wanted to get more familiar with the Server edition of Ubuntu and to require fewer resources. You should be able to do a similar installation with the Desktop edition.
- Download VirtualBox – The official VirtualBox download page.
- Download Ubuntu – To download the Server edition you will need to find a mirror that hosts the installer images. Once you find a mirror navigate to the 9.10 directory and find the download link for the
ubuntu-9.10-server-i386.iso
file. - Download ColdFusion – The official Developer Edition Download is available on the Adobe ColdFusion page. Download the Linux 32 bit installer.
Step 2: Install VirtualBox
Once you have downloaded all the files, run the VirtualBox installer.
If you would like to learn more about VirtualBox the installation comes with a user manual or you can download a pdf copy from their download page.
Step 3: Create an Ubuntu Virtual Machine
Click the New
icon in VirtualBox to start the wizard for adding a new VM.
- Click
Next
to start the wizard. - Enter
Ubuntu CF
for theName
of the VM. - Select
Linux
andUbuntu
in theOS Type
drop downs. - Click
Next
. - Click
Next
to accept the default amount of RAM. (You can adjust if you want to…) - Click
Next
to create a new hard disk image to use for the VM.- Click
Next
to start the wizard . - Click
Next
to create a dynamically expanding storage. - Click
Next
to accept the default name and size. - Click
Finish
to accept the choices for the disk image.
- Click
- Click
Finish
to end the wizard.
Step 4: Install Ubuntu
Now that there is a VM setup to hold the guest Ubuntu system we need to install Ubuntu on it.
In VirtualBox Double Click on the Ubuntu CF
listed in the left column to start up the VM. Since this is the first time you are starting the VM it will bring a up a First Run Wizard to guide you in setting up the new VM.
- Click
Next
to start the wizard. - Change the
Media Source
toImage File
and click theOther...
icon.- Click the
Add
icon along the top. - Select the
ubuntu-9.10-server-i386.iso
file we downloaded earlier. - Click
Select
with theubuntu-9.10-server-i386.iso
item selected.
- Click the
- Click
Next
to continue. - Click
Finish
to end the wizard.
The VM should now startup and bring up the installation the Ubuntu. I’m not going to go into the details of installing Ubuntu here, so just continue with the next step once Ubuntu installation is complete. Also, since we are going to be using apache you may wish to have the setup create a LAMP server configuration when choosing features or you can install it manually afterwards.
Step 5: Setup Guest Additions
In order to have the Shared Folders work we will need to install the Guest Additions.
Before we install the Guest Additions we will need to install dkms:
sudo apt-get install dkms
To mount the Guest Additions disc image to the VM press Command + D
or select Devices > Install Guest Additions...
from the VM menu. Then install the Guest Additions by running:
cd /cdrom
sudo sh ./VBoxLinuxAdditions-x86.run
Step 6: Setup Shared Folders
One of the goals when creating the virtual machine was to be able to edit the files natively but run them on the guest operating system that reflects the production environment.
With shared folders we are able to use a local directory as a share on the guest VM.
Before we add the shared folder we need to have a folder to share. For this example I’m using the directory I created at /Users/randy/Documents/cf9/
.
With the VM powered off edit the Settings
and select the Shared Folder
icon.
- Click the
Add a new shared folder definition
icon on the right side. - Enter the
Folder Path
(/Users/randy/Documents/cf9/
) or selectOther...
from the drop down and locate the directory. - Enter the name you would like the share to be referenced as in the
Folder Name
field. In this case I am going to call itcf9
.
Now that we have the shared folder available to the VM we want it to mount the share each time the VM starts. To do this we startup the Ubuntu VM and edit the /etc/fstab
file and add the following line at the end of the file (note that you will need to change the username to match your user):
cf9 /home/randy/Documents/cf9 vboxsf uid=randy,gid=users 0 0
You will also need to create a blank directory at /home/randy/Documents/cf9
that the share will mount to.
The next time your VM is started it should have access to /Users/randy/Documents/cf9
on the host machine at /home/randy/Documents/cf9
on the guest machine.
Step 7: Enable Port Forwarding
To setup the port forwarding you will need to stop the VM. In the terminal run the following commands to setup the port forwarding. (Note that "Ubuntu CF"
needs to match the name of the VM created above.)
VBoxManage setextradata "Ubuntu CF" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
VBoxManage setextradata "Ubuntu CF" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
VBoxManage setextradata "Ubuntu CF" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8580
This will change the VM settings to have the guest port of 80
(which is the default apache port) of the guest forwarded to port 8580
on the host. Without this you would not be able to talk to the guest operating system.
Step 8: Install ColdFusion
Since we already downloaded the installer for ColdFusion we just need to get that file to the VM. Luckily we already setup a shared folder so if you move the installer to the /Users/randy/Documents/cf9/
directory it will be available in the VM.
To run the ColdFusion installer:
cd /home/randy/Documents/cf9/
chmod +x ColdFusion_9_WWE_linux.bin
sudo ./ColdFusion_9_WWE_linux.bin
This should start the installer. During the installation, apache should be configured to run with ColdFusion.
Step 9: Test Environment
To test that the development environment is working correctly you should be able to place an index.cfm
file in your /Users/randy/Documents/cf9/
directory. Make sure that you place some CFML in the file to test that ColdFusion is doing it’s thing. Then visit http://localhost:8580/ in a browser on your host to test out the new development environment!