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.0</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.0</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="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
25 <a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
26 <a href="./ru/install.html" hreflang="ru" rel="alternate" title="Russian"> ru </a> |
27 <a href="./tr/install.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
31 <p>This document covers compilation and installation of Apache
32 on Unix and Unix-like systems only. For compiling and
33 installation on Windows, see <a href="platform/windows.html">Using Apache with Microsoft
34 Windows</a>. For other platforms, see the <a href="platform/">platform</a> documentation.</p>
36 <p>Apache 2.0's configuration and installation environment has
37 changed completely from Apache 1.3. Apache 1.3 used a custom
38 set of scripts to achieve easy installation. Apache 2.0 now
39 uses <code>libtool</code> and <code>autoconf</code>
40 to create an environment that looks like many other Open Source
43 <p>If you are upgrading from one minor version to the next (for
44 example, 2.0.50 to 2.0.51), please skip down to the <a href="#upgrading">upgrading</a> section.</p>
47 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Overview for the
49 <li><img alt="" src="./images/down.gif" /> <a href="#requirements">Requirements</a></li>
50 <li><img alt="" src="./images/down.gif" /> <a href="#download">Download</a></li>
51 <li><img alt="" src="./images/down.gif" /> <a href="#extract">Extract</a></li>
52 <li><img alt="" src="./images/down.gif" /> <a href="#configure">Configuring the source tree</a></li>
53 <li><img alt="" src="./images/down.gif" /> <a href="#compile">Build</a></li>
54 <li><img alt="" src="./images/down.gif" /> <a href="#install">Install</a></li>
55 <li><img alt="" src="./images/down.gif" /> <a href="#customize">Customize</a></li>
56 <li><img alt="" src="./images/down.gif" /> <a href="#test">Test</a></li>
57 <li><img alt="" src="./images/down.gif" /> <a href="#upgrading">Upgrading</a></li>
58 </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>
59 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
61 <h2><a name="overview" id="overview">Overview for the
67 <td><a href="#download">Download</a></td>
69 <td><code>$ lynx http://httpd.apache.org/download.cgi</code>
74 <td><a href="#extract">Extract</a></td>
76 <td><code>$ gzip -d httpd-2_0_<em>NN</em>.tar.gz<br />
77 $ tar xvf httpd-2_0_<em>NN</em>.tar</code> </td>
81 <td><a href="#configure">Configure</a></td>
83 <td><code>$ ./configure --prefix=<em>PREFIX</em></code>
88 <td><a href="#compile">Compile</a></td>
90 <td><code>$ make</code> </td>
94 <td><a href="#install">Install</a></td>
96 <td><code>$ make install</code> </td>
100 <td><a href="#customize">Customize</a></td>
102 <td><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code> </td>
106 <td><a href="#test">Test</a></td>
108 <td><code>$ <em>PREFIX</em>/bin/apachectl start</code>
113 <p><em>NN</em> must be replaced with the current minor version
114 number, and <em>PREFIX</em> must be replaced with the
115 filesystem path under which the server should be installed. If
116 <em>PREFIX</em> is not specified, it defaults to
117 <code>/usr/local/apache2</code>.</p>
119 <p>Each section of the compilation and installation process is
120 described in more detail below, beginning with the requirements
121 for compiling and installing Apache HTTPD.</p>
122 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
123 <div class="section">
124 <h2><a name="requirements" id="requirements">Requirements</a></h2>
126 <p>The following requirements exist for building Apache:</p>
130 <dd>Make sure you have at least 50 MB of temporary free disk
131 space available. After installation Apache occupies
132 approximately 10 MB of disk space. The actual disk space
133 requirements will vary considerably based on your chosen
134 configuration options and any third-party modules.</dd>
136 <dt>ANSI-C Compiler and Build System</dt>
137 <dd>Make sure you have an ANSI-C compiler installed. The <a href="http://www.gnu.org/software/gcc/gcc.html">GNU C
138 compiler (GCC)</a> from the <a href="http://www.gnu.org/">Free Software Foundation (FSF)</a>
139 is recommended (version 2.7.2 is fine). 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>
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 Usenet newsgroup <a href="news:comp.protocols.time.ntp">comp.protocols.time.ntp</a>
151 and the <a href="http://www.ntp.org">NTP
152 homepage</a> for more details about NTP software and public
155 <dt><a href="http://www.perl.org/">Perl 5</a>
157 <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
158 written in Perl) the Perl 5 interpreter is required (versions
159 5.003 or newer are sufficient). If you have multiple Perl
160 interpreters (for example, a systemwide install of Perl 4, and
161 your own install of Perl 5), you are advised to use the
162 <code>--with-perl</code> option (see below) to make sure the
163 correct one is used by <code class="program"><a href="./programs/configure.html">configure</a></code>.
164 If no Perl 5 interpreter is found by the
165 <code class="program"><a href="./programs/configure.html">configure</a></code> script, you will not be able to use
166 the affected support scripts. Of course, you will still be able to
167 build and use Apache 2.0.</dd>
169 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
170 <div class="section">
171 <h2><a name="download" id="download">Download</a></h2>
173 <p>Apache can be downloaded from the <a href="http://httpd.apache.org/download.cgi">Apache HTTP Server
174 download site</a> which lists several mirrors. Most users of
175 Apache on unix-like systems will be better off downloading and
176 compiling a source version. The build process (described below) is
177 easy, and it allows you to customize your server to suit your needs.
178 In addition, binary releases are often not up to date with the latest
179 source releases. If you do download a binary, follow the instructions
180 in the <code>INSTALL.bindist</code> file inside the distribution.</p>
182 <p>After downloading, it is important to verify that you have a
183 complete and unmodified version of the Apache HTTP Server. This
184 can be accomplished by testing the downloaded tarball against the
185 PGP signature. Details on how to do this are available on the <a href="http://httpd.apache.org/download.cgi#verify">download
186 page</a> and an extended example is available describing the <a href="http://httpd.apache.org/dev/verification.html">use of
189 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
190 <div class="section">
191 <h2><a name="extract" id="extract">Extract</a></h2>
193 <p>Extracting the source from the Apache HTTPD tarball is a
194 simple matter of uncompressing, and then untarring:</p>
196 <div class="example"><p><code>
197 $ gzip -d httpd-2_0_<em>NN</em>.tar.gz<br />
198 $ tar xvf httpd-2_0_<em>NN</em>.tar
201 <p>This will create a new directory under the current directory
202 containing the source code for the distribution. You should
203 <code>cd</code> into that directory before proceeding with
204 compiling the server.</p>
205 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
206 <div class="section">
207 <h2><a name="configure" id="configure">Configuring the source tree</a></h2>
209 <p>The next step is to configure the Apache source tree for your
210 particular platform and personal requirements. This is done using
211 the script <code class="program"><a href="./programs/configure.html">configure</a></code> included in
212 the root directory of the distribution. (Developers downloading
213 the CVS version of the Apache source tree will need to have
214 <code>autoconf</code> and <code>libtool</code> installed and will
215 need to run <code>buildconf</code> before proceeding with the next
216 steps. This is not necessary for official releases.)</p>
218 <p>To configure the source tree using all the default options,
219 simply type <code>./configure</code>. To change the default
220 options, <code class="program"><a href="./programs/configure.html">configure</a></code> accepts a variety of variables
221 and command line options.</p>
223 <p>The most important option is the location <code>--prefix</code>
224 where Apache is to be installed later, because Apache has to be
225 configured for this location to work correctly. More fine-tuned
226 control of the location of files is possible with additional <a href="programs/configure.html#installationdirectories">configure
229 <p>Also at this point, you can specify which <a href="programs/configure.html#optionalfeatures">features</a> you
230 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
231 default. Other modules are enabled using the
232 <code>--enable-<var>module</var></code> option, where
233 <var>module</var> is the name of the module with the
234 <code>mod_</code> string removed and with any underscore converted
235 to a dash. You can also choose to compile modules as <a href="dso.html">shared objects (DSOs)</a> -- which can be loaded
236 or unloaded at runtime -- by using the option
237 <code>--enable-<var>module</var>=shared</code>. Similarly, you can
238 disable Base 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
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.</p>
251 <p>For a short impression of what possibilities you have, here
252 is a typical example which compiles Apache for the installation
253 tree <code>/sw/pkg/apache</code> with a particular compiler and flags
254 plus the two additional modules <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> and
255 <code class="module"><a href="./mod/mod_speling.html">mod_speling</a></code> for
256 later loading through the DSO mechanism:</p>
258 <div class="example"><p><code>
259 $ CC="pgcc" CFLAGS="-O2" \<br />
260 ./configure --prefix=/sw/pkg/apache \<br />
261 --enable-rewrite=shared \<br />
262 --enable-speling=shared
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>
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>
275 <p>Now you can build the various parts which form the Apache
276 package by simply running the command:</p>
278 <div class="example"><p><code>$ make</code></p></div>
280 <p>Please be patient here, since a base configuration takes
281 approximately 3 minutes to compile under a Pentium III/Linux
282 2.2 system, but this will vary widely depending on your
283 hardware and the number of modules which you 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>
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>
292 <div class="example"><p><code>$ make install</code></p></div>
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>
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>
304 <div class="example"><p><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code></p></div>
306 <p>Have a look at the Apache manual under <a href="./">docs/manual/</a> or consult <a href="http://httpd.apache.org/docs/2.0/">http://httpd.apache.org/docs/2.0/</a> for the most recent
307 version of this manual and a complete reference of available <a href="mod/directives.html">configuration directives</a>.</p>
308 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
309 <div class="section">
310 <h2><a name="test" id="test">Test</a></h2>
312 <p>Now you can <a href="invoking.html">start</a> your Apache
313 HTTP server by immediately running:</p>
315 <div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl start</code></p></div>
317 <p>and then you should be able to request your first document
318 via URL <code>http://localhost/</code>. The web page you see is located
319 under the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>
320 which will usually be <code><em>PREFIX</em>/htdocs/</code>.
321 Then <a href="stopping.html">stop</a> the server again by
324 <div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl stop</code></p></div>
325 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
326 <div class="section">
327 <h2><a name="upgrading" id="upgrading">Upgrading</a></h2>
329 <p>The first step in upgrading is to read the release announcement
330 and the file <code>CHANGES</code> in the source distribution to
331 find any changes that may affect your site. When changing between
332 major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2),
333 there will likely be major differences in the compile-time and
334 run-time configuration that will require manual adjustments. All
335 modules will also need to be upgraded to accomodate changes in the
338 <p>Upgrading from one minor version to the next (for example, from
339 2.0.55 to 2.0.57) is easier. The <code>make install</code>
340 process will not overwrite any of your existing documents, log
341 files, or configuration files. In addition, the developers make
342 every effort to avoid incompatible changes in the
343 <code class="program"><a href="./programs/configure.html">configure</a></code> options, run-time configuration, or the
344 module API between minor versions. In most cases you should be able to
345 use an identical <code class="program"><a href="./programs/configure.html">configure</a></code> command line, an identical
346 configuration file, and all of your modules should continue to
347 work. (This is only valid for versions after 2.0.41; earlier
348 versions have incompatible changes.)</p>
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>
360 <div class="example"><p><code>
361 $ ./config.nice<br />
364 $ <em>PREFIX</em>/bin/apachectl stop<br />
365 $ <em>PREFIX</em>/bin/apachectl start<br />
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>
375 <div class="bottomlang">
376 <p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
377 <a href="./en/install.html" title="English"> en </a> |
378 <a href="./es/install.html" hreflang="es" rel="alternate" title="Español"> es </a> |
379 <a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
380 <a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
381 <a href="./ru/install.html" hreflang="ru" rel="alternate" title="Russian"> ru </a> |
382 <a href="./tr/install.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
383 </div><div id="footer">
384 <p class="apache">Copyright 2009 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>
385 <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>