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