Nerdrium Home



Web Design

Case Mods





My Blog




Installing Apache 2 from Scratch

by Michael Greifenkamp (February 20th, 2004)

Recently I spent some time configuring a new webserver at work. We purchased a Dell PowerEdge 1750 with dual 2.8 GHz Xeon processors, 2 gigs of RAM, and three 73 gig SCSI hard drives that I have configured in a RAID 1 setup with two mirrored drives and a hot-swap spare.

After getting a base installation of RedHat Enterprise Linux ES 3.0 up and running, I went through the steps of installing Apache, MySQL, and PHP, without using the RedHat RPMs.

I'm going to explain here what I did, line-by-line, somewhat in case this information might be helpful to someone else, but mostly so that I have it written down somewhere if I ever have to do this again.

Our first stop is the Apache Software Foundation. The file that I download from a mirror is httpd-2.0.48.tar.gz, and I save it to my user directory. Once the download is complete, the path to the file should be /home/username/httpd-2.0.48.tar.gz. With me so far?

# su -l
(Enter your password to log in as root.)

# mkdir /home/installers
# cp /home/username/httpd-2.0.48.tar.gz /home/installers
# cd /home/installers
# gzip -d httpd-2.0.48.tar.gz
# tar xvf httpd-2.0.48.tar
# cd httpd-2.0.48
# ./configure --enable-mods-shared=all
# make
# make install

That's it! The only difference between this and the "overview for the impatient" is that I enabled modular support, which is needed so that PHP and MySQL will work later.

Now that installation is complete, Apache needs to be configured, using the httpd.conf file. The first thing I usually do is make a copy of the original file so that if I screw up the one I'm making changes to, I can always get back to the beginning if need be.

# cd /usr/local/apache2/conf
# cp httpd.conf httpd.conf.original
# vi httpd.conf

Here are the things that I modify in my httpd.conf file:
Server Admin
DocumentRoot "/web"
<Directory "/web">
Options Indexes FollowSymLinks Includes
AddType text/html .html
AddOutputFilter INCLUDES .html

Obviously, use your own email address. The last three lines make it so that Server Side Include files can be used. Since I usually have include files in every page that I serve up, I don't bother with using .shtml, I just have the server parse every .html file.

Next I create the /web directory and move the default Apache web pages there to test things. Then I start up the webserver.

# mkdir /web
# cd /usr/local/apache2/htdocs
# cp * /web
# cd /usr/local/apache2
# bin/apachectl start

Assuming everything went as planned, the Apache server should now be running.

Open up a browser and type in http:// along with the IP address of the server, and you should see the default Apache installation web page. Congratulations! You're now running a web server with the newest version of the Apache HTTP Server software.

Now, if you want to use (free) database software, you might want to install MySQL.