After a lot of farting around with different virtual network adapter types and use cases I finally settled on a networking configuration that works well for developing web apps inside a Debian Virtual Machine running inside Virtualbox on my Windows laptop.
VM needs to be accessible by the windows host even when laptop is “offline” so I can work on the plane.
When laptop is “online”, VM can also access the internet
VM should be accessed by host via a static IP address so that dev environment settings persist beyond a reboot
Two virtual network adapters in the VM’s network tab in Virtualbox:
Adapter #1: “NAT” / DHCP
Adapter #2: “Host-only” / Static IP
The NAT adapter should already be set up by default when you do a fresh install of Debian in Virtualbox. It enables the VM to access the wider internet.
Meanwhile the Host-only adapter enables the host machine to see the VM and persists even when internet connectivity drops allowing you to carry on working.
Set up the Virtualbox Host-only network.
Click File > Preferences > Network, then select “Virtualbox Host-only ethernet adapter” (or whichever host only adapter you selected in the VM’s host-only network adapter tab). Click the edit button which looks like a screwdriver. Enter an unused network in the 192.168.x.x Ip range. I’m using 213.1 because my router is on 192.168.0.1, but I could use anything in that 3rd octet except 0 I think. The netmask should be 255.255.0.0 but for some reason it still works with 255.255.255.0 – I’m still not quite sure why that is though.
Click the “DHCP server” tab and uncheck the ‘Enable Server’ checkbox – we don’t need DHCP because we’ll be using a static IP address.
Configure the networking inside the VM
Log into the VM as root and edit /etc/network/interfaces – it should look like this:
# The loopback network interface
iface lo inet loopback
You are moving a web site or folder tree from one computer to another via FTP
The source computer is Linux
You can’t use the basic FTP program because it doesn’t recurse directories
Use ncftp. Install it if necessary, cd to the root of the folder you want to put to the FTP server and then run the following command: ncftpput -u myFTPusername -p myFTPpassword -R myftp.server.com .
I’ve just spent the last two days preparing a new development environment on a Virtual PC 2007 VM for the application I’m currently building.
The idea behind this setup is that it mirrors as closely as possible the production environment which is CFMX7.0.2 / Centos 5.2 / Apache 2.2.
It took a lot of abortive attempts to get this right but I finally managed it with the help of the very well written walkthrough by Bill Mitchell which itself refers greatly to another blog post by Steve Erat. Mr Mitchell’s guide is great – it covers several different methods of installing the Apache connector in CFMX7 – he can take all of the credit for this, in fact I copied large sections of his procedure (thanks Mr Mitchell :)).
So I’m going to now give a set of precise instructions on how to set up and configure this dev environment that should work first time. I’m also going to be a bit naughty and provide the wsconfig file for download off my server – this will save some more time.
Begin by installing Centos 5.2 on a virtual machine running in Virtual PC – make sure to use “text mode” for the installation as VPC doesn’t support 24bit graphics and will not display the installer properly.
Once installed, open the ports you need in the Centos firewall
Install LAMP (Apache, PHP & MySQL) using Yum (see this article for details).
Reboot the server and check that everything works properly so far. Once you’re sure it is then it is a good time to enable undo disks in VPC as the next phase of the install can go wrong and if it does you can just revert back to this safe position and try again. To enable undo disks:
shut down the virtual machine
in the VPC console open the VM’s settings
select undo disks (6th item) and enable it
restart the VM
Download the coldfusion-702-lin.bin installer from the Adobe download site – on the main Coldfusion download page you will need to click the "related downloads" link to find the correct download
Use the following string replace command on the binary to comment out a line that causes problems
[root@machine]# cat coldfusion-702-lin.bin.backup | sed "s/export LD_ASSUME/#xport LD_ASSUME/" > coldfusion-702-linux.bin
Make the modified binary executable
[root@machine]# chmod 755 coldfusion-702-lin.bin
Execute the installer and select the “Built-In Webserver” option (don’t worry this will be replace with Apache later) IMPORTANT – DON’T LAUNCH THE COLDFUISON SERVER YET – if you do then you’ll have to start all over again.
Open the /opt/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/jrun.xml file and
Find the entry labeled ProxyService
Add <attribute name=”deactivated”>false</attribute> (changed from true)
Find the entry labeled WebService
Add <attribute name="deactivated">true</attribute> (changed from false)
Find the entry cacheRealPath
Add <attribute name="cacheRealPath">true</attribute> (changed from false)
Save the file
In /opt/coldfusionmx7/runtime/lib/ create a directory called ‘wsconfig’
In /opt/coldfusionmx7/runtime/lib/wsconfig create a driectory called ’1′ (one)
In /opt/coldfusionmx7/runtime/lib/wsconfig create a file called wsconfig.properties and populate it with:
#JRun Web Server Configuration File
# edited by bill 10.31 Thur May 24
and save the file
In /opt/coldfusionmx7/runtime/lib/wsconfig/1 create a file called jrunserver.store and populate it with:
proxyservers=127.0.0.1:51011 The 51011 is for ColdFusion MX 7:
Download this file and place it into the /opt/coldfusionmx7/runtime/lib/wsconfig/1 directory
Change ownership of the wsconfig directory and its contents to the coldfusion user:
Create a symlink to the CFIDE folder in the document root:
ln -s /opt/coldfusionmx7/wwwroot/CFIDE
Restart the apache server
[root@machine ~]# service httpd restart
Start the Coldfusion server
[root@machine ~]# service coldfusionmx7 start
Test everything works properly by putting an index.cfm containing some CFML scripting (eg <cfdump var=”#CGI#”>) into the apache web root and type:
You should see the CGI dump. Then test the coldfusion administrator works
where centos-VM is either a domain that you’ve set up for your new VM or its IP address on your LAN
Now you should have a fully working virtual Centos server with CFML (& PHP) support. Don’t forget to install the MySQL connector J Driver too – I already blogged that one here
Finally you really should should close the VM saving the changes. Before re-launching the VM I would recommend that you copy the VM folder to an archive location – you never know when you might need a freshly installed VM with this environment in the future. Leaving undo disks enabled in Virtual PC is a good idea if you can afford the extra disk space required – if you do break your dev environment in the future and can’t fix it but don’t want to restore the initial image then leaving undo disks enabled will allow you to roll back to the last time you saved your changes. Just remember to save your changes regularly.
These days with the price of electricity being so high and with computer power supplies being so big, not to mention the global warming / climate change factor, leaving your home-server running all day while you’re out at work on the off-chance that you might need to access it during the day is a luxury most people can ill-afford.
In an ideal world you would be able to switch on your home server remotely from your work laptop when you’re away from home. Maybe you need to log in via SSH or FTP (if these ports are not blocked by the proxy) or maybe you have it set up as a web server for development use (as I do) and would like to use some of your office downtime to work on something on your dev server. Once you’re done you can then switch it off again with a shell command.
All of this is easy enough to do so long as your home server’s connection to the internet is via an ethernet card that supports Wake On LAN (WOL). You can send a “magic packet“, a string of characters specifically formed to wake your server up either directly from your windows laptop or, if you are behind your company’s proxy server that blocks traffic on port 9, from any internet webserver.
This article will describe the steps that you need to take in order to configure this energy-saving functionality. I am assuming the following:
your home server is running Ubuntu/Debian Linux (although it should be possible to use any flavour of Unix/Linux).
the server is connected to the internet with a cable via an ethernet card that supports WOL
your server has a static IP address at least within your home network. (If your ISP changes your IP address periodically like mine does then you will probably need to either pay them extra for a fixed IP address or use a dynamic DNS service)
you have FTP write access to a webserver connected to the internet that supports PHP scripting
and adjust it to your needs (in this example setup I will use the IP address 192.168.1.101)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
iface lo inet loopback
# This is a list of hotpluggable network interfaces
# They will be activated automatically by the hotplug subsystem.
# The primary network interface
iface eth0 inet static