]> granicus.if.org Git - apache/blob - docs/manual/install.xml
We have been installing config.nice in build/ for a while, so we might
[apache] / docs / manual / install.xml
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2002-2005 The Apache Software Foundation or its licensors, as
8  applicable.
9
10  Licensed under the Apache License, Version 2.0 (the "License");
11  you may not use this file except in compliance with the License.
12  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <manualpage metafile="install.xml.meta">
24
25   <title>Compiling and Installing</title>
26
27 <summary>
28
29     <p>This document covers compilation and installation of Apache
30     on Unix and Unix-like systems only. For compiling and
31     installation on Windows, see <a
32     href="platform/windows.html">Using Apache with Microsoft
33     Windows</a>. For other platforms, see the <a
34     href="platform/">platform</a> documentation.</p>
35
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
41     projects.</p>
42
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
45     href="#upgrading">upgrading</a> section.</p>
46
47 </summary>
48
49 <seealso><a href="programs/configure.html">Configure the source tree</a></seealso>
50 <seealso><a href="invoking.html">Starting Apache</a></seealso>
51 <seealso><a href="stopping.html">Stopping and Restarting</a></seealso>
52
53 <section id="overview"><title>Overview for the
54     impatient</title>
55
56     <table>
57       <columnspec><column width=".13"/><column width=".80"/></columnspec>
58       <tr>
59         <td><a href="#download">Download</a></td>
60
61         <td><code>$ lynx http://httpd.apache.org/download.cgi</code>
62         </td>
63       </tr>
64
65       <tr>
66         <td><a href="#extract">Extract</a></td>
67
68         <td><code>$ gzip -d httpd-2_1_<em>NN</em>.tar.gz<br />
69          $ tar xvf httpd-2_1_<em>NN</em>.tar</code> </td>
70       </tr>
71
72       <tr>
73         <td><a href="#configure">Configure</a></td>
74
75         <td><code>$ ./configure --prefix=<em>PREFIX</em></code>
76         </td>
77       </tr>
78
79       <tr>
80         <td><a href="#compile">Compile</a></td>
81
82         <td><code>$ make</code> </td>
83       </tr>
84
85       <tr>
86         <td><a href="#install">Install</a></td>
87
88         <td><code>$ make install</code> </td>
89       </tr>
90
91       <tr>
92         <td><a href="#customize">Customize</a></td>
93
94         <td><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code> </td>
95       </tr>
96
97       <tr>
98         <td><a href="#test">Test</a></td>
99
100         <td><code>$ <em>PREFIX</em>/bin/apachectl start</code>
101         </td>
102       </tr>
103     </table>
104
105     <p><em>NN</em> must be replaced with the current minor version
106     number, and <em>PREFIX</em> must be replaced with the
107     filesystem path under which the server should be installed. If
108     <em>PREFIX</em> is not specified, it defaults to
109     <code>/usr/local/apache2</code>.</p>
110
111     <p>Each section of the compilation and installation process is
112     described in more detail below, beginning with the requirements
113     for compiling and installing Apache HTTPD.</p>
114 </section>
115
116 <section id="requirements"><title>Requirements</title>
117
118     <p>The following requirements exist for building Apache:</p>
119
120     <dl>
121       <dt>Disk Space</dt>
122       <dd>Make sure you have at least 50 MB of temporary free disk
123       space available. After installation Apache occupies
124       approximately 10 MB of disk space. The actual disk space
125       requirements will vary considerably based on your chosen
126       configuration options and any third-party modules.</dd>
127
128       <dt>ANSI-C Compiler and Build System</dt>
129       <dd>Make sure you have an ANSI-C compiler installed. The <a
130       href="http://www.gnu.org/software/gcc/gcc.html">GNU C
131       compiler (GCC)</a> from the <a
132       href="http://www.gnu.org/">Free Software Foundation (FSF)</a>
133       is recommended (version 2.7.2 is fine). If you don't have GCC
134       then at least make sure your vendor's compiler is ANSI
135       compliant. In addition, your <code>PATH</code> must contain
136       basic build tools such as <code>make</code>.</dd>
137
138       <dt>Accurate time keeping</dt>
139       <dd>Elements of the HTTP protocol are expressed as the time of
140       day. So, it's time to investigate setting some time
141       synchronization facility on your system. Usually the
142       <code>ntpdate</code> or <code>xntpd</code> programs are used for
143       this purpose which are based on the Network Time Protocol (NTP).
144       See the Usenet newsgroup <a
145       href="news:comp.protocols.time.ntp">comp.protocols.time.ntp</a>
146       and the <a href="http://www.ntp.org">NTP
147       homepage</a> for more details about NTP software and public
148       time servers.</dd>
149
150       <dt><a href="http://www.perl.org/">Perl 5</a>
151       [OPTIONAL]</dt>
152       <dd>For some of the support scripts like <program>
153       apxs</program> or <program>dbmmanage</program> (which are
154       written in Perl) the Perl 5 interpreter is required (versions
155       5.003 or newer are sufficient). If no such interpreter is found by
156       the <program>configure</program> script there is no harm. Of course, you
157       still can build and install Apache 2.0. Only those support scripts
158       cannot be used. If you have multiple Perl interpreters
159       installed (perhaps a Perl 4 from the vendor and a Perl 5 from
160       your own), then it is recommended to use the <code>--with-perl</code>
161       option (see below) to make sure the correct one is selected
162       by <program>configure</program>.</dd>
163     </dl>
164 </section>
165
166 <section id="download"><title>Download</title>
167
168     <p>Apache can be downloaded from the <a
169     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
182     href="http://httpd.apache.org/download.cgi#verify">download
183     page</a> and an extended example is available describing the <a
184     href="http://httpd.apache.org/dev/verification.html">use of
185     PGP</a>.</p>
186
187 </section>
188
189 <section id="extract"><title>Extract</title>
190
191     <p>Extracting the source from the Apache HTTPD tarball is a
192     simple matter of uncompressing, and then untarring:</p>
193
194 <example>
195 $ gzip -d httpd-2_1_<em>NN</em>.tar.gz<br />
196 $ tar xvf httpd-2_1_<em>NN</em>.tar
197 </example>
198
199     <p>This will create a new directory under the current directory
200     containing the source code for the distribution. You should
201     <code>cd</code> into that directory before proceeding with
202     compiling the server.</p>
203 </section>
204
205 <section id="configure"><title>Configuring the source tree</title>
206
207     <p>The next step is to configure the Apache source tree for your
208     particular platform and personal requirements. This is done using
209     the script <program>configure</program> included in
210     the root directory of the distribution. (Developers downloading
211     the CVS version of the Apache source tree will need to have
212     <code>autoconf</code> and <code>libtool</code> installed and will
213     need to run <code>buildconf</code> before proceeding with the next
214     steps. This is not necessary for official releases.)</p>
215
216     <p>To configure the source tree using all the default options,
217     simply type <code>./configure</code>. To change the default
218     options, <program>configure</program> accepts a variety of variables
219     and command line options.</p>
220
221     <p>The most important option is the location <code>--prefix</code>
222     where Apache is to be installed later, because Apache has to be
223     configured for this location to work correctly.  More fine-tuned
224     control of the location of files is possible with additional <a
225     href="programs/configure.html#installationdirectories">configure
226     options</a>.</p>
227
228     <p>Also at this point, you can specify which <a
229     href="programs/configure.html#optionalfeatures">features</a> you
230     want included in Apache by enabling and disabling <a
231     href="mod/">modules</a>.  Apache comes with a <a
232     href="mod/module-dict.html#Status">Base</a> set of modules included by
233     default.  Other modules are enabled using the
234     <code>--enable-<var>module</var></code> option, where
235     <var>module</var> is the name of the module with the
236     <code>mod_</code> string removed and with any underscore converted
237     to a dash.  You can also choose to compile modules as <a
238     href="dso.html">shared objects (DSOs)</a> -- which can be loaded
239     or unloaded at runtime -- by using the option
240     <code>--enable-<var>module</var>=shared</code>.  Similarly, you can
241     disable Base modules with the
242     <code>--disable-<var>module</var></code> option.  Be careful when
243     using these options, since <program>configure</program> cannot warn you
244     if the module you specify does not exist; it will simply ignore the
245     option.</p>
246
247     <p>In addition, it is sometimes necessary to provide the
248     <program>configure</program> script with extra information about the
249     location of your compiler, libraries, or header files.  This is
250     done by passing either environment variables or command line
251     options to <program>configure</program>.  For more information, see the
252     <program>configure</program> manual page.</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 <module>mod_rewrite</module> and
258     <module>mod_speling</module> for
259     later loading through the DSO mechanism:</p>
260
261 <example>
262       $ CC="pgcc" CFLAGS="-O2" \<br />
263        ./configure --prefix=/sw/pkg/apache \<br />
264        --enable-rewrite=shared \<br />
265        --enable-speling=shared
266 </example>
267
268     <p>When <program>configure</program> is run it will take several minutes to
269     test for the availability of features on your system and build
270     Makefiles which will later be used to compile the server.</p>
271
272     <p>Details on all the different <program>configure</program> options are
273     available on the <program>configure</program> manual page.</p>
274 </section>
275
276 <section id="compile"><title>Build</title>
277
278     <p>Now you can build the various parts which form the Apache
279     package by simply running the command:</p>
280
281 <example>$ make</example>
282
283     <p>Please be patient here, since a base configuration takes
284     approximately 3 minutes to compile under a Pentium III/Linux
285     2.2 system, but this will vary widely depending on your
286     hardware and the number of modules which you have enabled.</p>
287 </section>
288
289 <section id="install"><title>Install</title>
290
291     <p>Now it's time to install the package under the configured
292     installation <em>PREFIX</em> (see <code>--prefix</code> option
293     above) by running:</p>
294
295 <example>$ make install</example>
296
297     <p>If you are upgrading, the installation will not overwrite
298     your configuration files or documents.</p>
299 </section>
300
301 <section id="customize"><title>Customize</title>
302
303     <p>Next, you can customize your Apache HTTP server by editing
304     the <a href="configuring.html">configuration files</a> under
305     <code><em>PREFIX</em>/conf/</code>.</p>
306
307 <example>$ vi <em>PREFIX</em>/conf/httpd.conf</example>
308
309     <p>Have a look at the Apache manual under <a
310     href="./">docs/manual/</a> or consult <a
311     href="http://httpd.apache.org/docs-2.1/"
312     >http://httpd.apache.org/docs-2.1/</a> for the most recent version of
313     this manual and a complete reference of available <a
314     href="mod/directives.html">configuration directives</a>.</p>
315 </section>
316
317 <section id="test"><title>Test</title>
318
319     <p>Now you can <a href="invoking.html">start</a> your Apache
320     HTTP server by immediately running:</p>
321
322 <example>$ <em>PREFIX</em>/bin/apachectl start</example>
323
324     <p>and then you should be able to request your first document
325     via URL <code>http://localhost/</code>. The web page you see is located
326     under the <directive module="core">DocumentRoot</directive>
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 <example>$ <em>PREFIX</em>/bin/apachectl stop</example>
332 </section>
333 <section id="upgrading"><title>Upgrading</title>
334
335     <p>The first step in upgrading is to read the release announcement
336     and the file <code>CHANGES</code> in the source distribution to
337     find any changes that may affect your site.  When changing between
338     major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2),
339     there will likely be major differences in the compile-time and
340     run-time configuration that will require manual adjustments.  All
341     modules will also need to be upgraded to accomodate changes in the
342     module API.</p>
343
344     <p>Upgrading from one minor version to the next (for example, from
345     2.0.55 to 2.0.57) is easier.  The <code>make install</code>
346     process will not overwrite any of your existing documents, log
347     files, or configuration files.  In addition, the developers make
348     every effort to avoid incompatible changes in the
349     <program>configure</program> options, run-time configuration, or the
350     module API between minor versions.  In most cases you should be able to
351     use an identical <program>configure</program> command line, an identical
352     configuration file, and all of your modules should continue to
353     work.  (This is only valid for versions after 2.0.41; earlier
354     versions have incompatible changes.)</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     <program>configure</program> 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     <example>
367     $ ./config.nice<br />
368     $ make<br />
369     $ make install<br />
370     $ <em>PREFIX</em>/bin/apachectl stop<br />
371     $ <em>PREFIX</em>/bin/apachectl start<br />
372     </example>
373
374     <note type="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 <directive
379     module="mpm_common">Listen</directive> directive) to test for any
380     incompatibilities before doing the final upgrade.</note>
381 </section>
382 </manualpage>