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
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.2</p>
16
<img alt="" src="./images/feather.gif" /></div>
17
<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
19
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.2</a></div><div id="page-content"><div id="preamble"><h1>Compiling and Installing</h1>
21
<p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
22
<a href="./en/install.html" title="English"> en </a> |
23
<a href="./es/install.html" hreflang="es" rel="alternate" title="Espa�ol"> es </a> |
24
<a href="./fr/install.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
25
<a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
26
<a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
30
<p>This document covers compilation and installation of the Apache HTTP
31
Server on Unix and Unix-like systems only. For compiling and
32
installation on Windows, see <a href="platform/windows.html">Using Apache HTTPd with Microsoft
33
Windows</a>. For other platforms, see the <a href="platform/">platform</a> documentation.</p>
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
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>
43
<div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Overview for the
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 the Apache HTTP Server</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>
57
<h2><a name="overview" id="overview">Overview for the
63
<td><a href="#download">Download</a></td>
65
<td><code>$ lynx http://httpd.apache.org/download.cgi</code>
70
<td><a href="#extract">Extract</a></td>
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>
78
<td><a href="#configure">Configure</a></td>
80
<td><code>$ ./configure --prefix=<em>PREFIX</em></code>
85
<td><a href="#compile">Compile</a></td>
87
<td><code>$ make</code> </td>
91
<td><a href="#install">Install</a></td>
93
<td><code>$ make install</code> </td>
97
<td><a href="#customize">Customize</a></td>
99
<td><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code> </td>
103
<td><a href="#test">Test</a></td>
105
<td><code>$ <em>PREFIX</em>/bin/apachectl -k start</code>
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>
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 HTTP Server.</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>
123
<p>The following requirements exist for building Apache HTTPd:</p>
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>
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>
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
151
<dt><a href="http://www.perl.org/">Perl 5</a>
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>
165
<dt><a href="http://apr.apache.org">apr/apr-util >= 1.2</a></dt>
166
<dd><code>apr</code> and <code>apr-util</code> are bundled
167
with the Apache HTTPd source releases, and will be used without any
168
problems in almost all circumstances. However, if
169
<code>apr</code> or <code>apr-util</code>, versions 1.0 or 1.1,
170
are installed on your system, you must either upgrade your
171
<code>apr</code>/<code>apr-util</code> installations to
172
1.2, or have httpd use seperate builds. To use the bundled
173
<code>apr</code>/<code>apr-util</code> sources for this
174
purpose you must install them manually:
175
<div class="example"><p><code>
176
# Build and install apr 1.2<br />
178
./configure --prefix=/usr/local/apr-httpd/<br />
182
# Build and install apr-util 1.2<br />
184
./configure --prefix=/usr/local/apr-util-httpd/
185
--with-apr=/usr/local/apr-httpd/<br />
189
# Configure httpd<br />
191
./configure --with-apr=/usr/local/apr-httpd/
192
--with-apr-util=/usr/local/apr-util-httpd/
196
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
197
<div class="section">
198
<h2><a name="download" id="download">Download</a></h2>
200
<p>The Apache HTTP Server can be downloaded from the <a href="http://httpd.apache.org/download.cgi">Apache HTTP Server
201
download site</a>, which lists several mirrors. Most users of
202
Apache HTTPd on unix-like systems will be better off downloading and
203
compiling a source version. The build process (described below) is
204
easy, and it allows you to customize your server to suit your needs.
205
In addition, binary releases are often not up to date with the latest
206
source releases. If you do download a binary, follow the instructions
207
in the <code>INSTALL.bindist</code> file inside the distribution.</p>
209
<p>After downloading, it is important to verify that you have a
210
complete and unmodified version of the Apache HTTP Server. This
211
can be accomplished by testing the downloaded tarball against the
212
PGP signature. Details on how to do this are available on the <a href="http://httpd.apache.org/download.cgi#verify">download
213
page</a> and an extended example is available describing the <a href="http://httpd.apache.org/dev/verification.html">use of
216
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
217
<div class="section">
218
<h2><a name="extract" id="extract">Extract</a></h2>
220
<p>Extracting the source from the Apache HTTPd tarball is a
221
simple matter of uncompressing, and then untarring:</p>
223
<div class="example"><p><code>
224
$ gzip -d httpd-<em>NN</em>.tar.gz<br />
225
$ tar xvf httpd-<em>NN</em>.tar
228
<p>This will create a new directory under the current directory
229
containing the source code for the distribution. You should
230
<code>cd</code> into that directory before proceeding with
231
compiling the server.</p>
232
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
233
<div class="section">
234
<h2><a name="configure" id="configure">Configuring the source tree</a></h2>
236
<p>The next step is to configure the Apache HTTPd source tree for your
237
particular platform and personal requirements. This is done using
238
the script <code class="program"><a href="./programs/configure.html">configure</a></code> included in
239
the root directory of the distribution. (Developers downloading
240
an unreleased version of the Apache HTTPd source tree will need to have
241
<code>autoconf</code> and <code>libtool</code> installed and will
242
need to run <code>buildconf</code> before proceeding with the next
243
steps. This is not necessary for official releases.)</p>
245
<p>To configure the source tree using all the default options,
246
simply type <code>./configure</code>. To change the default
247
options, <code class="program"><a href="./programs/configure.html">configure</a></code> accepts a variety of variables
248
and command line options.</p>
250
<p>The most important option is the location <code>--prefix</code>
251
where the Apache HTTP Server is to be installed later, because Apache
253
configured for this location to work correctly. More fine-tuned
254
control of the location of files is possible with additional <a href="programs/configure.html#installationdirectories">configure
257
<p>Also at this point, you can specify which <a href="programs/configure.html#optionalfeatures">features</a> you
258
want included in Apache HTTPd by enabling and disabling <a href="mod/">modules</a>. The Apache HTTP Server comes with a <a href="mod/module-dict.html#Status">Base</a> set of modules included by
259
default. Other modules are enabled using the
260
<code>--enable-<var>module</var></code> option, where
261
<var>module</var> is the name of the module with the
262
<code>mod_</code> string removed and with any underscore converted
263
to a dash. You can also choose to compile modules as <a href="dso.html">shared objects (DSOs)</a> -- which can be loaded
264
or unloaded at runtime -- by using the option
265
<code>--enable-<var>module</var>=shared</code>. Similarly, you can
266
disable Base modules with the
267
<code>--disable-<var>module</var></code> option. Be careful when
268
using these options, since <code class="program"><a href="./programs/configure.html">configure</a></code> cannot warn you
269
if the module you specify does not exist; it will simply ignore the
272
<p>In addition, it is sometimes necessary to provide the
273
<code class="program"><a href="./programs/configure.html">configure</a></code> script with extra information about the
274
location of your compiler, libraries, or header files. This is
275
done by passing either environment variables or command line
276
options to <code class="program"><a href="./programs/configure.html">configure</a></code>. For more information, see the
277
<code class="program"><a href="./programs/configure.html">configure</a></code> manual page.</p>
279
<p>For a short impression of what possibilities you have, here
280
is a typical example which compiles Apache for the installation
281
tree <code>/sw/pkg/apache</code> with a particular compiler and flags
282
plus the two additional modules <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> and
283
<code class="module"><a href="./mod/mod_speling.html">mod_speling</a></code> for
284
later loading through the DSO mechanism:</p>
286
<div class="example"><p><code>
287
$ CC="pgcc" CFLAGS="-O2" \<br />
288
./configure --prefix=/sw/pkg/apache \<br />
289
--enable-rewrite=shared \<br />
290
--enable-speling=shared
293
<p>When <code class="program"><a href="./programs/configure.html">configure</a></code> is run it will take several minutes to
294
test for the availability of features on your system and build
295
Makefiles which will later be used to compile the server.</p>
297
<p>Details on all the different <code class="program"><a href="./programs/configure.html">configure</a></code> options are
298
available on the <code class="program"><a href="./programs/configure.html">configure</a></code> manual page.</p>
299
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
300
<div class="section">
301
<h2><a name="compile" id="compile">Build</a></h2>
303
<p>Now you can build the various parts which form the Apache HTTPd
304
package by simply running the command:</p>
306
<div class="example"><p><code>$ make</code></p></div>
308
<p>Please be patient here, since a base configuration takes
309
several minutes to compile and the time will vary widely
310
depending on your hardware and the number of modules that you
312
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
313
<div class="section">
314
<h2><a name="install" id="install">Install</a></h2>
316
<p>Now it's time to install the package under the configured
317
installation <em>PREFIX</em> (see <code>--prefix</code> option
318
above) by running:</p>
320
<div class="example"><p><code>$ make install</code></p></div>
322
<p>If you are upgrading, the installation will not overwrite
323
your configuration files or documents.</p>
324
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
325
<div class="section">
326
<h2><a name="customize" id="customize">Customize</a></h2>
328
<p>Next, you can customize your Apache HTTP Server by editing
329
the <a href="configuring.html">configuration files</a> under
330
<code><em>PREFIX</em>/conf/</code>.</p>
332
<div class="example"><p><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code></p></div>
334
<p>Have a look at the Apache HTTP Server manual under <a href="./">docs/manual/</a> or consult <a href="http://httpd.apache.org/docs/2.2/">http://httpd.apache.org/docs/2.2/</a> for the most recent
335
version of this manual and a complete reference of available <a href="mod/directives.html">configuration directives</a>.</p>
336
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
337
<div class="section">
338
<h2><a name="test" id="test">Test</a></h2>
340
<p>Now you can <a href="invoking.html">start</a> your Apache
341
HTTP Server by immediately running:</p>
343
<div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k start</code></p></div>
345
<p>and then you should be able to request your first document
346
via URL <code>http://localhost/</code>. The web page you see is located
347
under the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>,
348
which will usually be <code><em>PREFIX</em>/htdocs/</code>.
349
Then <a href="stopping.html">stop</a> the server again by
352
<div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k stop</code></p></div>
353
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
354
<div class="section">
355
<h2><a name="upgrading" id="upgrading">Upgrading</a></h2>
357
<p>The first step in upgrading is to read the release announcement
358
and the file <code>CHANGES</code> in the source distribution to
359
find any changes that may affect your site. When changing between
360
major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2),
361
there will likely be major differences in the compile-time and
362
run-time configuration that will require manual adjustments. All
363
modules will also need to be upgraded to accomodate changes in the
366
<p>Upgrading from one minor version to the next (for example, from
367
2.2.55 to 2.2.57) is easier. The <code>make install</code>
368
process will not overwrite any of your existing documents, log
369
files, or configuration files. In addition, the developers make
370
every effort to avoid incompatible changes in the
371
<code class="program"><a href="./programs/configure.html">configure</a></code> options, run-time configuration, or the
372
module API between minor versions. In most cases you should be able to
373
use an identical <code class="program"><a href="./programs/configure.html">configure</a></code> command line, an identical
374
configuration file, and all of your modules should continue to
377
<p>To upgrade across minor versions, start by finding the file
378
<code>config.nice</code> in the <code>build</code> directory of
379
your installed server or at the root of the source tree for your
380
old install. This will contain the exact
381
<code class="program"><a href="./programs/configure.html">configure</a></code> command line that you used to
382
configure the source tree. Then to upgrade from one version to
383
the next, you need only copy the <code>config.nice</code> file to
384
the source tree of the new version, edit it to make any desired
385
changes, and then run:</p>
387
<div class="example"><p><code>
388
$ ./config.nice<br />
391
$ <em>PREFIX</em>/bin/apachectl -k graceful-stop<br />
392
$ <em>PREFIX</em>/bin/apachectl -k start<br />
395
<div class="warning">You should always test any new version in your
396
environment before putting it into production. For example, you
397
can install and run the new version along side the old one by
398
using a different <code>--prefix</code> and a
399
different port (by adjusting the <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> directive) to test for any
400
incompatibilities before doing the final upgrade.</div>
402
<div class="bottomlang">
403
<p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
404
<a href="./en/install.html" title="English"> en </a> |
405
<a href="./es/install.html" hreflang="es" rel="alternate" title="Espa�ol"> es </a> |
406
<a href="./fr/install.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
407
<a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
408
<a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
409
</div><div id="footer">
410
<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>
411
<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>
b'\\ No newline at end of file'