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