3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4
<title>14.5.�Installation Procedure</title>
5
<link rel="stylesheet" href="stylesheet.css" type="text/css">
6
<link rev="made" href="pgsql-docs@postgresql.org">
7
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
8
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
9
<link rel="up" href="installation.html" title="Chapter�14.� Installation Instructions">
10
<link rel="prev" href="install-upgrading.html" title="14.4.�If You Are Upgrading">
11
<link rel="next" href="install-post.html" title="14.6.�Post-Installation Setup">
12
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
15
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
16
<a name="install-procedure"></a>14.5.�Installation Procedure</h2></div></div></div>
17
<div class="procedure"><ol type="1">
19
<a name="configure"></a><p class="title"><b>Configuration</b></p>
20
<a name="id635634"></a><p> The first step of the installation procedure is to configure the
21
source tree for your system and choose the options you would like.
22
This is done by running the <code class="filename">configure</code> script. For a
23
default installation simply enter
25
<pre class="screen"><strong class="userinput"><code>./configure</code></strong></pre>
27
This script will run a number of tests to guess values for various
28
system dependent variables and detect some quirks of your
29
operating system, and finally will create several files in the
30
build tree to record what it found. (You can also run
31
<code class="filename">configure</code> in a directory outside the source
32
tree if you want to keep the build directory separate.)
34
<p> The default configuration will build the server and utilities, as
35
well as all client applications and interfaces that require only a
36
C compiler. All files will be installed under
37
<code class="filename">/usr/local/pgsql</code> by default.
39
<p> You can customize the build and installation process by supplying one
40
or more of the following command line options to
41
<code class="filename">configure</code>:
44
<div class="variablelist"><dl>
45
<dt><span class="term"><code class="option">--prefix=<em class="replaceable"><code>PREFIX</code></em></code></span></dt>
47
<p> Install all files under the directory <em class="replaceable"><code>PREFIX</code></em>
48
instead of <code class="filename">/usr/local/pgsql</code>. The actual
49
files will be installed into various subdirectories; no files
50
will ever be installed directly into the
51
<em class="replaceable"><code>PREFIX</code></em> directory.
53
<p> If you have special needs, you can also customize the
54
individual subdirectories with the following options. However,
55
if you leave these with their defaults, the installation will be
56
relocatable, meaning you can move the directory after
57
installation. (The <code class="literal">man</code> and <code class="literal">doc</code>
58
locations are not affected by this.)
60
<p> For relocatable installs, you might want to use
61
<code class="filename">configure</code>'s <code class="literal">--disable-rpath</code>
62
option. Also, you will need to tell the operating system how
63
to find the shared libraries.
66
<dt><span class="term"><code class="option">--exec-prefix=<em class="replaceable"><code>EXEC-PREFIX</code></em></code></span></dt>
67
<dd><p> You can install architecture-dependent files under a
68
different prefix, <em class="replaceable"><code>EXEC-PREFIX</code></em>, than what
69
<em class="replaceable"><code>PREFIX</code></em> was set to. This can be useful to
70
share architecture-independent files between hosts. If you
71
omit this, then <em class="replaceable"><code>EXEC-PREFIX</code></em> is set equal to
72
<em class="replaceable"><code>PREFIX</code></em> and both architecture-dependent and
73
independent files will be installed under the same tree,
74
which is probably what you want.
76
<dt><span class="term"><code class="option">--bindir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
77
<dd><p> Specifies the directory for executable programs. The default
78
is <code class="filename"><em class="replaceable"><code>EXEC-PREFIX</code></em>/bin</code>, which
79
normally means <code class="filename">/usr/local/pgsql/bin</code>.
81
<dt><span class="term"><code class="option">--datadir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
82
<dd><p> Sets the directory for read-only data files used by the
83
installed programs. The default is
84
<code class="filename"><em class="replaceable"><code>PREFIX</code></em>/share</code>. Note that this has
85
nothing to do with where your database files will be placed.
87
<dt><span class="term"><code class="option">--sysconfdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
88
<dd><p> The directory for various configuration files,
89
<code class="filename"><em class="replaceable"><code>PREFIX</code></em>/etc</code> by default.
91
<dt><span class="term"><code class="option">--libdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
92
<dd><p> The location to install libraries and dynamically loadable
93
modules. The default is
94
<code class="filename"><em class="replaceable"><code>EXEC-PREFIX</code></em>/lib</code>.
96
<dt><span class="term"><code class="option">--includedir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
97
<dd><p> The directory for installing C and C++ header files. The
98
default is <code class="filename"><em class="replaceable"><code>PREFIX</code></em>/include</code>.
100
<dt><span class="term"><code class="option">--mandir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
101
<dd><p> The man pages that come with <span class="productname">PostgreSQL</span> will be installed under
102
this directory, in their respective
103
<code class="filename">man<em class="replaceable"><code>x</code></em></code> subdirectories.
104
The default is <code class="filename"><em class="replaceable"><code>PREFIX</code></em>/man</code>.
107
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">--with-docdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--without-docdir</code></span>
109
<dd><p> Documentation files, except “<span class="quote">man</span>” pages, will be
110
installed into this directory. The default is
111
<code class="filename"><em class="replaceable"><code>PREFIX</code></em>/doc</code>. If the option
112
<code class="option">--without-docdir</code> is specified, the
113
documentation will not be installed by <code class="command">make
114
install</code>. This is intended for packaging scripts
115
that have special methods for installing documentation.
121
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
122
<h3 class="title">Note</h3>
123
<p> Care has been taken to make it possible to install
124
<span class="productname">PostgreSQL</span> into shared installation locations
125
(such as <code class="filename">/usr/local/include</code>) without
126
interfering with the namespace of the rest of the system. First,
127
the string “<span class="quote"><code class="literal">/postgresql</code></span>” is
128
automatically appended to <code class="varname">datadir</code>,
129
<code class="varname">sysconfdir</code>, and <code class="varname">docdir</code>,
130
unless the fully expanded directory name already contains the
131
string “<span class="quote"><code class="literal">postgres</code></span>” or
132
“<span class="quote"><code class="literal">pgsql</code></span>”. For example, if you choose
133
<code class="filename">/usr/local</code> as prefix, the documentation will
134
be installed in <code class="filename">/usr/local/doc/postgresql</code>,
135
but if the prefix is <code class="filename">/opt/postgres</code>, then it
136
will be in <code class="filename">/opt/postgres/doc</code>. The public C
137
header files of the client interfaces are installed into
138
<code class="varname">includedir</code> and are namespace-clean. The
139
internal header files and the server header files are installed
140
into private directories under <code class="varname">includedir</code>. See
141
the documentation of each interface for information about how to
142
get at the its header files. Finally, a private subdirectory will
143
also be created, if appropriate, under <code class="varname">libdir</code>
144
for dynamically loadable modules.
150
<div class="variablelist"><dl>
151
<dt><span class="term"><code class="option">--with-includes=<em class="replaceable"><code>DIRECTORIES</code></em></code></span></dt>
153
<p> <em class="replaceable"><code>DIRECTORIES</code></em> is a colon-separated list of
154
directories that will be added to the list the compiler
155
searches for header files. If you have optional packages
156
(such as GNU <span class="application">Readline</span>) installed in a non-standard
158
you have to use this option and probably also the corresponding
159
<code class="option">--with-libraries</code> option.
161
<p> Example: <code class="literal">--with-includes=/opt/gnu/include:/usr/sup/include</code>.
164
<dt><span class="term"><code class="option">--with-libraries=<em class="replaceable"><code>DIRECTORIES</code></em></code></span></dt>
166
<p> <em class="replaceable"><code>DIRECTORIES</code></em> is a colon-separated list of
167
directories to search for libraries. You will probably have
168
to use this option (and the corresponding
169
<code class="option">--with-includes</code> option) if you have packages
170
installed in non-standard locations.
172
<p> Example: <code class="literal">--with-libraries=/opt/gnu/lib:/usr/sup/lib</code>.
175
<dt><span class="term"><code class="option">--enable-nls[<span class="optional">=<em class="replaceable"><code>LANGUAGES</code></em></span>]</code></span></dt>
177
<p> Enables Native Language Support (<acronym class="acronym">NLS</acronym>),
178
that is, the ability to display a program's messages in a
179
language other than English.
180
<em class="replaceable"><code>LANGUAGES</code></em> is a space-separated
181
list of codes of the languages that you want supported, for
182
example <code class="literal">--enable-nls='de fr'</code>. (The intersection
183
between your list and the set of actually provided
184
translations will be computed automatically.) If you do not
185
specify a list, then all available translations are
188
<p> To use this option, you will need an implementation of the
189
<span class="application">Gettext</span> API; see above.
192
<dt><span class="term"><code class="option">--with-pgport=<em class="replaceable"><code>NUMBER</code></em></code></span></dt>
193
<dd><p> Set <em class="replaceable"><code>NUMBER</code></em> as the default port number for
194
server and clients. The default is 5432. The port can always
195
be changed later on, but if you specify it here then both
196
server and clients will have the same default compiled in,
197
which can be very convenient. Usually the only good reason
198
to select a non-default value is if you intend to run multiple
199
<span class="productname">PostgreSQL</span> servers on the same machine.
201
<dt><span class="term"><code class="option">--with-perl</code></span></dt>
202
<dd><p> Build the <span class="application">PL/Perl</span> server-side language.
204
<dt><span class="term"><code class="option">--with-python</code></span></dt>
205
<dd><p> Build the <span class="application">PL/Python</span> server-side language.
207
<dt><span class="term"><code class="option">--with-tcl</code></span></dt>
208
<dd><p> Build the <span class="application">PL/Tcl</span> server-side language.
210
<dt><span class="term"><code class="option">--with-tclconfig=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt>
211
<dd><p> Tcl installs the file <code class="filename">tclConfig.sh</code>, which
212
contains configuration information needed to build modules
213
interfacing to Tcl. This file is normally found automatically
214
at a well-known location, but if you want to use a different
215
version of Tcl you can specify the directory in which to look
218
<dt><span class="term"><code class="option">--with-krb5</code></span></dt>
219
<dd><p> Build with support for Kerberos 5 authentication. On many
220
systems, the Kerberos system is not installed in a location
221
that is searched by default (e.g., <code class="filename">/usr/include</code>,
222
<code class="filename">/usr/lib</code>), so you must use the options
223
<code class="option">--with-includes</code> and <code class="option">--with-libraries</code> in
224
addition to this option. <code class="filename">configure</code> will check
225
for the required header files and libraries to make sure that
226
your Kerberos installation is sufficient before proceeding.
228
<dt><span class="term"><code class="option">--with-krb-srvnam=<em class="replaceable"><code>NAME</code></em></code></span></dt>
229
<dd><p> The default name of the Kerberos service principal.
230
<code class="literal">postgres</code> is the default. There's usually no
231
reason to change this.
233
<dt><span class="term"><code class="option">--with-openssl</code></span></dt>
234
<dd><p> Build with support for <acronym class="acronym">SSL</acronym> (encrypted)
235
connections. This requires the <span class="productname">OpenSSL</span>
236
package to be installed. <code class="filename">configure</code> will check
237
for the required header files and libraries to make sure that
238
your <span class="productname">OpenSSL</span> installation is sufficient
241
<dt><span class="term"><code class="option">--with-pam</code></span></dt>
242
<dd><p> Build with <acronym class="acronym">PAM</acronym><a name="id636485"></a>
243
(Pluggable Authentication Modules) support.
245
<dt><span class="term"><code class="option">--without-readline</code></span></dt>
246
<dd><p> Prevents use of the <span class="application">Readline</span> library. This disables
247
command-line editing and history in
248
<span class="application">psql</span>, so it is not recommended.
250
<dt><span class="term"><code class="option">--with-bonjour</code></span></dt>
251
<dd><p> Build with Bonjour support. This requires Bonjour support
252
in your operating system. Recommended on Mac OS X.
254
<dt><span class="term"><code class="option">--enable-integer-datetimes</code></span></dt>
255
<dd><p> Use 64-bit integer storage for datetimes and intervals, rather
256
than the default floating-point storage. This reduces the range
257
of representable values but guarantees microsecond precision across
260
<a href="datatype-datetime.html" title="8.5.�Date/Time Types">Section�8.5, “Date/Time Types”</a>
261
for more information). Note also that the integer datetimes code is
262
newer than the floating-point code, and we still find bugs in it from
265
<dt><span class="term"><code class="option">--disable-spinlocks</code></span></dt>
266
<dd><p> Allow the build to succeed even if <span class="productname">PostgreSQL</span>
267
has no CPU spinlock support for the platform. The lack of
268
spinlock support will result in poor performance; therefore,
269
this option should only be used if the build aborts and
270
informs you that the platform lacks spinlock support. If this
271
option is required to build <span class="productname">PostgreSQL</span> on
272
your platform, please report the problem to the
273
<span class="productname">PostgreSQL</span> developers.
275
<dt><span class="term"><code class="option">--enable-thread-safety</code></span></dt>
276
<dd><p> Make the client libraries thread-safe. This allows
277
concurrent threads in <span class="application">libpq</span> and
278
<span class="application">ECPG</span> programs to safely control
279
their private connection handles. This option requires adequate
280
threading support in your operating system.
282
<dt><span class="term"><code class="option">--without-zlib</code></span></dt>
283
<dd><p> <a name="id636625"></a>
284
Prevents use of the <span class="application">Zlib</span> library. This disables
285
support for compressed archives in <span class="application">pg_dump</span>
286
and <span class="application">pg_restore</span>.
287
This option is only intended for those rare systems where this
288
library is not available.
290
<dt><span class="term"><code class="option">--enable-debug</code></span></dt>
291
<dd><p> Compiles all programs and libraries with debugging symbols.
292
This means that you can run the programs through a debugger
293
to analyze problems. This enlarges the size of the installed
294
executables considerably, and on non-GCC compilers it usually
295
also disables compiler optimization, causing slowdowns. However,
296
having the symbols available is extremely helpful for dealing
297
with any problems that may arise. Currently, this option is
298
recommended for production installations only if you use GCC.
299
But you should always have it on if you are doing development work
300
or running a beta version.
302
<dt><span class="term"><code class="option">--enable-cassert</code></span></dt>
303
<dd><p> Enables <em class="firstterm">assertion</em> checks in the server, which test for
304
many “<span class="quote">can't happen</span>” conditions. This is invaluable for
305
code development purposes, but the tests slow things down a little.
306
Also, having the tests turned on won't necessarily enhance the
307
stability of your server! The assertion checks are not categorized
308
for severity, and so what might be a relatively harmless bug will
309
still lead to server restarts if it triggers an assertion
310
failure. Currently, this option is not recommended for
311
production use, but you should have it on for development work
312
or when running a beta version.
314
<dt><span class="term"><code class="option">--enable-depend</code></span></dt>
315
<dd><p> Enables automatic dependency tracking. With this option, the
316
makefiles are set up so that all affected object files will
317
be rebuilt when any header file is changed. This is useful
318
if you are doing development work, but is just wasted overhead
319
if you intend only to compile once and install. At present,
320
this option will work only if you use GCC.
325
<p> If you prefer a C compiler different from the one
326
<code class="filename">configure</code> picks, you can set the
327
environment variable <code class="envar">CC</code> to the program of your choice.
328
By default, <code class="filename">configure</code> will pick
329
<code class="filename">gcc</code> if available, else the platform's
330
default (usually <code class="filename">cc</code>). Similarly, you can override the
331
default compiler flags if needed with the <code class="envar">CFLAGS</code> variable.
333
<p> You can specify environment variables on the
334
<code class="filename">configure</code> command line, for example:
336
<pre class="screen"><strong class="userinput"><code>./configure CC=/opt/bin/gcc CFLAGS='-O2 -pipe'</code></strong></pre>
341
<p class="title"><b>Build</b></p>
342
<p> To start the build, type
344
<pre class="screen"><strong class="userinput"><code>gmake</code></strong></pre>
346
(Remember to use <acronym class="acronym">GNU</acronym> <span class="application">make</span>.) The build
347
may take anywhere from 5 minutes to half an hour depending on your
348
hardware. The last line displayed should be
350
<pre class="screen">All of PostgreSQL is successfully made. Ready to install.</pre>
355
<p class="title"><b>Regression Tests</b></p>
356
<a name="id636831"></a><p> If you want to test the newly built server before you install it,
357
you can run the regression tests at this point. The regression
358
tests are a test suite to verify that <span class="productname">PostgreSQL</span>
359
runs on your machine in the way the developers expected it
362
<pre class="screen"><strong class="userinput"><code>gmake check</code></strong></pre>
364
(This won't work as root; do it as an unprivileged user.)
366
<a href="regress.html" title="Chapter�27.�Regression Tests">Chapter�27, <i>Regression Tests</i></a> contains
367
detailed information about interpreting the test results. You can
368
repeat this test at any later time by issuing the same command.
372
<a name="install"></a><p class="title"><b>Installing The Files</b></p>
373
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
374
<h3 class="title">Note</h3>
375
<p> If you are upgrading an existing system and are going to install
376
the new files over the old ones, be sure to back up
377
your data and shut down the old server before proceeding, as explained in
378
<a href="install-upgrading.html" title="14.4.�If You Are Upgrading">Section�14.4, “If You Are Upgrading”</a> above.
381
<p> To install <span class="productname">PostgreSQL</span> enter
383
<pre class="screen"><strong class="userinput"><code>gmake install</code></strong></pre>
385
This will install files into the directories that were specified
386
in <a href="install-procedure.html#configure" title="Step 1">Step 1</a>. Make sure that you have appropriate
387
permissions to write into that area. Normally you need to do this
388
step as root. Alternatively, you could create the target
389
directories in advance and arrange for appropriate permissions to
392
<p> You can use <code class="literal">gmake install-strip</code> instead of
393
<code class="literal">gmake install</code> to strip the executable files and
394
libraries as they are installed. This will save some space. If
395
you built with debugging support, stripping will effectively
396
remove the debugging support, so it should only be done if
397
debugging is no longer needed. <code class="literal">install-strip</code>
398
tries to do a reasonable job saving space, but it does not have
399
perfect knowledge of how to strip every unneeded byte from an
400
executable file, so if you want to save all the disk space you
401
possibly can, you will have to do manual work.
403
<p> The standard installation provides all the header files needed for client
404
application development as well as for server-side program
405
development, such as custom functions or data types written in C.
406
(Prior to <span class="productname">PostgreSQL</span> 8.0, a separate <code class="literal">gmake
407
install-all-headers</code> command was needed for the latter, but this
408
step has been folded into the standard install.)
410
<p><b>Client-only installation:�</b> If you want to install only the client applications and
411
interface libraries, then you can use these commands:
413
<pre class="screen"><strong class="userinput"><code>gmake -C src/bin install</code></strong>
414
<strong class="userinput"><code>gmake -C src/include install</code></strong>
415
<strong class="userinput"><code>gmake -C src/interfaces install</code></strong>
416
<strong class="userinput"><code>gmake -C doc install</code></strong></pre>
421
<p><b>Registering <span class="application">eventlog</span> on <span class="systemitem">Windows</span>:�</b> To register a <span class="systemitem">Windows</span> <span class="application">eventlog</span>
422
library with the operating system, issue this command after installation:
424
<pre class="screen"><strong class="userinput"><code>regsvr32 <em class="replaceable"><code>pgsql_library_directory</code></em>/pgevent.dll</code></strong></pre>
426
This creates registry entries used by the event viewer.
428
<p><b>Uninstallation:�</b> To undo the installation use the command <code class="command">gmake
429
uninstall</code>. However, this will not remove any created directories.
431
<p><b>Cleaning:�</b> After the installation you can make room by removing the built
432
files from the source tree with the command <code class="command">gmake
433
clean</code>. This will preserve the files made by the <code class="command">configure</code>
434
program, so that you can rebuild everything with <code class="command">gmake</code>
435
later on. To reset the source tree to the state in which it was
436
distributed, use <code class="command">gmake distclean</code>. If you are going to
437
build for several platforms within the same source tree you must do
438
this and re-configure for each build. (Alternatively, use
439
a separate build tree for each platform, so that the source tree
442
<p> If you perform a build and then discover that your <code class="command">configure</code>
443
options were wrong, or if you change anything that <code class="command">configure</code>
444
investigates (for example, software upgrades), then it's a good
445
idea to do <code class="command">gmake distclean</code> before reconfiguring and
446
rebuilding. Without this, your changes in configuration choices
447
may not propagate everywhere they need to.