Archived Linux Uncategorized

Debian LAMP dev server (and that’s it)

Another one? Really?

I’ll be the first to admit there there is a huge number of documents, websites, tutorials and guides already available for what I’d say is one of the most common questions from web developers: “How do I setup my own Linux web development server?” Read that carefully – development web server. The steps below will fall pretty far short of the mark if you need a production web server. I might cover that later in another article but not in this one.

I’ve built dozens of Linux web servers over the years. Some of them have been for testing, some of them have been for production. The intriguing thing is that out of all those servers, though, I don’t think I’ve ever followed the same guide twice. Why do I need a guide if I’ve built so many? Partly because my memory is crap and partly because I don’t build them often enough to remember the steps manually.

So, here it is – the “Digital Formula No-Bullshit Guide To Setting Up A Debian LAMP Server.”

Question: Why Debian?
Answer: Many reasons, for example:

  • Like most distributions, Debian is easily downloadable (I choose to download distribution ISOs via BitTorrent).
  • There’s so much documentation available that guides like this aren’t even necessary … errr … 🙂
  • From the reading I’ve done, Ubuntu is based on Debian … unless you need something only Ubuntu can provide, why not go straight to the Big Daddy distribution that the other guys copied off? [ start Linux distro war here ].
  • I’ve heard people say, countless times, that for security, Debian is the bee’s knees. Is it true? Until I hear otherwise, I’m rolling with it.
  • It’s just easy. If someone that’s been administering enterprise Windows infrastructure for 15+ years can handle Debian, believe me, anyone can.

Note that this is about as far as you can get from an article about how to manage Debian itself. For that reason, I’m going to assume that you know the basics like CLI navigation, editing text files and using the man command. So, let’s go (you’ll need to run the below commands either as root, or via the sudo command).

The basic foundation

  1. Install Debian Linux. Bet you didn’t see that coming! During installation, try to make sure you’re enable a network mirror, if possible – it’ll save time later. Note that during installation of the latest version (6.0.5 as I write this) there is an option to configure your build as a web server, etc – I don’t use these. I only select the option to install the core utilities/services.
  2. Once Debian is installed, booted and you’re logged in, disable the CD/DVD source by editing /etc/apt/sources.list and commenting out the line(s) that start with deb cdrom:. This is optional, but I think it makes things easier later as it ensures your update processes won’t try and use the media you installed from, only network sources.
  3. Update your package lists by running aptitude update.
  4. Upgrade the currently installed packages by running aptitude safe-upgrade. If you know what you’re doing, you could run aptitude full-upgrade but, as the man pages say, it is more likely to perform unwanted actions. For those that have done this sort of thing before, this is the same as running aptitude dist-upgrade – the command just got renamed.