Installing Apache 2.x Web Server on Raspberry Pi
This is a guide to install the Apache HTTP Server "Apache" on the Raspberry Pi computer running Debian "squeeze". The core of this guide is a basic installation of Apache, configured to serve static HTML pages. The serving of dynamic HTML pages via additional software like PHP and Ruby on Rails is beyond the scope of this guide, although these instructions could be used as a foundation before installing those additional components.
The guide has been developed/tested using debian6-19-04-2012. A standard 2Gb image has enough room for this install, although you may want to use a larger image to give yourself a bit more elbow room on the already-cramped root folder. (Learn how to expand your image here or here.) This guide requires a network connection.
The installation was all done from the basic (pre startx) command prompt.
A little Debian/Apache foreknowledge: The default Debian install of Apache will be configured to run in the "www-data" user space, and use the "www-data" group. The version of Debian used for this guide (debian6-19-04-2012) already includes the "www-data" user, but not the "www-data" group. The following commands will create the "www-data" group, and add the "www-data" user to the newly-created group:
# Create the www-data group sudo addgroup www-data sudo adduser www-data www-data
Get the latest version of Apache2 from the Debian repository:
# Update repository information sudo apt-get update # Install Apache sudo apt-get install apache2
The "apache2" package requires the installation of a slew of additional packages (often called "dependencies"). Press "Y", then "enter" (or just "enter", as "Y" is the default response), and sit back while the "apt-get" package manager does its thing. Towards the end of the install, you should see a few lines that look like this:
Setting up apache2-mpm-worker (2.2.16-6+squeeze7) ... Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName. Setting up apache2 (2.2.16-6+squeeze7) ...
This is a sign of a successful install!