All in the <head> – Ponderings and code by Drew McLellan –

Running a Development Server

I’ve mentioned a few times how I run a Linux-based server for our PHP development projects at work. I find this works well for us, as the projects we work on are generally deployed on Linux web servers, so the commonality helps keeps deployments simple. Prior to this, PHP development was being carried out on a Windows server. The big advantage of this was that it was very quick and easy to set up and to integrate with the Windows-based development environment. The big downside was that it repeatedly stung the team in the bum when it came to deploying to Linux servers.

So what’s involved in running a Linux server for development? To be honest – not a lot. There’s a few new things to learn if you’ve not used Linux and Apache before, but they’re not that tricky. If you run a Mac with OS X, chances are a lot of it won’t be too different anyway.

People will often say that if you’re running a Linux server you really need to know what you’re doing and shouldn’t attempt it without a strong stomach a four-year spell researching network security issues. However, if you’re just talking about running a small web server with trusted users and within a secured LAN (i.e. separated from the internet by some sort of proper firewalling device), then you’re fine to give it a go. Linux is inherently security aware – and that’s why you see so many people harping on about how important it is. Security is a core issue with Linux – it’s on the top of the important features list. So as long as you’re not directly connected to the net, you can be fairly relaxed about it.

If your team isn’t too big (here we tend to have three developers and a project manager working on a project at one time), then you’re not going to need ‘server grade’ hardware. My server is a run-of-the-mill Dell Dimension desktop machine. It’s a Pentium III 800Mhz, which is pretty snappy for this sort of work. At home I have an old AMD K6 400Mhz machine performing the same sort of task, but for fewer users. The bottom line: you don’t need amazing hardware. A workstation that’s falling off the bottom of the upgrade tree is good enough. As a baseline, try to aim for at least 400Mhz and 256Mb RAM.

Of course, it’ll need a network card, a video card, a CD drive, and a hard disc big enough for a few hundred MB of operating system and then all your project files. Keyboard and monitor are essential for installation, but won’t be used much after that.

One of issues it pays to be aware of when selecting hardware for Linux, is that Linux doesn’t have as wide a range of device drivers as other operating systems. This only tends to be an issue if you hardware is either extremely new (like some new fancy pants graphics card), very obscure (like an unbranded network card found at the bottom of a dusty box at the back of a cupboard), or very old (like The Ark). However, it pays to know exactly what hardware you have. Before I start an installation, I usually take each card out of the machine and make a note off all the markings and numbers on it. You’d be amazed at what you can Google for :)

When it comes to choosing an Linux distribution (RedHat, Fedora, SuSE, Mandrake etc) it’s very much a matter of personal preference. That said, I’ve tried a lot of different distros over the years and my favorite for this sort of task is Debian. Although it can be a little trickier to install than some of the more graphical distros, it’s extremely easy to work with once it’s up and running – and for me, that’s way more important. That said, installation is still pretty simple – if you can cope with coding in something like PHP, then installing Debian should be an issue. If you’ve heard anything about Debian before, you may have heard about it’s package-management tool, APT. It’s APT that makes running Debian so simple. For example, if you decide you’d like to use phpMyAdmin on your server, all you need to do is type:

apt-get install phpmyadmin

Agree to any prompts, and that’s it, it’s installed. It’s that level of convenience which makes it worth braving a trickier installer. Beside which, in the next release of Debian (due this summer some time), the installer has been improved and is much more straightforward.

My server has been running now for 95 days without a reboot – and the only reason it was rebooted 95 days ago was because I took out some spare hardware. It’s so useful and so reliable that I’d encourage anyone who’s still limping along without a proper development server to go ahead and give it a go. It’s not scary, it won’t bite, and it’s worth every ounce of the effort.