]> granicus.if.org Git - apache/blob - docs/manual/install.html.en
mod_reqtimeout: Change the default to set some reasonable timeout values if loaded
[apache] / docs / manual / install.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>Compiling and Installing - Apache HTTP Server</title>
9 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.3</p>
16 <img alt="" src="./images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="./images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Compiling and Installing</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
22 <a href="./en/install.html" title="English">&nbsp;en&nbsp;</a> |
23 <a href="./es/install.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
24 <a href="./fr/install.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
25 <a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
26 <a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
27 <a href="./tr/install.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
28 </div>
29
30
31     <p>This document covers compilation and installation of the Apache HTTP Server
32     on Unix and Unix-like systems only. For compiling and
33     installation on Windows, see <a href="platform/windows.html">Using Apache HTTP Server with Microsoft
34     Windows</a>. For other platforms, see the <a href="platform/">platform</a> documentation.</p>
35
36     <p>Apache httpd uses <code>libtool</code> and <code>autoconf</code>
37     to create a build environment that looks like many other Open Source
38     projects.</p>
39
40     <p>If you are upgrading from one minor version to the next (for
41     example, 2.2.50 to 2.2.51), please skip down to the <a href="#upgrading">upgrading</a> section.</p>
42
43 </div>
44 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Overview for the
45     impatient</a></li>
46 <li><img alt="" src="./images/down.gif" /> <a href="#requirements">Requirements</a></li>
47 <li><img alt="" src="./images/down.gif" /> <a href="#download">Download</a></li>
48 <li><img alt="" src="./images/down.gif" /> <a href="#extract">Extract</a></li>
49 <li><img alt="" src="./images/down.gif" /> <a href="#configure">Configuring the source tree</a></li>
50 <li><img alt="" src="./images/down.gif" /> <a href="#compile">Build</a></li>
51 <li><img alt="" src="./images/down.gif" /> <a href="#install">Install</a></li>
52 <li><img alt="" src="./images/down.gif" /> <a href="#customize">Customize</a></li>
53 <li><img alt="" src="./images/down.gif" /> <a href="#test">Test</a></li>
54 <li><img alt="" src="./images/down.gif" /> <a href="#upgrading">Upgrading</a></li>
55 <li><img alt="" src="./images/down.gif" /> <a href="#thirdp">Third-party packages</a></li>
56 </ul><h3>See also</h3><ul class="seealso"><li><a href="programs/configure.html">Configure the source tree</a></li><li><a href="invoking.html">Starting Apache httpd</a></li><li><a href="stopping.html">Stopping and Restarting</a></li></ul></div>
57 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
58 <div class="section">
59 <h2><a name="overview" id="overview">Overview for the
60     impatient</a></h2>
61
62     <table>
63       
64       <tr>
65         <td><a href="#download">Download</a></td>
66
67         <td><code>$ lynx http://httpd.apache.org/download.cgi</code>
68         </td>
69       </tr>
70
71       <tr>
72         <td><a href="#extract">Extract</a></td>
73
74         <td><code>$ gzip -d httpd-<em>NN</em>.tar.gz<br />
75          $ tar xvf httpd-<em>NN</em>.tar<br />
76          $ cd httpd-<em>NN</em></code></td>
77       </tr>
78
79       <tr>
80         <td><a href="#configure">Configure</a></td>
81
82         <td><code>$ ./configure --prefix=<em>PREFIX</em></code>
83         </td>
84       </tr>
85
86       <tr>
87         <td><a href="#compile">Compile</a></td>
88
89         <td><code>$ make</code> </td>
90       </tr>
91
92       <tr>
93         <td><a href="#install">Install</a></td>
94
95         <td><code>$ make install</code> </td>
96       </tr>
97
98       <tr>
99         <td><a href="#customize">Customize</a></td>
100
101         <td><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code> </td>
102       </tr>
103
104       <tr>
105         <td><a href="#test">Test</a></td>
106
107         <td><code>$ <em>PREFIX</em>/bin/apachectl -k start</code>
108         </td>
109       </tr>
110     </table>
111
112     <p><em>NN</em> must be replaced with the current version
113     number, and <em>PREFIX</em> must be replaced with the
114     filesystem path under which the server should be installed. If
115     <em>PREFIX</em> is not specified, it defaults to
116     <code>/usr/local/apache2</code>.</p>
117
118     <p>Each section of the compilation and installation process is
119     described in more detail below, beginning with the requirements
120     for compiling and installing Apache httpd.</p>
121 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
122 <div class="section">
123 <h2><a name="requirements" id="requirements">Requirements</a></h2>
124
125     <p>The following requirements exist for building Apache httpd:</p>
126
127     <dl>
128       <dt>Disk Space</dt>
129       <dd>Make sure you have at least 50 MB of temporary free disk
130       space available. After installation the server occupies
131       approximately 10 MB of disk space. The actual disk space
132       requirements will vary considerably based on your chosen
133       configuration options, any third-party modules, and, of course,
134       the size of the web site or sites that you have on the server.</dd>
135
136       <dt>ANSI-C Compiler and Build System</dt>
137       <dd>Make sure you have an ANSI-C compiler installed. The <a href="http://gcc.gnu.org/">GNU C
138       compiler (GCC)</a> from the <a href="http://www.gnu.org/">Free Software Foundation (FSF)</a>
139       is recommended. If you don't have GCC
140       then at least make sure your vendor's compiler is ANSI
141       compliant. In addition, your <code>PATH</code> must contain
142       basic build tools such as <code>make</code>.</dd>
143
144       <dt>Accurate time keeping</dt>
145       <dd>Elements of the HTTP protocol are expressed as the time of
146       day. So, it's time to investigate setting some time
147       synchronization facility on your system. Usually the
148       <code>ntpdate</code> or <code>xntpd</code> programs are used for
149       this purpose which are based on the Network Time Protocol (NTP).
150       See the <a href="http://www.ntp.org">NTP
151       homepage</a> for more details about NTP software and public
152       time servers.</dd>
153
154       <dt><a href="http://www.perl.org/">Perl 5</a>
155       [OPTIONAL]</dt>
156       <dd>For some of the support scripts like <code class="program"><a href="./programs/apxs.html">apxs</a></code> or <code class="program"><a href="./programs/dbmmanage.html">dbmmanage</a></code> (which are
157       written in Perl) the Perl 5 interpreter is required (versions
158       5.003 or newer are sufficient). If you have multiple Perl
159       interpreters (for example, a systemwide install of Perl 4, and
160       your own install of Perl 5), you are advised to use the
161       <code>--with-perl</code> option (see below) to make sure the
162       correct one is used by <code class="program"><a href="./programs/configure.html">configure</a></code>.
163       If no Perl 5 interpreter is found by the
164       <code class="program"><a href="./programs/configure.html">configure</a></code> script, you will not be able to use
165       the affected support scripts. Of course, you will still be able to
166       build and use Apache httpd.</dd>
167     </dl>
168 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
169 <div class="section">
170 <h2><a name="download" id="download">Download</a></h2>
171
172     <p>The Apache HTTP Server can be downloaded from the <a href="http://httpd.apache.org/download.cgi">Apache HTTP Server
173     download site</a>, which lists several mirrors.  Most users of
174     Apache on unix-like systems will be better off downloading and
175     compiling a source version.  The build process (described below) is
176     easy, and it allows you to customize your server to suit your needs.
177     In addition, binary releases are often not up to date with the latest
178     source releases.  If you do download a binary, follow the instructions
179     in the <code>INSTALL.bindist</code> file inside the distribution.</p>
180
181     <p>After downloading, it is important to verify that you have a
182     complete and unmodified version of the Apache HTTP Server. This
183     can be accomplished by testing the downloaded tarball against the
184     PGP signature.  Details on how to do this are available on the <a href="http://httpd.apache.org/download.cgi#verify">download
185     page</a> and an extended example is available describing the <a href="http://httpd.apache.org/dev/verification.html">use of
186     PGP</a>.</p>
187
188 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
189 <div class="section">
190 <h2><a name="extract" id="extract">Extract</a></h2>
191
192     <p>Extracting the source from the Apache HTTP Server tarball is a
193     simple matter of uncompressing, and then untarring:</p>
194
195 <div class="example"><p><code>
196 $ gzip -d httpd-<em>NN</em>.tar.gz<br />
197 $ tar xvf httpd-<em>NN</em>.tar
198 </code></p></div>
199
200     <p>This will create a new directory under the current directory
201     containing the source code for the distribution. You should
202     <code>cd</code> into that directory before proceeding with
203     compiling the server.</p>
204 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
205 <div class="section">
206 <h2><a name="configure" id="configure">Configuring the source tree</a></h2>
207
208     <p>The next step is to configure the Apache source tree for your
209     particular platform and personal requirements. This is done using
210     the script <code class="program"><a href="./programs/configure.html">configure</a></code> included in
211     the root directory of the distribution. (Developers downloading
212     an unreleased version of the Apache source tree will need to have
213     <code>autoconf</code> and <code>libtool</code> installed and will
214     need to run <code>buildconf</code> before proceeding with the next
215     steps. This is not necessary for official releases.)</p>
216
217     <p>To configure the source tree using all the default options,
218     simply type <code>./configure</code>. To change the default
219     options, <code class="program"><a href="./programs/configure.html">configure</a></code> accepts a variety of variables
220     and command line options.</p>
221
222     <p>The most important option is the location <code>--prefix</code>
223     where Apache is to be installed later, because Apache has to be
224     configured for this location to work correctly.  More fine-tuned
225     control of the location of files is possible with additional <a href="programs/configure.html#installationdirectories">configure
226     options</a>.</p>
227
228     <p>Also at this point, you can specify which <a href="programs/configure.html#optionalfeatures">features</a> you
229     want included in Apache by enabling and disabling <a href="mod/">modules</a>.  Apache comes with a wide range of modules
230     included by default.  They will be compiled as
231     <a href="dso.html">shared objects (DSOs)</a> which can be loaded
232     or unloaded at runtime.
233     You can also choose to compile modules statically by using the option
234     <code>--enable-<var>module</var>=static</code>.</p>
235
236     <p>Additional modules are enabled using the
237     <code>--enable-<var>module</var></code> option, where
238     <var>module</var> is the name of the module with the
239     <code>mod_</code> string removed and with any underscore converted
240     to a dash.  Similarly, you can disable modules with the
241     <code>--disable-<var>module</var></code> option.  Be careful when
242     using these options, since <code class="program"><a href="./programs/configure.html">configure</a></code> cannot warn you
243     if the module you specify does not exist; it will simply ignore the
244     option.</p>
245
246     <p>In addition, it is sometimes necessary to provide the
247     <code class="program"><a href="./programs/configure.html">configure</a></code> script with extra information about the
248     location of your compiler, libraries, or header files.  This is
249     done by passing either environment variables or command line
250     options to <code class="program"><a href="./programs/configure.html">configure</a></code>.  For more information, see the
251     <code class="program"><a href="./programs/configure.html">configure</a></code> manual page. Or invoke
252     <code class="program"><a href="./programs/configure.html">configure</a></code> using the <code>--help</code> option.</p>
253
254     <p>For a short impression of what possibilities you have, here
255     is a typical example which compiles Apache for the installation
256     tree <code>/sw/pkg/apache</code> with a particular compiler and flags
257     plus the two additional modules <code class="module"><a href="./mod/mod_ldap.html">mod_ldap</a></code> and
258     <code class="module"><a href="./mod/mod_lua.html">mod_lua</a></code>:</p>
259
260 <div class="example"><p><code>
261       $ CC="pgcc" CFLAGS="-O2" \<br />
262        ./configure --prefix=/sw/pkg/apache \<br />
263        --enable-ldap=shared \<br />
264        --enable-lua=shared
265 </code></p></div>
266
267     <p>When <code class="program"><a href="./programs/configure.html">configure</a></code> is run it will take several minutes to
268     test for the availability of features on your system and build
269     Makefiles which will later be used to compile the server.</p>
270
271     <p>Details on all the different <code class="program"><a href="./programs/configure.html">configure</a></code> options are
272     available on the <code class="program"><a href="./programs/configure.html">configure</a></code> manual page.</p>
273 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
274 <div class="section">
275 <h2><a name="compile" id="compile">Build</a></h2>
276
277     <p>Now you can build the various parts which form the Apache
278     package by simply running the command:</p>
279
280 <div class="example"><p><code>$ make</code></p></div>
281
282     <p>Please be patient here, since a base configuration takes
283     several minutes to compile and the time will vary widely
284     depending on your hardware and the number of modules that you
285     have enabled.</p>
286 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
287 <div class="section">
288 <h2><a name="install" id="install">Install</a></h2>
289
290     <p>Now it's time to install the package under the configured
291     installation <em>PREFIX</em> (see <code>--prefix</code> option
292     above) by running:</p>
293
294 <div class="example"><p><code>$ make install</code></p></div>
295
296     <p>This step will typically require root privileges, since
297     <em>PREFIX</em> is usually a directory with restricted write
298     permissions.</p>
299
300     <p>If you are upgrading, the installation will not overwrite
301     your configuration files or documents.</p>
302 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
303 <div class="section">
304 <h2><a name="customize" id="customize">Customize</a></h2>
305
306     <p>Next, you can customize your Apache HTTP server by editing
307     the <a href="configuring.html">configuration files</a> under
308     <code><em>PREFIX</em>/conf/</code>.</p>
309
310 <div class="example"><p><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code></p></div>
311
312     <p>Have a look at the Apache manual under
313     <code><em>PREFIX</em>/docs/manual/</code> or consult <a href="http://httpd.apache.org/docs/trunk/">http://httpd.apache.org/docs/trunk/</a> for the most recent
314     version of this manual and a complete reference of available <a href="mod/directives.html">configuration directives</a>.</p>
315 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
316 <div class="section">
317 <h2><a name="test" id="test">Test</a></h2>
318
319     <p>Now you can <a href="invoking.html">start</a> your Apache
320     HTTP server by immediately running:</p>
321
322 <div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k start</code></p></div>
323
324     <p>You should then be able to request your first document
325     via the URL <code>http://localhost/</code>. The web page you see is located
326     under the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>,
327     which will usually be <code><em>PREFIX</em>/htdocs/</code>.
328     Then <a href="stopping.html">stop</a> the server again by
329     running:</p>
330
331 <div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k stop</code></p></div>
332 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
333 <div class="section">
334 <h2><a name="upgrading" id="upgrading">Upgrading</a></h2>
335
336     <p>The first step in upgrading is to read the release announcement
337     and the file <code>CHANGES</code> in the source distribution to
338     find any changes that may affect your site.  When changing between
339     major releases (for example, from 2.0 to 2.2 or from 2.2 to 2.3),
340     there will likely be major differences in the compile-time and
341     run-time configuration that will require manual adjustments.  All
342     modules will also need to be upgraded to accomodate changes in the
343     module API.</p>
344
345     <p>Upgrading from one minor version to the next (for example, from
346     2.2.55 to 2.2.57) is easier.  The <code>make install</code>
347     process will not overwrite any of your existing documents, log
348     files, or configuration files.  In addition, the developers make
349     every effort to avoid incompatible changes in the
350     <code class="program"><a href="./programs/configure.html">configure</a></code> options, run-time configuration, or the
351     module API between minor versions.  In most cases you should be able to
352     use an identical <code class="program"><a href="./programs/configure.html">configure</a></code> command line, an identical
353     configuration file, and all of your modules should continue to
354     work.</p>
355
356     <p>To upgrade across minor versions, start by finding the file
357     <code>config.nice</code> in the <code>build</code> directory of
358     your installed server or at the root of the source tree for your
359     old install.  This will contain the exact
360     <code class="program"><a href="./programs/configure.html">configure</a></code> command line that you used to
361     configure the source tree.  Then to upgrade from one version to
362     the next, you need only copy the <code>config.nice</code> file to
363     the source tree of the new version, edit it to make any desired
364     changes, and then run:</p>
365
366     <div class="example"><p><code>
367     $ ./config.nice<br />
368     $ make<br />
369     $ make install<br />
370     $ <em>PREFIX</em>/bin/apachectl -k graceful-stop<br />
371     $ <em>PREFIX</em>/bin/apachectl -k start<br />
372     </code></p></div>
373
374     <div class="warning">You should always test any new version in your
375     environment before putting it into production.  For example, you
376     can install and run the new version along side the old one by
377     using a different <code>--prefix</code> and a
378     different port (by adjusting the <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> directive) to test for any
379     incompatibilities before doing the final upgrade.</div>
380
381     <p>You can pass additional arguments to <code>config.nice</code>,
382     which will be appended to your original <code class="program"><a href="./programs/configure.html">configure</a></code>
383     options:</p>
384
385     <div class="example"><p><code>
386     $ ./config.nice --prefix=/home/test/apache --with-port=90
387     </code></p></div>
388 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
389 <div class="section">
390 <h2><a name="thirdp" id="thirdp">Third-party packages</a></h2>
391
392     <p>A large number of third parties provide their own packaged
393     distributions of the Apache HTTP Server for installation on
394     particular platforms. This includes the various Linux distributions,
395     various third-party Windows packages, Mac OS X, Solaris, and many
396     more.</p>
397
398     <p>Our software license not only permits, but encourages, this kind
399     of redistribution. However, it does result in a situation where the
400     configuration layout and defaults on your installation of the server
401     may differ from what is stated in the documentation. While
402     unfortunate, this situation is not likely to change any time
403     soon.</p>
404
405     <p>A <a href="http://wiki.apache.org/httpd/DistrosDefaultLayout">description
406     of these third-party distrubutions</a> is maintained in the HTTP
407     Server wiki, and should reflect the current state of these
408     third-party distributions. However, you will need to familiarize
409     yourself with your particular platform's package management and
410     installation procedures.</p>
411
412 </div></div>
413 <div class="bottomlang">
414 <p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
415 <a href="./en/install.html" title="English">&nbsp;en&nbsp;</a> |
416 <a href="./es/install.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
417 <a href="./fr/install.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
418 <a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
419 <a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
420 <a href="./tr/install.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
421 </div><div id="footer">
422 <p class="apache">Copyright 2011 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
423 <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div>
424 </body></html>