Installing lighttpd web server on Raspberry Pi

I’ve just set up my Raspberry Pi, and managed to get it up and running after a minor panic – I couldn’t find a micro USB cable anywhere in the house, despite apparently owning way more mini USB and USB A-B cables than I’ll ever need. I then remembered that the Kindle comes with a micro USB cable, phew!

As a web developer, one of the first things I thought of doing was installing a web server, and decided to go for lighttpd as it’s designed to be lightweight and efficient, which is just the ticket for the Raspberry Pi and its limited hardware resources.

Installing it was as simple as sudo apt-get install lighttpd – or it should have been! The installation failed with “chown: invalid group: ‘www-data:www-data’. To fix this, I ran two commands:

sudo adduser www-data
sudo addgroup www-data

(The first command probably isn’t necessary, as it returned “adduser: The user `www-data’ already exists.”)

I then re-ran sudo apt-get install lighttpd again and it succeeded.

Update 30/05/2012:
I have since decided to switch to Apache and PHP. After running apt-get remove lighttpd, I just had to run:

apt-get install php5

This installs all the basics. Apache still needs the www-data group and will refuse to start if you haven’t already run sudo addgroup www-data.

If you get 404 errors when trying to install PHP (as I did), run the following commands and try again:

apt-get update
apt-get upgrade

If you enjoyed this post, please share it!

    One comment on “Installing lighttpd web server on Raspberry Pi

    1. Thomas Berends says:

      Why did you decide to use Apache instead of Lighttpd ?

    Comments are closed.