Installing Apache

Although compiling your own Apache binaries may seem like a bit of work, it’s worth the effort. As you become more familiar with Apache, you will learn that it is the only Web server that provides virtually all (if not more) of the functionalities of a full-blown commercial server, while letting you look at how these functionalities are implemented in the source.

I find this aspect of Apache fascinating. For people who are not C programmers but who still need a powerful, free, Web server, however, playing around with a lot of ANSI C code may not exactly be a favorite pastime. Fortunately, there’s nothing to worry about—Apache comes in both source code and in prebuilt binary packages.

Whenever you obtain free software (source code or binary files) from the Internet, make sure you’re not getting it from an unknown Web or FTP site. What I mean by an unknown can be better understood by use of an example.

Say you want to obtain free Java-based Web browser software developed by Sun Microsystems. You need to be able to do some sort of authenticity check, which is often difficult on the Internet; therefore, you should stick with sites that are widely used.

For example, you don’t want to get it from an FTP site with hostname such as; you should probably look for it somewhere on the site instead, because you can’t be sure that has completely checked the software for any hidden dangers. You get the idea.

Lucky for us, Apache developers and supporters made sure an official place was set up for obtaining Apache software. The official Apache Web site is This site contains the latest stable version of Apache, the latest release version of Apache, patches, contributed Apache modules, and so on.

This is where you want to go for all your Apache needs—although you might be directed to a mirror site that is geographically near you to help cut down on bandwidth and network congestion. You can also use the Pretty Good Privacy (PGP) signatures offered on the site to verify the authenticity of the source code. If you do not know how to use PGP, check out

Apache runs on just about any platform in use today, including Linux; FreeBSD; OpenBSD; NetBSD; BSDI; Amiga OS 3.x; Mac OS X; SunOS; Solaris; IRIX; HPUX; Digital Unix; UnixWare; AIX; SCO; ReliantUNIX; DGUX; OpenStep/Mach; DYNIX/ptx; BeOS; and Windows.

If you are planning on building Apache from source, which is what I highly recommend since compiling your own will give you a very lean and mean server, then you need to make sure that your system meets the requirements.

Before displaying the Powered by Apache logo on your Web server, you want to make sure your Web server has enough “power” to run it. Fortunately, Apache does not require massive computing resources to run. It runs fine on a Linux system with 5 to 12MB of hard disk space and 8MB of RAM.

However, just being able to run Apache is probably not what you had in mind. Most likely, you want to run Apache to serve Web pages, launch CGI processes, and take advantage of all the wonderful stuff that the Web has to offer. In that case, you want disk space and RAM size figures that reflect your load requirements.

You can go about this in two ways: you can ask someone who runs a similar site with Apache and find out what type of system resources they’re using; or, you can try to figure out your realistic needs after you’ve installed Apache on your system.

In the latter case, you can use system utilities such as ps, top, and so on to display memory usage by a particular Apache process. You can then determine the total memory needed by multiplying a single process’s memory usage by the total number of Apache processes that will be running at peak hours.

This should give you a reasonable estimate of your site’s RAM requirements for Apache. If you plan to run several CGI programs on your Apache server, you have to determine memory usage for these programs as well, and take this additional need into account.

One of the ways you can determine your CGI program memory requirements is run the CGI program and use the top utility to watch how much memory it uses and then multiply that amount of memory by the number of CGI requests you need to be able to fulfill simultaneously.

The disk requirements for Apache source or binary files shouldn’t be a concern with most systems because Apache binaries take no more than 1MB of space and the source file is about 5MB. You should really pay attention, however, to the log files that Apache creates, because each log entry takes up approximately 80 bytes of disk space.

If you expect to get about 100,000 hits in a day, for example, your Apache access log file may be 8,000,000 bytes. Finally, consider whether you have appropriate bandwidth for running a Web server. Estimating bandwidth requirement is not an easy task but you can come up with ballpark figures by doing a bit of math.

Before you download the Apache software for the first time, you should note a few things. There’s a good chance that you will find two versions of Apache available: one is an official release version, and one is a beta release version that has the latest code and features.

For example, if you see an Apache version 2.0.2 and a version called 2.3b3, then the first version is an official release and the second is a beta version. A third beta such as 2.3b3 (2.3b1 and 2.3b2 came before it) is likely to be stable, but using a beta version is not recommended for a production Web server. To download the version you want, go to

This is the distribution directory of the Apache software. Here, you will find both the release and the beta versions of the software in multiple compression packages. For example:

httpd_2.0.4.tar.Z httpd_2.0.4.tar.gz httpd_2.3b3.tar.gz httpd_2.3b3_win32.exe

These are a few examples of the various types of compression formats that are used to distribute source code. You need to choose the compression format that your system can handle (in other words, make sure you have a utility to decompress the code).

Typically with Linux, all you need are the tar, gnuzip, or gzip utilities to decompress the files. For example, to decompress the httpd_version. tar.gz file (where version is whatever version you have downloaded such as 2.0.4) on a Linux system, you use the tar xvzf httpd_version.tar.gz command.

You could also use the gzip -d httpd_version.tar.gz ; tar xvf httpd_version. tar command, which will decompress and extract all the files in a subdirectory while keeping the relative path for each file intact. Self-extracting compressed files are usually created for the Windows version of Apache. Any such file can be extracted by simply running the downloaded file.

The binaries are usually kept in a different directory where each operating system has a subdirectory of its own. Note that if your operating system does not appear in the binaries directory, this does not necessarily mean the operating system is not supported.

All it means is that no one in the Apache development group or contribution groups have compiled a binary file for your system yet. You are likely to find binaries for the Linux, FreeBSD, Solaris, NetBSD, OS2, AIX, Ultrix, HPUX, and IRIX systems.