]> granicus.if.org Git - apache/blob - docs/manual/install.xml
minor cleanups
[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-2004 The Apache Software Foundation
8
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12
13      http://www.apache.org/licenses/LICENSE-2.0
14
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20 -->
21
22 <manualpage metafile="install.xml.meta">
23
24   <title>Compiling and Installing</title>
25
26 <summary>
27
28     <p>This document covers compilation and installation of Apache
29     on Unix and Unix-like systems only. For compiling and
30     installation on Windows, see <a
31     href="platform/windows.html">Using Apache with Microsoft
32     Windows</a>. For other platforms, see the <a
33     href="platform/">platform</a> documentation.</p>
34
35     <p>Apache 2.0's configuration and installation environment has
36     changed completely from Apache 1.3. Apache 1.3 used a custom
37     set of scripts to achieve easy installation. Apache 2.0 now
38     uses <code>libtool</code> and <code>autoconf</code>
39     to create an environment that looks like many other Open Source
40     projects.</p>
41
42     <p>If you are upgrading from one minor version to the next (for
43     example, 2.0.50 to 2.0.51), please skip down to the <a
44     href="#upgrading">upgrading</a> section.</p>
45
46 </summary>
47
48 <seealso><a href="programs/configure.html">Configure the source tree</a></seealso>
49 <seealso><a href="invoking.html">Starting Apache</a></seealso>
50 <seealso><a href="stopping.html">Stopping and Restarting</a></seealso>
51
52 <section id="overview"><title>Overview for the
53     impatient</title>
54
55     <table>
56       <columnspec><column width=".13"/><column width=".80"/></columnspec>
57       <tr>
58         <td><a href="#download">Download</a></td>
59
60         <td><code>$ lynx http://httpd.apache.org/download.cgi</code>
61         </td>
62       </tr>
63
64       <tr>
65         <td><a href="#extract">Extract</a></td>
66
67         <td><code>$ gzip -d httpd-2_1_<em>NN</em>.tar.gz<br />
68          $ tar xvf httpd-2_1_<em>NN</em>.tar</code> </td>
69       </tr>
70
71       <tr>
72         <td><a href="#configure">Configure</a></td>
73
74         <td><code>$ ./configure --prefix=<em>PREFIX</em></code>
75         </td>
76       </tr>
77
78       <tr>
79         <td><a href="#compile">Compile</a></td>
80
81         <td><code>$ make</code> </td>
82       </tr>
83
84       <tr>
85         <td><a href="#install">Install</a></td>
86
87         <td><code>$ make install</code> </td>
88       </tr>
89
90       <tr>
91         <td><a href="#customize">Customize</a></td>
92
93         <td><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code> </td>
94       </tr>
95
96       <tr>
97         <td><a href="#test">Test</a></td>
98
99         <td><code>$ <em>PREFIX</em>/bin/apachectl start</code>
100         </td>
101       </tr>
102     </table>
103
104     <p><em>NN</em> must be replaced with the current minor version
105     number, and <em>PREFIX</em> must be replaced with the
106     filesystem path under which the server should be installed. If
107     <em>PREFIX</em> is not specified, it defaults to
108     <code>/usr/local/apache2</code>.</p>
109
110     <p>Each section of the compilation and installation process is
111     described in more detail below, beginning with the requirements
112     for compiling and installing Apache HTTPD.</p>
113 </section>
114
115 <section id="requirements"><title>Requirements</title>
116
117     <p>The following requirements exist for building Apache:</p>
118
119     <dl>
120       <dt>Disk Space</dt>
121       <dd>Make sure you have at least 50 MB of temporary free disk
122       space available. After installation Apache occupies
123       approximately 10 MB of disk space. The actual disk space
124       requirements will vary considerably based on your chosen
125       configuration options and any third-party modules.</dd>
126
127       <dt>ANSI-C Compiler and Build System</dt>
128       <dd>Make sure you have an ANSI-C compiler installed. The <a
129       href="http://www.gnu.org/software/gcc/gcc.html">GNU C
130       compiler (GCC)</a> from the <a
131       href="http://www.gnu.org/">Free Software Foundation (FSF)</a>
132       is recommended (version 2.7.2 is fine). If you don't have GCC
133       then at least make sure your vendor's compiler is ANSI
134       compliant. In addition, your <code>PATH</code> must contain
135       basic build tools such as <code>make</code>.</dd>
136
137       <dt>Accurate time keeping</dt>
138       <dd>Elements of the HTTP protocol are expressed as the time of
139       day. So, it's time to investigate setting some time
140       synchronization facility on your system. Usually the
141       <code>ntpdate</code> or <code>xntpd</code> programs are used for
142       this purpose which are based on the Network Time Protocol (NTP).
143       See the Usenet newsgroup <a
144       href="news:comp.protocols.time.ntp">comp.protocols.time.ntp</a>
145       and the <a href="http://www.ntp.org">NTP
146       homepage</a> for more details about NTP software and public
147       time servers.</dd>
148
149       <dt><a href="http://www.perl.org/">Perl 5</a>
150       [OPTIONAL]</dt>
151       <dd>For some of the support scripts like <program>
152       apxs</program> or <program>dbmmanage</program> (which are
153       written in Perl) the Perl 5 interpreter is required (versions
154       5.003 or newer are sufficient). If no such interpreter is found by
155       the <program>configure</program> script there is no harm. Of course, you
156       still can build and install Apache 2.0. Only those support scripts
157       cannot be used. If you have multiple Perl interpreters
158       installed (perhaps a Perl 4 from the vendor and a Perl 5 from
159       your own), then it is recommended to use the <code>--with-perl</code>
160       option (see below) to make sure the correct one is selected
161       by <program>configure</program>.</dd>
162     </dl>
163 </section>
164
165 <section id="download"><title>Download</title>
166
167     <p>Apache can be downloaded from the <a
168     href="http://httpd.apache.org/download.cgi">Apache HTTP Server
169     download site</a> which lists several mirrors.  Most users of
170     Apache on unix-like systems will be better off downloading and
171     compiling a source version.  The build process (described below) is
172     easy, and it allows you to customize your server to suit your needs.
173     In addition, binary releases are often not up to date with the latest
174     source releases.  If you do download a binary, follow the instructions
175     in the <code>INSTALL.bindist</code> file inside the distribution.</p>
176
177     <p>After downloading, it is important to verify that you have a
178     complete and unmodified version of the Apache HTTP Server. This
179     can be accomplished by testing the downloaded tarball against the
180     PGP signature.  Details on how to do this are available on the <a
181     href="http://httpd.apache.org/download.cgi#verify">download
182     page</a> and an extended example is available describing the <a
183     href="http://httpd.apache.org/dev/verification.html">use of
184     PGP</a>.</p>
185
186 </section>
187
188 <section id="extract"><title>Extract</title>
189
190     <p>Extracting the source from the Apache HTTPD tarball is a
191     simple matter of uncompressing, and then untarring:</p>
192
193 <example>
194 $ gzip -d httpd-2_1_<em>NN</em>.tar.gz<br />
195 $ tar xvf httpd-2_1_<em>NN</em>.tar
196 </example>
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 </section>
203
204 <section id="configure"><title>Configuring the source tree</title>
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 <program>configure</program> included in
209     the root directory of the distribution. (Developers downloading
210     the CVS 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, <program>configure</program> 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
224     href="programs/configure.html#installationdirectories">configure
225     options</a>.</p>
226
227     <p>Also at this point, you can specify which <a
228     href="programs/configure.html#optionalfeatures">features</a> you
229     want included in Apache by enabling and disabling <a
230     href="mod/">modules</a>.  Apache comes with a <a
231     href="mod/module-dict.html#Status">Base</a> set of modules included by
232     default.  Other modules are enabled using the
233     <code>--enable-<var>module</var></code> option, where
234     <var>module</var> is the name of the module with the
235     <code>mod_</code> string removed and with any underscore converted
236     to a dash.  You can also choose to compile modules as <a
237     href="dso.html">shared objects (DSOs)</a> -- which can be loaded
238     or unloaded at runtime -- by using the option
239     <code>--enable-<var>module</var>=shared</code>.  Similarly, you can
240     disable Base modules with the
241     <code>--disable-<var>module</var></code> option.  Be careful when
242     using these options, since <program>configure</program> cannot warn you
243     if the module you specify does not exist; it will simply ignore the
244     option.</p>
245
246     <p>In addition, it is sometimes necessary to provide the
247     <program>configure</program> script with extra information about the
248     location of your compiler, libraries, or header files.  This is
249     done by passing either environment variables or command line
250     options to <program>configure</program>.  For more information, see the
251     <program>configure</program> manual page.</p>
252
253     <p>For a short impression of what possibilities you have, here
254     is a typical example which compiles Apache for the installation
255     tree <code>/sw/pkg/apache</code> with a particular compiler and flags
256     plus the two additional modules <module>mod_rewrite</module> and
257     <module>mod_speling</module> for
258     later loading through the DSO mechanism:</p>
259
260 <example>
261       $ CC="pgcc" CFLAGS="-O2" \<br />
262        ./configure --prefix=/sw/pkg/apache \<br />
263        --enable-rewrite=shared \<br />
264        --enable-speling=shared
265 </example>
266
267     <p>When <program>configure</program> is run it will take several minutes to
268     test for the availability of features on your system and build
269     Makefiles which will later be used to compile the server.</p>
270
271     <p>Details on all the different <program>configure</program> options are
272     available on the <program>configure</program> manual page.</p>
273 </section>
274
275 <section id="compile"><title>Build</title>
276
277     <p>Now you can build the various parts which form the Apache
278     package by simply running the command:</p>
279
280 <example>$ make</example>
281
282     <p>Please be patient here, since a base configuration takes
283     approximately 3 minutes to compile under a Pentium III/Linux
284     2.2 system, but this will vary widely depending on your
285     hardware and the number of modules which you have enabled.</p>
286 </section>
287
288 <section id="install"><title>Install</title>
289
290     <p>Now it's time to install the package under the configured
291     installation <em>PREFIX</em> (see <code>--prefix</code> option
292     above) by running:</p>
293
294 <example>$ make install</example>
295
296     <p>If you are upgrading, the installation will not overwrite
297     your configuration files or documents.</p>
298 </section>
299
300 <section id="customize"><title>Customize</title>
301
302     <p>Next, you can customize your Apache HTTP server by editing
303     the <a href="configuring.html">configuration files</a> under
304     <code><em>PREFIX</em>/conf/</code>.</p>
305
306 <example>$ vi <em>PREFIX</em>/conf/httpd.conf</example>
307
308     <p>Have a look at the Apache manual under <a
309     href="./">docs/manual/</a> or consult <a
310     href="http://httpd.apache.org/docs-2.1/"
311     >http://httpd.apache.org/docs-2.1/</a> for the most recent version of
312     this manual and a complete reference of available <a
313     href="mod/directives.html">configuration directives</a>.</p>
314 </section>
315
316 <section id="test"><title>Test</title>
317
318     <p>Now you can <a href="invoking.html">start</a> your Apache
319     HTTP server by immediately running:</p>
320
321 <example>$ <em>PREFIX</em>/bin/apachectl start</example>
322
323     <p>and then you should be able to request your first document
324     via URL <code>http://localhost/</code>. The web page you see is located
325     under the <directive module="core">DocumentRoot</directive>
326     which will usually be <code><em>PREFIX</em>/htdocs/</code>.
327     Then <a href="stopping.html">stop</a> the server again by
328     running:</p>
329
330 <example>$ <em>PREFIX</em>/bin/apachectl stop</example>
331 </section>
332 <section id="upgrading"><title>Upgrading</title>
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.0.55 to 2.0.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     <program>configure</program> options, run-time configuration, or the
349     module API between minor versions.  In most cases you should be able to
350     use an identical <program>configure</program> command line, an identical
351     configuration file, and all of your modules should continue to
352     work.  (This is only valid for versions after 2.0.41; earlier
353     versions have incompatible changes.)</p>
354
355     <p>If you kept the source tree from your last installation,
356     upgrading is even easier.  The file <code>config.nice</code> in
357     the root of the old source tree contains the exact
358     <program>configure</program> command line that you used to configure the
359     source tree.  Then to upgrade from one version to the next, you
360     need only copy the <code>config.nice</code> file to the source
361     tree of the new version, edit it to make any desired changes, and
362     then run:</p>
363
364     <example>
365     $ ./config.nice<br />
366     $ make<br />
367     $ make install<br />
368     $ <em>PREFIX</em>/bin/apachectl stop<br />
369     $ <em>PREFIX</em>/bin/apachectl start<br />
370     </example>
371
372     <note type="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 <directive
377     module="mpm_common">Listen</directive> directive) to test for any
378     incompatibilities before doing the final upgrade.</note>
379 </section>
380 </manualpage>