Binary distributions are archived copies of the compiled Apache source and contain a complete Apache server, all supporting scripts and configuration files, a complete copy of the source code, and an installation script to install the server into the desired location. They don’t, however, contain scripts to automatically start and stop Apache with the operating system.
Distributions are available for several variants of Unix, OS/2, Netware, BeOS, and MacOS X from the Apache home page at http://www.apache.org/dist/httpd/binaries/. Refer to the “Installing Apache from Prebuilt Packages” section for more information.
NOTE Linux administrators will find packages under the linux subdirectory, and you can find Solaris packages similarly under solaris. MacOS X administrators will also find distributions for MacOS X/Darwin—the darwin and macosx subdirectories have the same contents, so either will do—as well as MacOS X Server/Rhapsody, similarly in macosxserver or rhapsody .Windows packages for Windows 9x ,ME, NT, 2000, and XP are also available from this location. Both self-installing and Windows installer packages are available, but these aren’t basic binary distributions as described here.
On platforms for which binary distributions are available, you can download and install Apache with only a few steps.
Using Unix as an example, first download either the compress archive (suffix .Z) or the gzip archive (suffix .gz). For other platforms, such as OS/2, you may also find a ZIP archive available. Because gzipped archives are compressed more efficiently than compressed ones, you should get the gzip archive if you have gzip available to decompress it. If you don’t, this might be a good time to install it.
Once the archive is downloaded, unpack it:
$ gunzip apache_1.3.28-i686-whatever-linux22.tar.gz $ tar xvf apache_1.3.28-i686-whatever-linux22.tar
This archive is for a Linux server, kernel version 2.2 or higher, running on a machine with at least an Intel Pentium II processor. Archives for other platforms are named appropriately in the relevant platform subdirectory. When a platform is available for more than one processor architecture, as Linux is, be careful to download the correct binary distribution—a Sparc or Alpha distribution is of little use to an Intel server, for example.
You can also extract the archive in one step, leaving the archive in a compressed state to conserve disk space:
$ gunzip -c apache_1.3.28-i686-whatever-linux22.tar.gz | tar xvf -
On systems with the GNU version of tar, which includes all Linux and BSD platforms, you can also extract the archive in one step (note the extra z in zxvf to signify that the archive is compressed):
$ tar zxvf apache_1.3.28-i686-whatever-linux22.tar.gz
On systems that don’t have gzip installed, download the .Z archive and use the standard Unix uncompress utility instead:
This is actually the most complex part of the process. Once the archive is unpacked, go into the newly created Apache directory:
$ cd apache_1.3.28
Then run the included installation script:
If you want to install Apache somewhere other than /usr/local/apache, give the installation script the path you want to use, for example:
$ ./install-bindist.sh /home/httpd/
This should produce a working Apache installation in the desired location. If you’re installing on a Unix server and want to install into a standard system location, you’ll need to have root privileges to perform this step. After the installation is complete, you may remove both the archive and the unpacked archive directory. You’re now ready to configure Apache.
An interesting point of binary distributions is that you can create them yourself, using the source distribution. This allows you to create a fully customized server that matches your needs and then distribute it yourself. The created binary distribution is the same as the standard distribution in all respects except for the customizations you make.
NOTE Creating and installing your own binary distribution is covered in Chapter 3.
Installing Apache from Source
As mentioned, you can also download Apache source distributions from the official Apache site. They’re located in http://www.apache.org /dist/httpd/ and come in either ZIP format (.zip) or gzip format (.gz).
Again, mirrors exist, and you should use the mirror closest to you—note that choosing the Download from a Mirror link from the main site should select a suitable mirror automatically. Once downloaded, the source can be compiled using Microsoft Visual C++ compiler on Windows and gcc on most other platforms. This is the major subject of Chapter 3, so I’ll not dwell on it further here.
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.