Learn the basic steps necessary to download, install, and configure a basic Apache server. This article is from chapter two of Pro Apache by Peter Wainwright. (Apress, 2004, ISBN: 1590593006).
This section investigates the various options available for installing Apache. In many cases, you may be lucky enough to have it installed already, in which case you can skip straight to basic configuration. However, you’ll want to upgrade the installation from time to time to take advantage of new features or close the door on an old bug, so knowing how to install Apache will be a useful skill sooner or later.
Getting Apache
The primary source for downloading Apache is http://httpd.apache.org/, the ASF project page for the HTTP server. You can also reach this via the foundation’s home page at http://www.apache.org/. The Apache home page is understandably busy and provides links to several international mirrors where you have the option to download the software from a closer location.
Apache releases appear in two basic forms—binary and source—for several operating systems. The binary releases are prebuilt, ready to install. They also include a copy of the source code, so you can customize, rebuild, and then reinstall it. From Apache 2 onward, binary distributions also ship with all modules that are capable of being configured as external modules.
The source release contains only the source code, which you must build to create an installable Apache. Building from source can be very rewarding, both for the benefits conveyed by building Apache on your own hardware and for the satisfaction of knowing that you really do have complete control over the server. The source code comes with a configuration script (configure) that takes away most of the hard work of setting up Apache and also examines the system to determine the best way to build Apache for maximum performance. Chapter 3 covers this in detail.
In addition to releases from the Apache Web site, many operating systems provide prebuilt packages from their own Web sites. These are designed to set up Apache on the given platform in a more official file system location (on Unix systems, /etc/httpd or /opt/httpd rather than /usr/local/apache, for example). They usually also install startup and shutdown scripts, so Apache will automatically start and stop with the operating system. These packages also make upgrading the server easy and often integrate with other vendor-specific features such as online Help.
Most Linux- and BSD-based operating systems offer Apache as an easily installable package. Apache is also shipped, by default, with Apple’s MacOS X operating system, and aside from a customized layout, Apache on MacOS X/Darwin is the same as Apache on any other Unix operating system.
Though Windows doesn’t ship with Apache, installable packages for Windows are available directly from the Apache Web site and its mirrors. You can download all Apache installations from http://www.apache.org/dist/httpd/binaries/win32/. The installation file for the Windows version of Apache carries the extension .msi; this is a Microsoft installer file. The Apache source is available in a .zip file and may be downloaded and compiled using the Microsoft Visual C++ compiler.
A seemingly obvious place to find Apache is on magazine cover CDs and bundled with books. But these origins should be treated with some suspicion because there’s almost always a more recent release on the Apache Web site. For all practical purposes, it’s as easy to download a fresh and up-to-date copy as it is to extract one from a CD. Therefore, there’s rarely a good reason to install Apache from such a source; the number of people who need to install Apache but don’t have a network connection to download it is rather small.
At any given time, Apache is available as a stable release and as a development beta release. The status of both versions is available from the news page, along with any major updates or fixes that were dealt with in the most recent release.
You also have the choice of downloading either Apache 1.3 or Apache 2. Although Apache 2 has been available for a while now, Apache 1.3 can still be a good choice in some situations, particularly for administrators who are already running an existing Apache 1.3 server and don’t want to migrate to Apache 2 until it has been deployed more widely. Whichever version you choose, you should heed the warnings and download a beta release only if you’re willing to endure the possibility of unexpected bugs and unreliable behavior and need access to a feature not yet available in the stable release.
Up until Apache 2, source code for experimental features has been bundled together with source code for stable ones in each new release. Binary distributions are ordinarily built only from the stable features, with experimental ones added if you ask for them. From Apache 2.2 onward this will change: The 2.2 release will contain only the current stable release, with no experimental features even as options, but 2.3 will contain all developmental code. Ultimately, 2.4 will be released as the next stable release, with 2.5 becoming the next developmental release, in a similar manner to the Linux kernel, Perl, and other projects.
You can find a rundown of new Apache 2 features and upgrade tips for Apache 1.3 administrators at http://httpd.apache.org/docs-2.0/upgrading.html. This page is also distributed as part of the Apache package, which is under /manual/upgrading.html in a fresh local Apache installation.
This chapter is from Pro Apache by Peter Wainwright. (Apress, 2004, ISBN: 1590593006). Check it out at your favorite bookstore today. Buy this book now.