install.html.en revision 21ee8872f078d5a8dc90d67152b24a355a45cc07
842ae4bd224140319ae7feec1872b93dfd491143fielding<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding BGCOLOR="#FFFFFF"
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd TEXT="#000000"
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd LINK="#0000FF"
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd VLINK="#000080"
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd ALINK="#FF0000"
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<!--#include virtual="header.html" -->
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>This document covers compilation and installation of Apache on Unix
43c3e6a4b559b76b750c245ee95e2782c15b4296jimand Unix-like systems only. For compiling and installation on Windows,
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingsee <A HREF="platform/windows.html">Using Apache with Microsoft
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>Apache 2.0's configuration and installation environment has changed
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingcompletely from Apache 1.3. Apache 1.3 used a custom set of scripts
1ccd992d37d62c8cb2056126f2234f64ec189bfddougmto achieve easy installation. Apache 2.0 now uses libtool and
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingautoconf to create an environment that looks like many other Open
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingSource projects.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<td><code>$ lynx http://www.apache.org/dist/httpd/httpd-2_0_<em>NN</em>.tar.gz
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<td><code>$ gzip -d httpd-2_0_<em>NN</em>.tar.gz<br>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p><em>NN</em> must be replaced with the current minor version number,
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingand <em>PREFIX</em> must be replaced with the filesystem path under
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingwhich the server should be installed. If <em>PREFIX</em> is not
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingspecified, it defaults to <code>/usr/local/apache2</code>.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>Each section of the compilation and installation process is
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingdescribed in more detail below, beginning with the requirements
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingfor compiling and installing Apache HTTPD.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>The following requirements exist for building Apache:</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<li>Disk Space<br><br> Make sure you have at least 50 MB of temporary
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingfree disk space available. After installation Apache occupies
1ccd992d37d62c8cb2056126f2234f64ec189bfddougmapproximately 10 MB of disk space. The actual disk space requirements
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingwill vary considerably based on your chosen configuration options and
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<li>ANSI-C Compiler and Build System<br><br> Make sure you have an
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingANSI-C compiler installed. The <a
1ccd992d37d62c8cb2056126f2234f64ec189bfddougmhref="http://www.gnu.org/software/gcc/gcc.html">GNU C compiler
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding(GCC)</a> from the <a href="http://www.gnu.org/">Free Software
e8f95a682820a599fe41b22977010636be5c2717jimFoundation (FSF)</a> is recommended (version 2.7.2 is fine). If you
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingdon't have GCC then at least make sure your vendors compiler is ANSI
1ccd992d37d62c8cb2056126f2234f64ec189bfddougmcompliant. In addition, your <code>PATH</code> must contain basic
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<li>Accurate time keeping<br><br> Elements of the HTTP protocol are
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingexpressed as the time of day. So, it's time to investigate setting
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingsome time synchronization facility on your system. Usually the ntpdate
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingor xntpd programs are used for this purpose which are based on the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingNetwork Time Protocol (NTP). See the Usenet newsgroup <a
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldinghref="news:comp.protocols.time.ntp">comp.protocols.time.ntp</a> and
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingthe <a href="http://www.eecis.udel.edu/~ntp/">NTP homepage</a> for more
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingdetails about NTP software and public time servers.<br><br></li>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<li><a href="http://www.perl.org/">Perl 5</a> [OPTIONAL]<br><br> For
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingsome of the support scripts like <a href="programs/apxs.html">apxs</a>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingor <a href="programs/dbmmanage.html">dbmmanage</a> (which are written
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingin Perl) the Perl 5 interpreter is required (versions 5.003 and 5.004
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingare fine). If no such interpreter is found by the `configure' script
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingthere is no harm. Of course, you still can build and install Apache
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding2.0. Only those support scripts cannot be used. If you have multiple
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingPerl interpreters installed (perhaps a Perl 4 from the vendor and a
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingPerl 5 from your own), then it is recommended to use the --with-perl
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingoption (see below) to make sure the correct one is selected by
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldinghref="http://www.apache.org/dist/httpd/">Apache Software Foundation
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldinghref="http://www.apache.org/dyn/closer.cgi">nearby mirror</a>.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>Version numbers that end in <code>alpha</code> indicate early
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingpre-test versions which may or may not work. Version numbers ending
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingin <code>beta</code> indicate more reliable releases that still
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingrequire further testing or bug fixing. If you wish to dowload the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingbest available production release of the Apache HTTP Server, you
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingshould choose the latest version with neither <code>alpha</code> nor
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>After downloading, especially if a mirror site is used, it is
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingimportant to verify that you have a complete and unmodified version
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingof the Apache HTTP Server. This can be accomplished by testing the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingdownloaded tarball against the PGP signature, which should always be
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingobtained from the <a href="http://www.apache.org/dist/httpd">main
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingApache website</a>. The signature file has a filename identical to
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingthe source tarball with the addition of <code>.asc</code>.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>Extracting the source from the Apache HTTPD tarball is a simple
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingmatter of uncompressing, and then untarring:</p>
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<p>This will create a new directory under the current directory
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingcontaining the source code for the distribution. You should
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<code>cd</code> into that directory before proceeding with
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingcompiling the server.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<h3><a name="configure">Configuring the source tree</a></h3>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>The next step is to configure the Apache source tree for your
43c3e6a4b559b76b750c245ee95e2782c15b4296jimparticular platform and personal requirements. This is done using the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingscript <code>configure</code> included in the root directory of the
43c3e6a4b559b76b750c245ee95e2782c15b4296jimdistribution. (Developers downloading the CVS version of the Apache
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingsource tree will need to have <code>autoconf</code> and
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<code>buildconf</code> before proceeding with the next steps. This is
43c3e6a4b559b76b750c245ee95e2782c15b4296jimnot necessary for official releases.)</p>
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<p>To configure the source tree using all the default options, simply
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingtype <code>/configure</code>. To change the default options,
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<code>configure</code> accepts a variety of variables and command line
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingoptions. Environment variables are generally placed before the
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<code>/configure</code> command, while other options are placed
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingafter. The most important option here is the location prefix where
43c3e6a4b559b76b750c245ee95e2782c15b4296jimApache is to be installed later, because Apache has to be configured
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingfor this location to work correctly. But there are a lot of other
43c3e6a4b559b76b750c245ee95e2782c15b4296jimoptions available for your pleasure.</p>
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<p>For a short impression of what possibilities you have, here is a
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingtypical example which compiles Apache for the installation tree
43c3e6a4b559b76b750c245ee95e2782c15b4296jim/sw/pkg/apache with a particular compiler and flags plus the two
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingadditional modules mod_rewrite and mod_speling for later loading
43c3e6a4b559b76b750c245ee95e2782c15b4296jimthrough the DSO mechanism:</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding $ CC="pgcc" CFLAGS="-O2" \<br>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding --enable-rewrite=shared \<br>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding --enable-speling=shared
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>When configure is run it will take several minutes to test for
43c3e6a4b559b76b750c245ee95e2782c15b4296jimthe availability of features on your system and build Makefiles
43c3e6a4b559b76b750c245ee95e2782c15b4296jimwhich will later be used to compile the server.</p>
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding<p>The easiest way to find all of the configuration flags for Apache
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingis to run /configure --help. What follows is a brief description
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingof most of the arguments and environment variables.</p>
43c3e6a4b559b76b750c245ee95e2782c15b4296jim<p>The autoconf build process uses several environment variables to
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingconfigure the build environment. In general, these variables change
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingthe method used to build Apache, but not the eventual features of the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingserver. These variables can be placed in the environment before
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldinginvoking <code>configure</code>, but it is usually easier to specify
43c3e6a4b559b76b750c245ee95e2782c15b4296jimthem on the <code>configure</code> command line as demonstrated
43c3e6a4b559b76b750c245ee95e2782c15b4296jimin the example above.</p>
href="mod/module-dict.html#ModuleIdentifier"
http://localhost/ (when you built and installed Apache as root) or
http://localhost:8080/ (when you built and installed Apache as a
<!--#include virtual="footer.html" -->