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