~ubuntu-branches/ubuntu/karmic/postgresql-8.4/karmic-proposed

1.2.5 by Martin Pitt
Import upstream version 8.4.5
1
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.325.2.7 2010/07/27 18:56:22 petere Exp $ -->
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2
3
<chapter id="installation">
4
 <title><![%standalone-include[<productname>PostgreSQL</>]]>
5
  Installation from Source Code</title>
6
7
 <indexterm zone="installation">
8
  <primary>installation</primary>
9
 </indexterm>
10
11
 <para>
12
  This <![%standalone-include;[document]]>
13
  <![%standalone-ignore;[chapter]]> describes the installation of
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
14
  <productname>PostgreSQL</productname> using the source code
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
15
  distribution.  (If you are installing a pre-packaged distribution,
16
  such as an RPM or Debian package, ignore this
17
  <![%standalone-include;[document]]>
18
  <![%standalone-ignore;[chapter]]>
19
  and read the packager's instructions instead.)
20
 </para>
21
22
 <sect1 id="install-short">
23
  <title>Short Version</title>
24
25
  <para>
26
<synopsis>
27
./configure
28
gmake
29
su
30
gmake install
31
adduser postgres
32
mkdir /usr/local/pgsql/data
33
chown postgres /usr/local/pgsql/data
34
su - postgres
35
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
36
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data &gt;logfile 2&gt;&amp;1 &amp;
37
/usr/local/pgsql/bin/createdb test
38
/usr/local/pgsql/bin/psql test
39
</synopsis>
40
   The long version is the rest of this
41
   <![%standalone-include;[document.]]>
42
   <![%standalone-ignore;[chapter.]]>
43
  </para>
44
 </sect1>
45
46
47
 <sect1 id="install-requirements">
48
  <title>Requirements</title>
49
50
  <para>
51
   In general, a modern Unix-compatible platform should be able to run
52
   <productname>PostgreSQL</>.
53
   The platforms that had received specific testing at the
54
   time of release are listed in <xref linkend="supported-platforms">
55
   below. In the <filename>doc</> subdirectory of the distribution
56
   there are several platform-specific <acronym>FAQ</> documents you
57
   might wish to consult if you are having trouble.
58
  </para>
59
60
  <para>
61
   The following software packages are required for building
62
   <productname>PostgreSQL</>:
63
64
   <itemizedlist>
65
    <listitem>
66
     <para>
67
      <indexterm>
68
       <primary>make</primary>
69
      </indexterm>
70
71
      <acronym>GNU</> <application>make</> is required; other
72
      <application>make</> programs will <emphasis>not</> work.
73
      <acronym>GNU</> <application>make</> is often installed under
74
      the name <filename>gmake</filename>; this document will always
75
      refer to it by that name. (On some systems
76
      <acronym>GNU</acronym> <application>make</> is the default tool with the name
77
      <filename>make</>.) To test for <acronym>GNU</acronym>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
78
      <application>make</application> enter:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
79
<screen>
80
<userinput>gmake --version</userinput>
81
</screen>
82
      It is recommended to use version 3.76.1 or later.
83
     </para>
84
    </listitem>
85
86
    <listitem>
87
     <para>
1.1.4 by Martin Pitt
Import upstream version 8.4.0
88
      You need an <acronym>ISO</>/<acronym>ANSI</> C compiler (at least
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
89
      C89-compliant). Recent
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
90
      versions of <productname>GCC</> are recommendable, but
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
91
      <productname>PostgreSQL</> is known to build using a wide variety
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
92
      of compilers from different vendors.
93
     </para>
94
    </listitem>
95
96
    <listitem>
97
     <para>
98
      <application>tar</> is required to unpack the source
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
99
      distribution, in addition to either
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
100
      <application>gzip</> or <application>bzip2</>.  In
101
      addition, <application>gzip</> is required to install the
102
      documentation.
103
     </para>
104
    </listitem>
105
106
    <listitem>
107
     <para>
108
      <indexterm>
109
       <primary>readline</primary>
110
      </indexterm>
111
      <indexterm>
112
       <primary>libedit</primary>
113
      </indexterm>
114
115
      The <acronym>GNU</> <productname>Readline</> library is used by
116
      default.  It allows <application>psql</application> (the
117
      PostgreSQL command line SQL interpreter) to remember each
118
      command you type, and allows you to use arrow keys to recall and
119
      edit previous commands.  This is very helpful and is strongly
120
      recommended.  If you don't want to use it then you must specify
1.1.4 by Martin Pitt
Import upstream version 8.4.0
121
      the <option>--without-readline</option> option to
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
122
      <filename>configure</>. As an alternative, you can often use the
123
      BSD-licensed <filename>libedit</filename> library, originally
124
      developed on <productname>NetBSD</productname>. The
125
      <filename>libedit</filename> library is
126
      GNU <productname>Readline</productname>-compatible and is used if
127
      <filename>libreadline</filename> is not found, or if
128
      <option>--with-libedit-preferred</option> is used as an 
129
      option to <filename>configure</>. If you are using a package-based
130
      Linux distribution, be aware that you need both the 
131
      <literal>readline</> and <literal>readline-devel</> packages, if 
132
      those are separate in your distribution.
133
     </para>
134
    </listitem>
135
136
    <listitem>
137
     <para>
138
      <indexterm>
139
       <primary>zlib</primary>
140
      </indexterm>
141
142
      The <productname>zlib</productname> compression library will be
143
      used by default. If you don't want to use it then you must
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
144
      specify the <option>--without-zlib</option> option to
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
145
      <filename>configure</filename>. Using this option disables
146
      support for compressed archives in <application>pg_dump</> and
147
      <application>pg_restore</>.
148
     </para>
149
    </listitem>
150
   </itemizedlist>
151
  </para>
152
153
  <para>
154
   The following packages are optional.  They are not required in the
155
   default configuration, but they are needed when certain build
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
156
   options are enabled, as explained below:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
157
158
   <itemizedlist>
159
    <listitem>
160
     <para>
161
      To build the server programming language
162
      <application>PL/Perl</application> you need a full
163
      <productname>Perl</productname> installation, including the
164
      <filename>libperl</filename> library and the header files.
165
      Since <application>PL/Perl</application> will be a shared
166
      library, the <indexterm><primary>libperl</primary></indexterm>
167
      <filename>libperl</filename> library must be a shared library
168
      also on most platforms.  This appears to be the default in
169
      recent <productname>Perl</productname> versions, but it was not
170
      in earlier versions, and in any case it is the choice of whomever
171
      installed Perl at your site.
1.2.5 by Martin Pitt
Import upstream version 8.4.5
172
      If you intend to make more than incidental use of
173
      <application>PL/Perl</application>, you should ensure that the
174
      <productname>Perl</productname> installation was built with the
175
      <literal>usemultiplicity</> option enabled (<literal>perl -V</>
176
      will show whether this is the case).
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
177
     </para>
178
179
     <para>
180
      If you don't have the shared library but you need one, a message
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
181
      like this will appear during the <productname>PostgreSQL</>
182
      build to point out this fact:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
183
<screen>
184
*** Cannot build PL/Perl because libperl is not a shared library.
185
*** You might have to rebuild your Perl installation.  Refer to
186
*** the documentation for details.
187
</screen>
188
      (If you don't follow the on-screen output you will merely notice
189
      that the <application>PL/Perl</application> library object,
190
      <filename>plperl.so</filename> or similar, will not be
191
      installed.)  If you see this, you will have to rebuild and
192
      install <productname>Perl</productname> manually to be able to
193
      build <application>PL/Perl</application>.  During the
194
      configuration process for <productname>Perl</productname>,
195
      request a shared library.
196
     </para>
197
    </listitem>
198
199
    <listitem>
200
     <para>
201
      To build the <application>PL/Python</> server programming
202
      language, you need a <productname>Python</productname>
203
      installation with the header files and the <application>distutils</application> module.
204
      The <application>distutils</application> module is included by default with
205
      <productname>Python</productname> 1.6 and later; users of
206
      earlier versions of <productname>Python</productname> will need
207
      to install it.
208
     </para>
209
210
     <para>
211
      Since <application>PL/Python</application> will be a shared
212
      library, the <indexterm><primary>libpython</primary></indexterm>
213
      <filename>libpython</filename> library must be a shared library
214
      also on most platforms.  This is not the case in a default
215
      <productname>Python</productname> installation.  If after
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
216
      building and installing <productname>PostgreSQL</> you have a file called
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
217
      <filename>plpython.so</filename> (possibly a different
218
      extension), then everything went well.  Otherwise you should
219
      have seen a notice like this flying by:
220
<screen>
221
*** Cannot build PL/Python because libpython is not a shared library.
222
*** You might have to rebuild your Python installation.  Refer to
223
*** the documentation for details.
224
</screen>
225
      That means you have to rebuild (part of) your
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
226
      <productname>Python</productname> installation to create this
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
227
      shared library.
228
     </para>
229
230
     <para>
231
      If you have problems, run <productname>Python</> 2.3 or later's
232
      configure using the <literal>--enable-shared</> flag.  On some
233
      operating systems you don't have to build a shared library, but
234
      you will have to convince the <productname>PostgreSQL</> build
235
      system of this.  Consult the <filename>Makefile</filename> in
236
      the <filename>src/pl/plpython</filename> directory for details.
237
     </para>
238
    </listitem>
239
240
    <listitem>
241
     <para>
242
      If you want to build the <application>PL/Tcl</application>
243
      procedural language, you of course need a <productname>Tcl</>
244
      installation.  If you are using a pre-8.4 release of
245
      <productname>Tcl</>, ensure that it was built without multithreading
246
      support.
247
     </para>
248
    </listitem>
249
250
    <listitem>
251
     <para>
252
      To enable Native Language Support (<acronym>NLS</acronym>), that
253
      is, the ability to display a program's messages in a language
254
      other than English, you need an implementation of the
255
      <application>Gettext</> <acronym>API</acronym>.  Some operating
256
      systems have this built-in (e.g., <systemitem
257
      class="osname">Linux</>, <systemitem class="osname">NetBSD</>,
258
      <systemitem class="osname">Solaris</>), for other systems you
259
      can download an add-on package from <ulink
1.1.6 by Martin Pitt
Import upstream version 8.4.2
260
      url="http://www.gnu.org/software/gettext/"></ulink>.
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
261
      If you are using the <application>Gettext</> implementation in
262
      the <acronym>GNU</acronym> C library then you will additionally
263
      need the <productname>GNU Gettext</productname> package for some
264
      utility programs.  For any of the other implementations you will
265
      not need it.
266
     </para>
267
    </listitem>
268
269
    <listitem>
270
     <para>
271
      <application>Kerberos</>, <productname>OpenSSL</>, 
272
      <productname>OpenLDAP</>, and/or
273
      <application>PAM</>, if you want to support authentication or
274
      encryption using these services.
275
     </para>
276
    </listitem>
277
   </itemizedlist>
278
  </para>
279
280
  <para>
1.2.5 by Martin Pitt
Import upstream version 8.4.5
281
   If you are building from a <productname>Git</productname> tree instead of
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
282
   using a released source package, or if you want to do server development,
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
283
   you also need the following packages:
284
285
   <itemizedlist>
286
    <listitem>
287
     <para>
288
      <indexterm>
289
       <primary>flex</primary>
290
      </indexterm>
291
      <indexterm>
292
       <primary>lex</primary>
293
      </indexterm>
294
      <indexterm>
295
       <primary>bison</primary>
296
      </indexterm>
297
      <indexterm>
298
       <primary>yacc</primary>
299
      </indexterm>
300
301
      GNU <application>Flex</> and <application>Bison</>
1.2.5 by Martin Pitt
Import upstream version 8.4.5
302
      are needed to build from a Git checkout, or if you changed the actual
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
303
      scanner and parser definition files. If you need them, be sure
304
      to get <application>Flex</> 2.5.4 or later and
305
      <application>Bison</> 1.875 or later. Other <application>lex</>
306
      and <application>yacc</> programs cannot be used.
307
     </para>
308
    </listitem>
1.1.4 by Martin Pitt
Import upstream version 8.4.0
309
    <listitem>
310
     <para>
311
      <indexterm>
312
       <primary>perl</primary>
313
      </indexterm>
314
1.2.5 by Martin Pitt
Import upstream version 8.4.5
315
      <application>Perl</> 5.8 or later is needed to build from a Git checkout,
1.1.4 by Martin Pitt
Import upstream version 8.4.0
316
      or if you changed the input files for any of the build steps that
317
      use Perl scripts.  If building on Windows you will need
318
      <application>Perl</> in any case.
319
     </para>
320
    </listitem>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
321
   </itemizedlist>
322
  </para>
323
324
  <para>
325
   If you need to get a <acronym>GNU</acronym> package, you can find
326
   it at your local <acronym>GNU</acronym> mirror site (see <ulink
327
   url="http://www.gnu.org/order/ftp.html"></>
328
   for a list) or at <ulink
329
   url="ftp://ftp.gnu.org/gnu/"></ulink>.
330
  </para>
331
332
  <para>
333
   Also check that you have sufficient disk space. You will need about
1.1.6 by Martin Pitt
Import upstream version 8.4.2
334
   100 MB for the source tree during compilation and about 20 MB for
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
335
   the installation directory. An empty database cluster takes about
1.1.6 by Martin Pitt
Import upstream version 8.4.2
336
   35 MB; databases take about five times the amount of space that a
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
337
   flat text file with the same data would take. If you are going to
338
   run the regression tests you will temporarily need up to an extra
1.1.6 by Martin Pitt
Import upstream version 8.4.2
339
   150 MB. Use the <command>df</command> command to check free disk
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
340
   space.
341
  </para>
342
 </sect1>
343
344
<![%standalone-ignore;[
345
 <sect1 id="install-getsource">
346
  <title>Getting The Source</title>
347
348
  <para>
349
   The <productname>PostgreSQL</> &version; sources can be obtained by
350
   anonymous FTP from <ulink
351
   url="ftp://ftp.postgresql.org/pub/source/v&version;/postgresql-&version;.tar.gz"></ulink>.
352
   Other download options can be found on our website:
353
   <ulink url="http://www.postgresql.org/download/"></ulink>. After you
354
   have obtained the file, unpack it:
355
<screen>
356
<userinput>gunzip postgresql-&version;.tar.gz</userinput>
357
<userinput>tar xf postgresql-&version;.tar</userinput>
358
</screen>
359
   This will create a directory
360
   <filename>postgresql-&version;</filename> under the current directory
361
   with the <productname>PostgreSQL</> sources.
362
   Change into that directory for the rest
363
   of the installation procedure.
364
  </para>
1.1.6 by Martin Pitt
Import upstream version 8.4.2
365
366
  <para>
367
   You can also get the source directly from the version control repository, see
1.2.5 by Martin Pitt
Import upstream version 8.4.5
368
   <xref linkend="sourcerepo">.
1.1.6 by Martin Pitt
Import upstream version 8.4.2
369
  </para>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
370
 </sect1>
371
]]>
372
373
 <sect1 id="install-upgrading">
374
  <title>Upgrading</title>
375
376
  <indexterm zone="install-upgrading">
377
   <primary>upgrading</primary>
378
  </indexterm>
379
380
  <para>
381
   These instructions assume that your existing installation is under the
382
   <filename>/usr/local/pgsql</> directory, and that the data area is in
383
   <filename>/usr/local/pgsql/data</>.  Substitute your paths
384
   appropriately.
385
  </para>
386
387
  <para>
388
   The internal data storage format typically changes in every major
389
   release of <productname>PostgreSQL</>. Therefore, if you are upgrading
390
   an existing installation that does not have a version number of
391
   <quote>&majorversion;.x</quote>, you must back up and restore your
392
   data.  If you are upgrading from <productname>PostgreSQL</>
393
   <quote>&majorversion;.x</quote>, the new version can use your current
394
   data files so you should skip the backup and restore steps below because
395
   they are unnecessary.
396
  </para>
397
398
  <procedure>
399
   <step>
400
    <para>
401
     If making a backup, make sure that your database is not being updated.
402
     This does not affect the integrity of the backup, but the changed
403
     data would of course not be included. If necessary, edit the
404
     permissions in the file <filename>/usr/local/pgsql/data/pg_hba.conf</>
405
     (or equivalent) to disallow access from everyone except you.
406
    </para>
407
408
    <para>
409
     <indexterm>
410
      <primary>pg_dumpall</primary>
411
      <secondary>use during upgrade</secondary>
412
     </indexterm>
413
414
     To back up your database installation, type:
415
<screen>
416
<userinput>pg_dumpall &gt; <replaceable>outputfile</></userinput>
417
</screen>
418
     If you need to preserve OIDs (such as when using them as
419
     foreign keys), then use the <option>-o</option> option when running
420
     <application>pg_dumpall</>.
421
    </para>
422
423
    <para>
424
     To make the backup, you can use the <application>pg_dumpall</application>
425
     command from the version you are currently running.  For best
426
     results, however, try to use the <application>pg_dumpall</application>
427
     command from <productname>PostgreSQL</productname> &version;,
428
     since this version contains bug fixes and improvements over older
429
     versions.  While this advice might seem idiosyncratic since you
430
     haven't installed the new version yet, it is advisable to follow
431
     it if you plan to install the new version in parallel with the
432
     old version.  In that case you can complete the installation
433
     normally and transfer the data later.  This will also decrease
434
     the downtime.
435
    </para>
436
   </step>
437
438
   <step>
439
    <para>
440
     Shut down the old server:
441
<screen>
442
<userinput>pg_ctl stop</>
443
</screen>
444
     On systems that have <productname>PostgreSQL</> started at boot time,
445
     there is probably a start-up file that will accomplish the same thing. For
446
     example, on a <systemitem class="osname">Red Hat Linux</> system one
1.1.4 by Martin Pitt
Import upstream version 8.4.0
447
     might find that this works:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
448
<screen>
449
<userinput>/etc/rc.d/init.d/postgresql stop</userinput>
450
</screen>
451
    </para>
452
   </step>
453
454
   <step>
455
    <para>
456
     If restoring from backup, rename or delete the old installation
457
     directory.  It is a good idea to rename the directory, rather than
458
     delete it, in case you have trouble and need to revert to it.  Keep
459
     in mind the directory might consume significant disk space.  To rename
460
     the directory, use a command like this:
461
<screen> 
462
<userinput>mv /usr/local/pgsql /usr/local/pgsql.old</>
463
</screen>
464
    </para>
465
   </step>
466
467
   <step>
468
    <para>
469
     Install the new version of <productname>PostgreSQL</productname> as
470
     outlined in <![%standalone-include[the next section.]]>
471
     <![%standalone-ignore[<xref linkend="install-procedure">.]]>
472
    </para>
473
   </step>
474
475
   <step>
476
    <para>
477
     Create a new database cluster if needed.  Remember that you must
478
     execute these commands while logged in to the special database user
479
     account (which you already have if you are upgrading).
480
<programlisting>
481
<userinput>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</>
482
</programlisting>
483
    </para>
484
   </step>
485
486
   <step>
487
    <para>
488
     Restore your previous <filename>pg_hba.conf</> and any
489
     <filename>postgresql.conf</> modifications.
490
    </para>
491
   </step>
492
493
   <step>
494
    <para>
1.1.4 by Martin Pitt
Import upstream version 8.4.0
495
     Start the database server, again using the special database user
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
496
     account:
497
<programlisting>
498
<userinput>/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data</>
499
</programlisting>
500
    </para>
501
   </step>
502
503
   <step>
504
    <para>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
505
     Finally, restore your data from backup with:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
506
<screen>
507
<userinput>/usr/local/pgsql/bin/psql -d postgres -f <replaceable>outputfile</></userinput>
508
</screen>
509
     using the <emphasis>new</> <application>psql</>.
510
    </para>
511
   </step>
512
  </procedure>
513
514
  <para>
515
   Further discussion appears in
516
   <![%standalone-include[the documentation,]]>
517
   <![%standalone-ignore[<xref linkend="migration">,]]>
518
   including instructions on how the previous installation can continue
519
   running while the new installation is installed.
520
  </para>
521
 </sect1>
522
523
524
 <sect1 id="install-procedure">
525
  <title>Installation Procedure</title>
526
527
  <procedure>
528
529
  <step id="configure">
530
   <title>Configuration</>
531
532
   <indexterm zone="configure">
533
    <primary>configure</primary>
534
   </indexterm>
535
536
   <para>
537
    The first step of the installation procedure is to configure the
538
    source tree for your system and choose the options you would like.
539
    This is done by running the <filename>configure</> script. For a
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
540
    default installation simply enter:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
541
<screen>
542
<userinput>./configure</userinput>
543
</screen>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
544
    This script will run a number of tests to determine values for various
545
    system dependent variables and detect any quirks of your
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
546
    operating system, and finally will create several files in the
547
    build tree to record what it found.  (You can also run
548
    <filename>configure</filename> in a directory outside the source
549
    tree if you want to keep the build directory separate.)
550
   </para>
551
552
   <para>
553
    The default configuration will build the server and utilities, as
554
    well as all client applications and interfaces that require only a
555
    C compiler. All files will be installed under
556
    <filename>/usr/local/pgsql</> by default.
557
   </para>
558
559
   <para>
560
    You can customize the build and installation process by supplying one
561
    or more of the following command line options to
562
    <filename>configure</filename>:
563
564
     <variablelist>
565
      <varlistentry>
566
       <term><option>--prefix=<replaceable>PREFIX</></option></term>
567
       <listitem>
568
        <para>
569
         Install all files under the directory <replaceable>PREFIX</>
570
         instead of <filename>/usr/local/pgsql</filename>. The actual
571
         files will be installed into various subdirectories; no files
572
         will ever be installed directly into the
573
         <replaceable>PREFIX</> directory.
574
        </para>
575
576
        <para>
577
         If you have special needs, you can also customize the
578
         individual subdirectories with the following options. However,
579
         if you leave these with their defaults, the installation will be
580
         relocatable, meaning you can move the directory after
581
         installation. (The <literal>man</> and <literal>doc</>
582
         locations are not affected by this.)
583
        </para>
584
585
        <para>
586
         For relocatable installs, you might want to use 
587
         <filename>configure</filename>'s <literal>--disable-rpath</>
588
         option.  Also, you will need to tell the operating system how
589
         to find the shared libraries.
590
        </para>
591
       </listitem>
592
      </varlistentry>
593
594
      <varlistentry>
595
       <term><option>--exec-prefix=<replaceable>EXEC-PREFIX</></option></term>
596
       <listitem>
597
        <para>
598
         You can install architecture-dependent files under a
599
         different prefix, <replaceable>EXEC-PREFIX</>, than what
600
         <replaceable>PREFIX</> was set to. This can be useful to
601
         share architecture-independent files between hosts. If you
602
         omit this, then <replaceable>EXEC-PREFIX</> is set equal to
603
         <replaceable>PREFIX</> and both architecture-dependent and
604
         independent files will be installed under the same tree,
605
         which is probably what you want.
606
        </para>
607
       </listitem>
608
      </varlistentry>
609
610
      <varlistentry>
611
       <term><option>--bindir=<replaceable>DIRECTORY</></option></term>
612
       <listitem>
613
        <para>
614
         Specifies the directory for executable programs. The default
615
         is <filename><replaceable>EXEC-PREFIX</>/bin</>, which
616
         normally means <filename>/usr/local/pgsql/bin</>.
617
        </para>
618
       </listitem>
619
      </varlistentry>
620
621
      <varlistentry>
622
       <term><option>--sysconfdir=<replaceable>DIRECTORY</></option></term>
623
       <listitem>
624
        <para>
625
         Sets the directory for various configuration files,
626
         <filename><replaceable>PREFIX</>/etc</> by default.
627
        </para>
628
       </listitem>
629
      </varlistentry>
630
631
      <varlistentry>
632
       <term><option>--libdir=<replaceable>DIRECTORY</></option></term>
633
       <listitem>
634
        <para>
635
         Sets the location to install libraries and dynamically loadable
636
         modules. The default is
637
         <filename><replaceable>EXEC-PREFIX</>/lib</>.
638
        </para>
639
       </listitem>
640
      </varlistentry>
641
642
      <varlistentry>
643
       <term><option>--includedir=<replaceable>DIRECTORY</></option></term>
644
       <listitem>
645
        <para>
646
         Sets the directory for installing C and C++ header files. The
647
         default is <filename><replaceable>PREFIX</>/include</>.
648
        </para>
649
       </listitem>
650
      </varlistentry>
651
652
      <varlistentry>
653
       <term><option>--datarootdir=<replaceable>DIRECTORY</></option></term>
654
       <listitem>
655
        <para>
656
         Sets the root directory for various types of read-only data
657
         files.  This only sets the default for some of the following
658
         options.  The default is
659
         <filename><replaceable>PREFIX</>/share</>.
660
        </para>
661
       </listitem>
662
      </varlistentry>
663
664
      <varlistentry>
665
       <term><option>--datadir=<replaceable>DIRECTORY</></option></term>
666
       <listitem>
667
        <para>
668
         Sets the directory for read-only data files used by the
669
         installed programs. The default is
670
         <filename><replaceable>DATAROOTDIR</></>. Note that this has
671
         nothing to do with where your database files will be placed.
672
        </para>
673
       </listitem>
674
      </varlistentry>
675
676
      <varlistentry>
677
       <term><option>--localedir=<replaceable>DIRECTORY</></option></term>
678
       <listitem>
679
        <para>
680
         Sets the directory for installing locale data, in particular
681
         message translation catalog files.  The default is
682
         <filename><replaceable>DATAROOTDIR</>/locale</>.
683
        </para>
684
       </listitem>
685
      </varlistentry>
686
687
      <varlistentry>
688
       <term><option>--mandir=<replaceable>DIRECTORY</></option></term>
689
       <listitem>
690
        <para>
691
         The man pages that come with <productname>PostgreSQL</> will be installed under
692
         this directory, in their respective
693
         <filename>man<replaceable>x</></> subdirectories.
694
         The default is <filename><replaceable>DATAROOTDIR</>/man</>.
695
        </para>
696
       </listitem>
697
      </varlistentry>
698
699
      <varlistentry>
700
       <term><option>--docdir=<replaceable>DIRECTORY</></option></term>
701
       <listitem>
702
        <para>
703
         Sets the root directory for installing documentation files,
704
         except <quote>man</> pages.  This only sets the default for
705
         the following options.  The default value for this option is
706
         <filename><replaceable>DATAROOTDIR</>/doc/postgresql</>.
707
        </para>
708
       </listitem>
709
      </varlistentry>
710
711
      <varlistentry>
712
       <term><option>--htmldir=<replaceable>DIRECTORY</></option></term>
713
       <listitem>
714
        <para>
715
         The HTML-formatted documentation for
716
         <productname>PostgreSQL</productname> will be installed under
717
         this directory.  The default is
718
         <filename><replaceable>DATAROOTDIR</></>.
719
        </para>
720
       </listitem>
721
      </varlistentry>
722
     </variablelist>
723
724
     <note>
725
      <para>
726
       Care has been taken to make it possible to install
727
       <productname>PostgreSQL</> into shared installation locations
728
       (such as <filename>/usr/local/include</filename>) without
729
       interfering with the namespace of the rest of the system. First,
730
       the string <quote><literal>/postgresql</literal></quote> is
731
       automatically appended to <varname>datadir</varname>,
732
       <varname>sysconfdir</varname>, and <varname>docdir</varname>,
733
       unless the fully expanded directory name already contains the
734
       string <quote><literal>postgres</></quote> or
735
       <quote><literal>pgsql</></quote>. For example, if you choose
736
       <filename>/usr/local</filename> as prefix, the documentation will
737
       be installed in <filename>/usr/local/doc/postgresql</filename>,
738
       but if the prefix is <filename>/opt/postgres</filename>, then it
739
       will be in <filename>/opt/postgres/doc</filename>. The public C
740
       header files of the client interfaces are installed into
741
       <varname>includedir</varname> and are namespace-clean. The
742
       internal header files and the server header files are installed
743
       into private directories under <varname>includedir</varname>. See
744
       the documentation of each interface for information about how to
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
745
       access its header files. Finally, a private subdirectory will
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
746
       also be created, if appropriate, under <varname>libdir</varname>
747
       for dynamically loadable modules.
748
      </para>
749
     </note>
750
    </para>
751
752
    <para>
753
     <variablelist>
754
      <varlistentry>
755
       <term><option>--with-includes=<replaceable>DIRECTORIES</></option></term>
756
       <listitem>
757
        <para>
758
         <replaceable>DIRECTORIES</> is a colon-separated list of
759
         directories that will be added to the list the compiler
760
         searches for header files. If you have optional packages
761
         (such as GNU <application>Readline</>) installed in a non-standard
762
         location,
763
         you have to use this option and probably also the corresponding
764
         <option>--with-libraries</> option.
765
        </para>
766
        <para>
767
         Example: <literal>--with-includes=/opt/gnu/include:/usr/sup/include</>.
768
        </para>
769
       </listitem>
770
      </varlistentry>
771
772
      <varlistentry>
773
       <term><option>--with-libraries=<replaceable>DIRECTORIES</></option></term>
774
       <listitem>
775
        <para>
776
         <replaceable>DIRECTORIES</> is a colon-separated list of
777
         directories to search for libraries. You will probably have
778
         to use this option (and the corresponding
779
         <option>--with-includes</> option) if you have packages
780
         installed in non-standard locations.
781
        </para>
782
        <para>
783
         Example: <literal>--with-libraries=/opt/gnu/lib:/usr/sup/lib</>.
784
        </para>
785
       </listitem>
786
      </varlistentry>
787
788
      <varlistentry>
789
       <term><option>--enable-nls<optional>=<replaceable>LANGUAGES</replaceable></optional></option></term>
790
       <listitem>
791
        <para>
792
         Enables Native Language Support (<acronym>NLS</acronym>),
793
         that is, the ability to display a program's messages in a
794
         language other than English.
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
795
         <replaceable>LANGUAGES</replaceable> is an optional space-separated
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
796
         list of codes of the languages that you want supported, for
797
         example <literal>--enable-nls='de fr'</>.  (The intersection
798
         between your list and the set of actually provided
799
         translations will be computed automatically.)  If you do not
800
         specify a list, then all available translations are
801
         installed.
802
        </para>
803
804
        <para>
805
         To use this option, you will need an implementation of the
806
         <application>Gettext</> API; see above.
807
        </para>
808
       </listitem>
809
      </varlistentry>
810
811
      <varlistentry>
812
       <term><option>--with-pgport=<replaceable>NUMBER</></option></term>
813
       <listitem>
814
        <para>
815
         Set <replaceable>NUMBER</> as the default port number for
816
         server and clients. The default is 5432. The port can always
817
         be changed later on, but if you specify it here then both
818
         server and clients will have the same default compiled in,
819
         which can be very convenient.  Usually the only good reason
820
         to select a non-default value is if you intend to run multiple
821
         <productname>PostgreSQL</> servers on the same machine.
822
        </para>
823
       </listitem>
824
      </varlistentry>
825
826
      <varlistentry>
827
       <term><option>--with-perl</option></term>
828
       <listitem>
829
        <para>
830
         Build the <application>PL/Perl</> server-side language.
831
        </para>
832
       </listitem>
833
      </varlistentry>
834
835
      <varlistentry>
836
       <term><option>--with-python</option></term>
837
       <listitem>
838
        <para>
839
         Build the <application>PL/Python</> server-side language.
840
        </para>
841
       </listitem>
842
      </varlistentry>
843
844
      <varlistentry>
845
       <term><option>--with-tcl</option></term>
846
       <listitem>
847
        <para>
848
         Build the <application>PL/Tcl</> server-side language.
849
        </para>
850
       </listitem>
851
      </varlistentry>
852
853
      <varlistentry>
854
       <term><option>--with-tclconfig=<replaceable>DIRECTORY</replaceable></option></term>
855
       <listitem>
856
        <para>
857
         Tcl installs the file <filename>tclConfig.sh</filename>, which
858
         contains configuration information needed to build modules
859
         interfacing to Tcl. This file is normally found automatically
860
         at a well-known location, but if you want to use a different
861
         version of Tcl you can specify the directory in which to look
862
         for it.
863
        </para>
864
       </listitem>
865
      </varlistentry>
866
867
      <varlistentry>
868
       <term><option>--with-gssapi</option></term>
869
       <listitem>
870
        <para>
871
         Build with support for GSSAPI authentication. On many
872
         systems, the GSSAPI (usually a part of the Kerberos installation)
873
         system is not installed in a location
874
         that is searched by default (e.g., <filename>/usr/include</>,
875
         <filename>/usr/lib</>), so you must use the options
876
         <option>--with-includes</> and <option>--with-libraries</> in
877
         addition to this option.  <filename>configure</> will check
878
         for the required header files and libraries to make sure that
879
         your GSSAPI installation is sufficient before proceeding.
880
        </para>
881
       </listitem>
882
      </varlistentry>
883
884
      <varlistentry>
885
       <term><option>--with-krb5</option></term>
886
       <listitem>
887
        <para>
888
         Build with support for Kerberos 5 authentication. On many
889
         systems, the Kerberos system is not installed in a location
890
         that is searched by default (e.g., <filename>/usr/include</>,
891
         <filename>/usr/lib</>), so you must use the options
892
         <option>--with-includes</> and <option>--with-libraries</> in
893
         addition to this option.  <filename>configure</> will check
894
         for the required header files and libraries to make sure that
895
         your Kerberos installation is sufficient before proceeding.
896
        </para>
897
       </listitem>
898
      </varlistentry>
899
900
      <varlistentry>
901
       <term><option>--with-krb-srvnam=<replaceable>NAME</></option></term>
902
       <listitem>
903
        <para>
904
         The default name of the Kerberos service principal (also used
905
         by GSSAPI).
906
         <literal>postgres</literal> is the default. There's usually no
907
         reason to change this unless you have a Windows environment,
908
         in which case it must be set to uppercase
909
         <literal>POSTGRES</literal>.
910
        </para>
911
       </listitem>
912
      </varlistentry>
913
914
      <varlistentry>
915
       <indexterm>
916
        <primary>OpenSSL</primary>
917
        <seealso>SSL</seealso>
918
       </indexterm>
919
920
       <term><option>--with-openssl</option></term>
921
       <listitem>
922
        <para>
923
         Build with support for <acronym>SSL</> (encrypted)
924
         connections. This requires the <productname>OpenSSL</>
925
         package to be installed.  <filename>configure</> will check
926
         for the required header files and libraries to make sure that
927
         your <productname>OpenSSL</> installation is sufficient
928
         before proceeding.
929
        </para>
930
       </listitem>
931
      </varlistentry>
932
933
      <varlistentry>
934
       <term><option>--with-pam</option></term>
935
       <listitem>
936
        <para>
937
         Build with <acronym>PAM</><indexterm><primary>PAM</></>
938
         (Pluggable Authentication Modules) support.
939
        </para>
940
       </listitem>
941
      </varlistentry>
942
943
      <varlistentry>
944
       <term><option>--with-ldap</option></term>
945
       <listitem>
946
        <para>
947
         Build with <acronym>LDAP</><indexterm><primary>LDAP</></>
948
         support for authentication and connection parameter lookup (see 
949
         <![%standalone-include[the documentation about client authentication
950
         and libpq]]><![%standalone-ignore[<xref linkend="libpq-ldap"> and
951
         <xref linkend="auth-ldap">]]> for more information). On Unix,
952
         this requires the <productname>OpenLDAP</> package to be
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
953
         installed. On Windows, the default <productname>WinLDAP</>
954
         library is used.  <filename>configure</> will check for the required
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
955
         header files and libraries to make sure that your
956
         <productname>OpenLDAP</> installation is sufficient before
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
957
         proceeding. 
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
958
        </para>
959
       </listitem>
960
      </varlistentry>
961
962
      <varlistentry>
963
       <term><option>--without-readline</option></term>
964
       <listitem>
965
        <para>
966
         Prevents use of the <application>Readline</> library
967
         (and <application>libedit</> as well).  This option disables
968
         command-line editing and history in
969
         <application>psql</application>, so it is not recommended.
970
        </para>
971
       </listitem>
972
      </varlistentry>
973
974
      <varlistentry>
975
       <term><option>--with-libedit-preferred</option></term>
976
       <listitem>
977
        <para>
978
         Favors the use of the BSD-licensed <application>libedit</> library
979
         rather than GPL-licensed <application>Readline</>.  This option
980
         is significant only if you have both libraries installed; the
981
         default in that case is to use <application>Readline</>.
982
        </para>
983
       </listitem>
984
      </varlistentry>
985
986
      <varlistentry>
987
       <term><option>--with-bonjour</option></term>
988
       <listitem>
989
        <para>
990
         Build with Bonjour support.  This requires Bonjour support
991
         in your operating system.  Recommended on Mac OS X.
992
        </para>
993
       </listitem>
994
      </varlistentry>
995
996
      <varlistentry>
997
       <term><option>--with-ossp-uuid</option></term>
998
       <listitem>
999
        <para>
1000
         Use the <ulink url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID
1001
         library</ulink> when building <filename>contrib/uuid-ossp</>.
1002
         The library provides functions to generate
1003
         UUIDs.<indexterm><primary>UUID</primary></indexterm>
1004
        </para>
1005
       </listitem>
1006
      </varlistentry>
1007
1008
      <varlistentry>
1009
       <term><option>--with-libxml</option></term>
1010
       <listitem>
1011
        <para>
1012
         Build with libxml (enables SQL/XML support).  Libxml version 2.6.23 or
1013
         later is required for this feature.
1014
        </para>
1015
1016
        <para>
1017
         Libxml installs a program <command>xml2-config</command> that
1018
         can be used to detect the required compiler and linker
1019
         options.  PostgreSQL will use it automatically if found.  To
1020
         specify a libxml installation at an unusual location, you can
1021
         either set the environment variable
1022
         <envar>XML2_CONFIG</envar> to point to the
1023
         <command>xml2-config</command> program belonging to the
1024
         installation, or use the options
1025
         <option>--with-includes</option> and
1026
         <option>--with-libraries</option>.
1027
        </para>
1028
       </listitem>
1029
      </varlistentry>
1030
1031
      <varlistentry>
1032
       <term><option>--with-libxslt</option></term>
1033
       <listitem>
1034
        <para>
1035
         Use libxslt when building <filename>contrib/xml2</>.
1036
         <filename>contrib/xml2</> relies on this library to perform
1037
         XSL transformations of XML.
1038
        </para>
1039
       </listitem>
1040
      </varlistentry>
1041
1042
      <varlistentry>
1043
       <term><option>--disable-integer-datetimes</option></term>
1044
       <listitem>
1045
        <para>
1046
         Disable support for 64-bit integer storage for timestamps and
1047
         intervals, and store datetime values as floating-point
1048
         numbers instead. Floating-point datetime storage was the
1049
         default in <productname>PostgreSQL</productname> releases
1050
         prior to 8.4, but it is now deprecated, because it does not
1051
         support microsecond precision for the full range of
1052
         <type>timestamp</type> values. However, integer-based
1053
         datetime storage requires a 64-bit integer type. Therefore,
1054
         this option can be used when no such type is available, or
1055
         for compatibility with applications written for prior
1056
         versions of <productname>PostgreSQL</productname>. See
1057
         <![%standalone-include[the documentation about datetime datatypes]]>
1058
         <![%standalone-ignore[<xref linkend="datatype-datetime">]]>
1059
         for more information.
1060
        </para>
1061
       </listitem>
1062
      </varlistentry>
1063
1064
      <varlistentry>
1065
       <term><option>--disable-float4-byval</option></term>
1066
       <listitem>
1067
        <para>
1068
         Disable passing float4 values <quote>by value</>, causing them
1069
         to be passed <quote>by reference</> instead.  This option costs
1070
         performance, but may be needed for compatibility with old
1071
         user-defined functions that are written in C and use the
1072
         <quote>version 0</> calling convention.  A better long-term
1073
         solution is to update any such functions to use the
1074
         <quote>version 1</> calling convention.
1075
        </para>
1076
       </listitem>
1077
      </varlistentry>
1078
1079
      <varlistentry>
1080
       <term><option>--disable-float8-byval</option></term>
1081
       <listitem>
1082
        <para>
1083
         Disable passing float8 values <quote>by value</>, causing them
1084
         to be passed <quote>by reference</> instead.  This option costs
1085
         performance, but may be needed for compatibility with old
1086
         user-defined functions that are written in C and use the
1087
         <quote>version 0</> calling convention.  A better long-term
1088
         solution is to update any such functions to use the
1089
         <quote>version 1</> calling convention.
1090
         Note that this option affects not only float8, but also int8 and some
1091
         related types such as timestamp.
1092
         On 32-bit platforms, <option>--disable-float8-byval</> is the default
1093
         and it is not allowed to select <option>--enable-float8-byval</>.
1094
        </para>
1095
       </listitem>
1096
      </varlistentry>
1097
1098
      <varlistentry>
1099
       <term><option>--with-segsize=<replaceable>SEGSIZE</replaceable></option></term>
1100
       <listitem>
1101
        <para>
1102
         Set the <firstterm>segment size</>, in gigabytes.  Large tables are
1103
         divided into multiple operating-system files, each of size equal
1104
         to the segment size.  This avoids problems with file size limits
1105
         that exist on many platforms.  The default segment size, 1 gigabyte,
1106
         is safe on all supported platforms.  If your operating system has
1107
         <quote>largefile</> support (which most do, nowadays), you can use
1108
         a larger segment size.  This can be helpful to reduce the number of
1109
         file descriptors consumed when working with very large tables.
1110
         But be careful not to select a value larger than is supported
1111
         by your platform and the filesystem(s) you intend to use.  Other
1112
         tools you might wish to use, such as <application>tar</>, could
1113
         also set limits on the usable file size.
1114
         It is recommended, though not absolutely required, that this value
1115
         be a power of 2.
1116
         Note that changing this value requires an initdb.
1117
        </para>
1118
       </listitem>
1119
      </varlistentry>
1120
1121
      <varlistentry>
1122
       <term><option>--with-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
1123
       <listitem>
1124
        <para>
1125
         Set the <firstterm>block size</>, in kilobytes.  This is the unit
1126
         of storage and I/O within tables.  The default, 8 kilobytes,
1127
         is suitable for most situations; but other values may be useful
1128
         in special cases.
1129
         The value must be a power of 2 between 1 and 32 (kilobytes).
1130
         Note that changing this value requires an initdb.
1131
        </para>
1132
       </listitem>
1133
      </varlistentry>
1134
1135
      <varlistentry>
1136
       <term><option>--with-wal-segsize=<replaceable>SEGSIZE</replaceable></option></term>
1137
       <listitem>
1138
        <para>
1139
         Set the <firstterm>WAL segment size</>, in megabytes.  This is
1140
         the size of each individual file in the WAL log.  It may be useful
1141
         to adjust this size to control the granularity of WAL log shipping.
1142
         The default size is 16 megabytes.
1143
         The value must be a power of 2 between 1 and 64 (megabytes).
1144
         Note that changing this value requires an initdb.
1145
        </para>
1146
       </listitem>
1147
      </varlistentry>
1148
1149
      <varlistentry>
1150
       <term><option>--with-wal-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
1151
       <listitem>
1152
        <para>
1153
         Set the <firstterm>WAL block size</>, in kilobytes.  This is the unit
1154
         of storage and I/O within the WAL log.  The default, 8 kilobytes,
1155
         is suitable for most situations; but other values may be useful
1156
         in special cases.
1157
         The value must be a power of 2 between 1 and 64 (kilobytes).
1158
         Note that changing this value requires an initdb.
1159
        </para>
1160
       </listitem>
1161
      </varlistentry>
1162
1163
      <varlistentry>
1164
       <term><option>--disable-spinlocks</option></term>
1165
       <listitem>
1166
        <para>
1167
         Allow the build to succeed even if <productname>PostgreSQL</>
1168
         has no CPU spinlock support for the platform.  The lack of
1169
         spinlock support will result in poor performance; therefore,
1170
         this option should only be used if the build aborts and
1171
         informs you that the platform lacks spinlock support. If this
1172
         option is required to build <productname>PostgreSQL</> on
1173
         your platform, please report the problem to the
1174
         <productname>PostgreSQL</> developers.
1175
        </para>
1176
       </listitem>
1177
      </varlistentry>
1178
1179
      <varlistentry>
1180
       <term><option>--enable-thread-safety</option></term>
1181
       <listitem>
1182
        <para>
1183
         Make the client libraries thread-safe.  This allows
1184
         concurrent threads in <application>libpq</application> and
1185
         <application>ECPG</application> programs to safely control
1186
         their private connection handles.  This option requires adequate
1187
         threading support in your operating system.
1188
        </para>
1189
       </listitem>
1190
      </varlistentry>
1191
1192
      <varlistentry>
1193
       <term><option>--with-system-tzdata=<replaceable>DIRECTORY</replaceable></option></term>
1194
       <indexterm>
1195
        <primary>time zone data</primary>
1196
       </indexterm>
1197
       <listitem>
1198
        <para>
1199
         <productname>PostgreSQL</> includes its own time zone database,
1200
         which it requires for date and time operations.  This time zone
1201
         database is in fact compatible with the <quote>zoneinfo</> time zone
1202
         database provided by many operating systems such as FreeBSD,
1203
         Linux, and Solaris, so it would be redundant to install it again.
1204
         When this option is used, the system-supplied time zone database
1205
         in <replaceable>DIRECTORY</replaceable> is used instead of the one
1206
         included in the PostgreSQL source distribution.
1207
         <replaceable>DIRECTORY</replaceable> must be specified as an
1208
         absolute path.  <filename>/usr/share/zoneinfo</filename> is a
1209
         likely directory on some operating systems.  Note that the
1210
         installation routine will not detect mismatching or erroneous time
1211
         zone data.  If you use this option, you are advised to run the
1212
         regression tests to verify that the time zone data you have
1213
         pointed to works correctly with <productname>PostgreSQL</>.
1214
        </para>
1215
1216
        <para>
1217
         This option is mainly aimed at binary package distributors
1218
         who know their target operating system well.  The main
1219
         advantage of using this option is that the PostgreSQL package
1220
         won't need to be upgraded whenever any of the many local
1221
         daylight-saving time rules change.  Another advantage is that
1222
         PostgreSQL can be cross-compiled<indexterm><primary>cross
1223
         compilation</primary></indexterm> more straightforwardly if the
1224
         time zone database files do not need to be built during the
1225
         installation.
1226
        </para>
1227
       </listitem>
1228
      </varlistentry>
1229
1230
      <varlistentry>
1231
       <term><option>--without-zlib</option></term>
1232
       <listitem>
1233
        <para>
1234
         <indexterm>
1235
          <primary>zlib</primary>
1236
         </indexterm>
1237
         Prevents use of the <application>Zlib</> library.  This disables
1238
         support for compressed archives in <application>pg_dump</application>
1239
         and <application>pg_restore</application>.
1240
         This option is only intended for those rare systems where this
1241
         library is not available.
1242
        </para>
1243
       </listitem>
1244
      </varlistentry>
1245
1246
      <varlistentry>
1247
       <term><option>--enable-debug</option></term>
1248
       <listitem>
1249
        <para>
1250
         Compiles all programs and libraries with debugging symbols.
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1251
         This means that you can run the programs in a debugger
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1252
         to analyze problems. This enlarges the size of the installed
1253
         executables considerably, and on non-GCC compilers it usually
1254
         also disables compiler optimization, causing slowdowns. However,
1255
         having the symbols available is extremely helpful for dealing
1256
         with any problems that might arise.  Currently, this option is
1257
         recommended for production installations only if you use GCC.
1258
         But you should always have it on if you are doing development work
1259
         or running a beta version.
1260
        </para>
1261
       </listitem>
1262
      </varlistentry>
1263
1264
      <varlistentry>
1265
       <term><option>--enable-coverage</option></term>
1266
       <listitem>
1267
        <para>
1268
         If using GCC, all programs and libraries are compiled with
1269
         code coverage testing instrumentation.  When run, they
1270
         generate files in the build directory with code coverage
1271
         metrics.
1272
         <![%standalone-ignore[See <xref linkend="regress-coverage">
1273
         for more information.]]> This option is for use only with GCC
1274
         and when doing development work.
1275
        </para>
1276
       </listitem>
1277
      </varlistentry>
1278
1279
      <varlistentry>
1280
       <term><option>--enable-profiling</option></term>
1281
       <listitem>
1282
        <para>
1283
         If using GCC, all programs and libraries are compiled so they
1284
         can be profiled.  On backend exit, a subdirectory will be created
1285
         that contains the <filename>gmon.out</> file for use in profiling.
1286
         This option is for use only with GCC and when doing development work.
1287
        </para>
1288
       </listitem>
1289
      </varlistentry>
1290
1291
      <varlistentry>
1292
       <term><option>--enable-cassert</option></term>
1293
       <listitem>
1294
        <para>
1295
         Enables <firstterm>assertion</> checks in the server, which test for
1296
         many <quote>cannot happen</> conditions.  This is invaluable for
1297
         code development purposes, but the tests can slow down the
1298
         server significantly.
1299
         Also, having the tests turned on won't necessarily enhance the
1300
         stability of your server!  The assertion checks are not categorized
1301
         for severity, and so what might be a relatively harmless bug will
1302
         still lead to server restarts if it triggers an assertion
1303
         failure.  This option is not recommended for production use, but
1304
         you should have it on for development work or when running a beta
1305
         version.
1306
        </para>
1307
       </listitem>
1308
      </varlistentry>
1309
1310
      <varlistentry>
1311
       <term><option>--enable-depend</option></term>
1312
       <listitem>
1313
        <para>
1314
         Enables automatic dependency tracking.  With this option, the
1315
         makefiles are set up so that all affected object files will
1316
         be rebuilt when any header file is changed.  This is useful
1317
         if you are doing development work, but is just wasted overhead
1318
         if you intend only to compile once and install.  At present,
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1319
         this option only works with GCC.
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1320
        </para>
1321
       </listitem>
1322
      </varlistentry>
1323
1324
      <varlistentry>
1325
       <term><option>--enable-dtrace</option></term>
1326
       <listitem>
1327
        <para>
1328
         <indexterm>
1329
          <primary>DTrace</primary>
1330
         </indexterm>
1331
         Compiles <productname>PostgreSQL</productname> with support for the
1332
         dynamic tracing tool DTrace.
1333
         <![%standalone-ignore[See <xref linkend="dynamic-trace">
1334
         for more information.]]>
1335
        </para>
1336
1337
        <para>
1338
         To point to the <command>dtrace</command> program, the
1339
         environment variable <envar>DTRACE</envar> can be set.  This
1340
         will often be necessary because <command>dtrace</command> is
1341
         typically installed under <filename>/usr/sbin</filename>,
1342
         which might not be in the path.
1343
        </para>
1344
1345
        <para>
1346
         Extra command-line options for the <command>dtrace</command> program
1347
         can be specified in the environment variable
1348
         <envar>DTRACEFLAGS</envar>.  On Solaris,
1349
         to include DTrace support in a 64-bit binary, you must specify
1350
         <literal>DTRACEFLAGS="-64"</> to configure.  For example,
1351
         using the GCC compiler:
1352
<screen>
1353
./configure CC='gcc -m64' --enable-dtrace DTRACEFLAGS='-64' ...
1354
</screen>
1355
         Using Sun's compiler:
1356
<screen>
1357
./configure CC='/opt/SUNWspro/bin/cc -xtarget=native64' --enable-dtrace DTRACEFLAGS='-64' ...
1358
</screen>
1359
        </para>
1360
       </listitem>
1361
      </varlistentry>
1362
1363
     </variablelist>
1364
    </para>
1365
1366
    <para>
1367
     If you prefer a C compiler different from the one
1368
     <filename>configure</filename> picks, you can set the
1369
     environment variable <envar>CC</> to the program of your choice.
1370
     By default, <filename>configure</filename> will pick
1371
     <filename>gcc</filename> if available, else the platform's
1372
     default (usually <filename>cc</>).  Similarly, you can override the
1373
     default compiler flags if needed with the <envar>CFLAGS</envar> variable.
1374
    </para>
1375
1376
    <para>
1377
     You can specify environment variables on the
1378
     <filename>configure</filename> command line, for example:
1379
<screen>
1380
<userinput>./configure CC=/opt/bin/gcc CFLAGS='-O2 -pipe'</>
1381
</screen>
1382
    </para>
1383
1384
    <para>
1385
     Here is a list of the significant variables that can be set in
1386
     this manner:
1387
 
1388
     <variablelist>
1389
      <varlistentry>
1390
       <term><envar>BISON</envar></term>
1391
       <listitem>
1392
        <para>
1393
         Bison program
1394
        </para>
1395
       </listitem>
1396
      </varlistentry>
1397
1398
      <varlistentry>
1399
       <term><envar>CC</envar></term>
1400
       <listitem>
1401
        <para>
1402
         C compiler
1403
        </para>
1404
       </listitem>
1405
      </varlistentry>
1406
1407
      <varlistentry>
1408
       <term><envar>CFLAGS</envar></term>
1409
       <listitem>
1410
        <para>
1411
         options to pass to the C compiler
1412
        </para>
1413
       </listitem>
1414
      </varlistentry>
1415
1416
      <varlistentry>
1417
       <term><envar>CPP</envar></term>
1418
       <listitem>
1419
        <para>
1420
         C preprocessor
1421
        </para>
1422
       </listitem>
1423
      </varlistentry>
1424
1425
      <varlistentry>
1426
       <term><envar>CPPFLAGS</envar></term>
1427
       <listitem>
1428
        <para>
1429
         options to pass to the C preprocessor
1430
        </para>
1431
       </listitem>
1432
      </varlistentry>
1433
1434
      <varlistentry>
1435
       <term><envar>DTRACE</envar></term>
1436
       <listitem>
1437
        <para>
1438
         location of the <command>dtrace</command> program
1439
        </para>
1440
       </listitem>
1441
      </varlistentry>
1442
1443
      <varlistentry>
1444
       <term><envar>DTRACEFLAGS</envar></term>
1445
       <listitem>
1446
        <para>
1447
         options to pass to the <command>dtrace</command> program
1448
        </para>
1449
       </listitem>
1450
      </varlistentry>
1451
1452
      <varlistentry>
1453
       <term><envar>FLEX</envar></term>
1454
       <listitem>
1455
        <para>
1456
         Flex program
1457
        </para>
1458
       </listitem>
1459
      </varlistentry>
1460
1461
      <varlistentry>
1462
       <term><envar>LDFLAGS</envar></term>
1463
       <listitem>
1464
        <para>
1465
         options to pass to the link editor
1466
        </para>
1467
       </listitem>
1468
      </varlistentry>
1469
1470
      <varlistentry>
1471
       <term><envar>LDFLAGS_SL</envar></term>
1472
       <listitem>
1473
        <para>
1474
         linker options for shared library linking
1475
        </para>
1476
       </listitem>
1477
      </varlistentry>
1478
1479
      <varlistentry>
1480
       <term><envar>MSGFMT</envar></term>
1481
       <listitem>
1482
        <para>
1483
         <command>msgfmt</command> program for native language support
1484
        </para>
1485
       </listitem>
1486
      </varlistentry>
1487
1488
      <varlistentry>
1489
       <term><envar>PERL</envar></term>
1490
       <listitem>
1491
        <para>
1492
         Full path to the Perl interpreter.  This will be used to
1493
         determine the dependencies for building PL/Perl.
1494
        </para>
1495
       </listitem>
1496
      </varlistentry>
1497
1498
      <varlistentry>
1499
       <term><envar>PYTHON</envar></term>
1500
       <listitem>
1501
        <para>
1502
         Full path to the Python interpreter.  This will be used to
1503
         determine the dependencies for building PL/Python.
1504
        </para>
1505
       </listitem>
1506
      </varlistentry>
1507
1508
      <varlistentry>
1509
       <term><envar>TCLSH</envar></term>
1510
       <listitem>
1511
        <para>
1512
         Full path to the Tcl interpreter.  This will be used to
1513
         determine the dependencies for building PL/Tcl, and it will
1514
         be substituted into Tcl scripts.
1515
        </para>
1516
       </listitem>
1517
      </varlistentry>
1518
1519
      <varlistentry>
1520
       <term><envar>XML2_CONFIG</envar></term>
1521
       <listitem>
1522
        <para>
1523
         <command>xml2-config</command> program used to locate the
1524
         libxml installation.
1525
        </para>
1526
       </listitem>
1527
      </varlistentry>
1528
     </variablelist>
1529
    </para>
1530
   </step>
1531
1532
  <step>
1533
   <title>Build</title>
1534
1535
   <para>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1536
    To start the build, type:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1537
<screen>
1538
<userinput>gmake</userinput>
1539
</screen>
1540
    (Remember to use <acronym>GNU</> <application>make</>.) The build
1541
    will take a few minutes depending on your
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1542
    hardware. The last line displayed should be:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1543
<screen>
1544
All of PostgreSQL is successfully made. Ready to install.
1545
</screen>
1546
   </para>
1547
  </step>
1548
1549
  <step>
1550
   <title>Regression Tests</title>
1551
1552
   <indexterm>
1553
    <primary>regression test</primary>
1554
   </indexterm>
1555
1556
   <para>
1557
    If you want to test the newly built server before you install it,
1558
    you can run the regression tests at this point. The regression
1559
    tests are a test suite to verify that <productname>PostgreSQL</>
1560
    runs on your machine in the way the developers expected it
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1561
    to. Type:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1562
<screen>
1563
<userinput>gmake check</userinput>
1564
</screen>
1565
    (This won't work as root; do it as an unprivileged user.)
1566
    <![%standalone-include[The file
1567
    <filename>src/test/regress/README</> and the
1568
    documentation contain]]>
1569
    <![%standalone-ignore[<xref linkend="regress"> contains]]>
1570
    detailed information about interpreting the test results. You can
1571
    repeat this test at any later time by issuing the same command.
1572
   </para>
1573
  </step>
1574
1575
  <step id="install">
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1576
   <title>Installing the Files</title>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1577
1578
   <note>
1579
    <para>
1580
     If you are upgrading an existing system and are going to install
1581
     the new files over the old ones, be sure to back up
1582
     your data and shut down the old server before proceeding, as explained in
1583
     <xref linkend="install-upgrading"> above.
1584
    </para>
1585
   </note>
1586
1587
   <para>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1588
    To install <productname>PostgreSQL</> enter:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1589
<screen>
1590
<userinput>gmake install</userinput>
1591
</screen>
1592
    This will install files into the directories that were specified
1593
    in <xref linkend="configure">. Make sure that you have appropriate
1594
    permissions to write into that area. Normally you need to do this
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1595
    step as root. Alternatively, you can create the target
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1596
    directories in advance and arrange for appropriate permissions to
1597
    be granted.
1598
   </para>
1599
1600
   <para>
1601
    You can use <literal>gmake install-strip</literal> instead of
1602
    <literal>gmake install</literal> to strip the executable files and
1603
    libraries as they are installed.  This will save some space.  If
1604
    you built with debugging support, stripping will effectively
1605
    remove the debugging support, so it should only be done if
1606
    debugging is no longer needed.  <literal>install-strip</literal>
1607
    tries to do a reasonable job saving space, but it does not have
1608
    perfect knowledge of how to strip every unneeded byte from an
1609
    executable file, so if you want to save all the disk space you
1610
    possibly can, you will have to do manual work.
1611
   </para>
1612
1613
   <para>
1614
    The standard installation provides all the header files needed for client
1615
    application development as well as for server-side program
1616
    development, such as custom functions or data types written in C.
1617
    (Prior to <productname>PostgreSQL</> 8.0, a separate <literal>gmake
1618
    install-all-headers</> command was needed for the latter, but this
1619
    step has been folded into the standard install.)
1620
   </para>
1621
1622
   <formalpara>
1623
    <title>Client-only installation:</title>
1624
    <para>
1625
     If you want to install only the client applications and
1626
     interface libraries, then you can use these commands:
1627
<screen>
1628
<userinput>gmake -C src/bin install</>
1629
<userinput>gmake -C src/include install</>
1630
<userinput>gmake -C src/interfaces install</>
1631
<userinput>gmake -C doc install</>
1632
</screen>
1633
    <filename>src/bin</> has a few binaries for server-only use,
1634
    but they are small.
1635
    </para>
1636
   </formalpara>
1637
  </step>
1638
  </procedure>
1639
1640
  <formalpara>
1641
   <title>Registering <application>eventlog</> on <systemitem 
1642
   class="osname">Windows</>:</title>
1643
   <para>
1644
    To register a <systemitem class="osname">Windows</> <application>eventlog</>
1645
    library with the operating system, issue this command after installation:
1646
<screen>
1647
<userinput>regsvr32 <replaceable>pgsql_library_directory</>/pgevent.dll</>
1648
</screen>
1649
    This creates registry entries used by the event viewer.
1650
   </para>
1651
  </formalpara>
1652
1653
  <formalpara>
1654
   <title>Uninstallation:</title>
1655
   <para>
1656
    To undo the installation use the command <command>gmake
1657
    uninstall</>. However, this will not remove any created directories.
1658
   </para>
1659
  </formalpara>
1660
1661
  <formalpara>
1662
   <title>Cleaning:</title>
1663
1664
   <para>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1665
    After the installation you can free disk space by removing the built
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1666
    files from the source tree with the command <command>gmake
1667
    clean</>. This will preserve the files made by the <command>configure</command>
1668
    program, so that you can rebuild everything with <command>gmake</>
1669
    later on. To reset the source tree to the state in which it was
1670
    distributed, use <command>gmake distclean</>. If you are going to
1671
    build for several platforms within the same source tree you must do
1.1.4 by Martin Pitt
Import upstream version 8.4.0
1672
    this and re-configure for each platform.  (Alternatively, use
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1673
    a separate build tree for each platform, so that the source tree
1674
    remains unmodified.)
1675
   </para>
1676
  </formalpara>
1677
1678
  <para>
1679
   If you perform a build and then discover that your <command>configure</>
1680
   options were wrong, or if you change anything that <command>configure</>
1681
   investigates (for example, software upgrades), then it's a good
1682
   idea to do <command>gmake distclean</> before reconfiguring and
1683
   rebuilding.  Without this, your changes in configuration choices
1684
   might not propagate everywhere they need to.
1685
  </para>
1686
 </sect1>
1687
1688
 <sect1 id="install-post">
1689
  <title>Post-Installation Setup</title>
1690
1691
  <sect2>
1692
   <title>Shared Libraries</title>
1693
1694
   <indexterm>
1695
    <primary>shared library</primary>
1696
   </indexterm>
1697
1698
   <para>
1.1.4 by Martin Pitt
Import upstream version 8.4.0
1699
    On some systems with shared libraries
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1700
    you need to tell the system how to find the newly installed
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1701
    shared libraries.  The systems on which this is
1702
    <emphasis>not</emphasis> necessary include <systemitem
1703
    class="osname">BSD/OS</>, <systemitem class="osname">FreeBSD</>,
1704
    <systemitem class="osname">HP-UX</>, <systemitem
1705
    class="osname">IRIX</>, <systemitem class="osname">Linux</>,
1706
    <systemitem class="osname">NetBSD</>, <systemitem
1707
    class="osname">OpenBSD</>, <systemitem class="osname">Tru64
1708
    UNIX</> (formerly <systemitem class="osname">Digital UNIX</>), and
1709
    <systemitem class="osname">Solaris</>.
1710
   </para>
1711
1712
   <para>
1713
    The method to set the shared library search path varies between
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1714
    platforms, but the most widely-used method is to set the
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1715
    environment variable <envar>LD_LIBRARY_PATH</> like so: In Bourne
1716
    shells (<command>sh</>, <command>ksh</>, <command>bash</>, <command>zsh</>):
1717
<programlisting>
1718
LD_LIBRARY_PATH=/usr/local/pgsql/lib
1719
export LD_LIBRARY_PATH
1720
</programlisting>
1721
    or in <command>csh</> or <command>tcsh</>:
1722
<programlisting>
1723
setenv LD_LIBRARY_PATH /usr/local/pgsql/lib
1724
</programlisting>
1725
    Replace <literal>/usr/local/pgsql/lib</> with whatever you set
1726
    <option><literal>--libdir</></> to in <xref linkend="configure">.
1727
    You should put these commands into a shell start-up file such as
1728
    <filename>/etc/profile</> or <filename>~/.bash_profile</>.  Some
1729
    good information about the caveats associated with this method can
1730
    be found at <ulink
1731
    url="http://www.visi.com/~barr/ldpath.html"></ulink>.
1732
   </para>
1733
1734
   <para>
1735
    On some systems it might be preferable to set the environment
1736
    variable <envar>LD_RUN_PATH</envar> <emphasis>before</emphasis>
1737
    building.
1738
   </para>
1739
1740
   <para>
1741
    On <systemitem class="osname">Cygwin</systemitem>, put the library
1742
    directory in the <envar>PATH</envar> or move the
1743
    <filename>.dll</filename> files into the <filename>bin</filename>
1744
    directory.
1745
   </para>
1746
1747
   <para>
1748
    If in doubt, refer to the manual pages of your system (perhaps
1749
    <command>ld.so</command> or <command>rld</command>). If you later
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1750
    get a message like:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1751
<screen>
1752
psql: error in loading shared libraries
1753
libpq.so.2.1: cannot open shared object file: No such file or directory
1754
</screen>
1755
    then this step was necessary.  Simply take care of it then.
1756
   </para>
1757
1758
   <para>
1759
    <indexterm>
1760
     <primary>ldconfig</primary>
1761
    </indexterm>
1762
    If you are on <systemitem class="osname">BSD/OS</>, <systemitem
1763
    class="osname">Linux</>, or <systemitem class="osname">SunOS 4</>
1764
    and you have root access you can run:
1765
<programlisting>
1766
/sbin/ldconfig /usr/local/pgsql/lib
1767
</programlisting>
1768
    (or equivalent directory) after installation to enable the
1769
    run-time linker to find the shared libraries faster.  Refer to the
1770
    manual page of <command>ldconfig</> for more information.  On
1771
    <systemitem class="osname">FreeBSD</>, <systemitem
1772
    class="osname">NetBSD</>, and <systemitem
1773
    class="osname">OpenBSD</> the command is:
1774
<programlisting>
1775
/sbin/ldconfig -m /usr/local/pgsql/lib
1776
</programlisting>
1777
    instead.  Other systems are not known to have an equivalent
1778
    command.
1779
   </para>
1780
  </sect2>
1781
1782
  <sect2>
1783
   <title>Environment Variables</title>
1784
1785
   <indexterm>
1786
    <primary><envar>PATH</envar></primary>
1787
   </indexterm>
1788
1789
   <para>
1790
    If you installed into <filename>/usr/local/pgsql</> or some other
1791
    location that is not searched for programs by default, you should
1792
    add <filename>/usr/local/pgsql/bin</> (or whatever you set
1793
    <option><literal>--bindir</></> to in <xref linkend="configure">)
1794
    into your <envar>PATH</>.  Strictly speaking, this is not
1795
    necessary, but it will make the use of <productname>PostgreSQL</>
1796
    much more convenient.
1797
   </para>
1798
1799
   <para>
1800
    To do this, add the following to your shell start-up file, such as
1801
    <filename>~/.bash_profile</> (or <filename>/etc/profile</>, if you
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1802
    want it to affect all users):
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1803
<programlisting>
1804
PATH=/usr/local/pgsql/bin:$PATH
1805
export PATH
1806
</programlisting>
1807
    If you are using <command>csh</> or <command>tcsh</>, then use this command:
1808
<programlisting>
1809
set path = ( /usr/local/pgsql/bin $path )
1810
</programlisting>
1811
   </para>
1812
1813
   <para>
1814
    <indexterm>
1815
     <primary><envar>MANPATH</envar></primary>
1816
    </indexterm>
1817
    To enable your system to find the <application>man</>
1818
    documentation, you need to add lines like the following to a
1819
    shell start-up file unless you installed into a location that is
1820
    searched by default:
1821
<programlisting>
1822
MANPATH=/usr/local/pgsql/man:$MANPATH
1823
export MANPATH
1824
</programlisting>
1825
   </para>
1826
1827
   <para>
1828
    The environment variables <envar>PGHOST</> and <envar>PGPORT</>
1829
    specify to client applications the host and port of the database
1830
    server, overriding the compiled-in defaults. If you are going to
1831
    run client applications remotely then it is convenient if every
1832
    user that plans to use the database sets <envar>PGHOST</>.  This
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1833
    is not required, however; the settings can be communicated via command
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1834
    line options to most client programs.
1835
   </para>
1836
  </sect2>
1837
 </sect1>
1838
1839
1840
<![%standalone-include;[
1841
 <sect1 id="install-getting-started">
1842
  <title>Getting Started</title>
1843
1844
  <para>
1845
   The following is a quick summary of how to get <productname>PostgreSQL</> up and
1846
   running once installed. The main documentation contains more information.
1847
  </para>
1848
1849
  <procedure>
1850
   <step>
1851
    <para>
1852
     Create a user account for the <productname>PostgreSQL</>
1853
     server. This is the user the server will run as. For production
1854
     use you should create a separate, unprivileged account
1855
     (<quote>postgres</> is commonly used). If you do not have root
1856
     access or just want to play around, your own user account is
1857
     enough, but running the server as root is a security risk and
1858
     will not work.
1859
<screen>
1860
<userinput>adduser postgres</>
1861
</screen>
1862
    </para>
1863
   </step>
1864
1865
   <step>
1866
    <para>
1867
     Create a database installation with the <command>initdb</>
1868
     command. To run <command>initdb</> you must be logged in to your
1869
     <productname>PostgreSQL</> server account. It will not work as
1870
     root.
1871
<screen>
1872
root# <userinput>mkdir /usr/local/pgsql/data</>
1873
root# <userinput>chown postgres /usr/local/pgsql/data</>
1874
root# <userinput>su - postgres</>
1875
postgres$ <userinput>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</>
1876
</screen>
1877
    </para>
1878
1879
    <para>
1880
     The <option>-D</> option specifies the location where the data
1881
     will be stored. You can use any path you want, it does not have
1882
     to be under the installation directory. Just make sure that the
1883
     server account can write to the directory (or create it, if it
1884
     doesn't already exist) before starting <command>initdb</>, as
1885
     illustrated here.
1886
    </para>
1887
   </step>
1888
1889
   <step>
1890
    <para>
1891
     At this point, if you did not use the <command>initdb</> <literal>-A</>
1892
     option, you might want to modify <filename>pg_hba.conf</> to control
1893
     local access to the server before you start it.  The default is to 
1894
     trust all local users.
1895
    </para>
1896
   </step>
1897
1898
   <step>
1899
    <para>
1900
     The previous <command>initdb</> step should have told you how to
1901
     start up the database server. Do so now. The command should look
1902
     something like:
1903
<programlisting>
1904
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
1905
</programlisting>
1906
     This will start the server in the foreground. To put the server
1907
     in the background use something like:
1908
<programlisting>
1909
nohup /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data \
1910
    &lt;/dev/null &gt;&gt;server.log 2&gt;&amp;1 &lt;/dev/null &amp;
1911
</programlisting>
1912
    </para>
1913
1914
    <para>
1915
     To stop a server running in the background you can type:
1916
<programlisting>
1917
kill `cat /usr/local/pgsql/data/postmaster.pid`
1918
</programlisting>
1919
    </para>
1920
   </step>
1921
1922
   <step>
1923
    <para>
1924
     Create a database:
1925
<screen>
1926
<userinput>createdb testdb</>
1927
</screen>
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
1928
     Then enter:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
1929
<screen>
1930
<userinput>psql testdb</>
1931
</screen>
1932
     to connect to that database. At the prompt you can enter SQL
1933
     commands and start experimenting.
1934
    </para>
1935
   </step>
1936
  </procedure>
1937
 </sect1>
1938
1939
 <sect1 id="install-whatnow">
1940
  <title>What Now?</title>
1941
1942
  <para>
1943
   <itemizedlist>
1944
    <listitem>
1945
     <para>
1946
      The <productname>PostgreSQL</> distribution contains a
1947
      comprehensive documentation set, which you should read sometime.
1948
      After installation, the documentation can be accessed by
1949
      pointing your browser to
1950
      <filename>/usr/local/pgsql/doc/html/index.html</>, unless you
1951
      changed the installation directories.
1952
     </para>
1953
1954
     <para>
1955
      The first few chapters of the main documentation are the Tutorial,
1956
      which should be your first reading if you are completely new to
1957
      <acronym>SQL</> databases.  If you are familiar with database
1958
      concepts then you want to proceed with part on server
1959
      administration, which contains information about how to set up
1960
      the database server, database users, and authentication.
1961
     </para>
1962
    </listitem>
1963
1964
    <listitem>
1965
     <para>
1966
      Usually, you will want to modify your computer so that it will
1967
      automatically start the database server whenever it boots. Some
1968
      suggestions for this are in the documentation.
1969
     </para>
1970
    </listitem>
1971
1972
    <listitem>
1973
     <para>
1974
      Run the regression tests against the installed server (using
1975
      <command>gmake installcheck</command>). If you didn't run the
1976
      tests before installation, you should definitely do it now. This
1977
      is also explained in the documentation.
1978
     </para>
1979
    </listitem>
1980
1981
    <listitem>
1982
     <para>
1983
      By default, <productname>PostgreSQL</> is configured to run on
1984
      minimal hardware.  This allows it to start up with almost any
1985
      hardware configuration. The default configuration is, however,
1986
      not designed for optimum performance. To achieve optimum
1987
      performance, several server parameters must be adjusted, the two
1988
      most common being <varname>shared_buffers</varname> and
1989
      <varname>work_mem</varname>.
1990
      Other parameters mentioned in the documentation also affect
1991
      performance.
1992
     </para>
1993
    </listitem>
1994
   </itemizedlist>
1995
  </para>
1996
 </sect1>
1997
]]>
1998
1999
2000
 <sect1 id="supported-platforms">
2001
  <title>Supported Platforms</title>
2002
2003
  <para>
2004
   A platform (that is, a CPU architecture and operating system combination)
2005
   is considered supported by the <productname>PostgreSQL</> development
2006
   community if the code contains provisions to work on that platform and
2007
   it has recently been verified to build and pass its regression tests
2008
   on that platform.  Currently, most testing of platform compatibility
2009
   is done automatically by test machines in the
2010
   <ulink url="http://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
2011
   If you are interested in using <productname>PostgreSQL</> on a platform
2012
   that is not represented in the build farm, but on which the code works
2013
   or can be made to work, you are strongly encouraged to set up a build
2014
   farm member machine so that continued compatibility can be assured.
2015
  </para>
2016
2017
  <para>
2018
   In general, <productname>PostgreSQL</> can be expected to work on
2019
   these CPU architectures: x86, x86_64, IA64, PowerPC,
2020
   PowerPC 64, S/390, S/390x, Sparc, Sparc 64, Alpha, ARM, MIPS, MIPSEL, M68K,
2021
   and PA-RISC.  Code support exists for M32R, NS32K, and VAX, but these
2022
   architectures are not known to have been tested recently.  It is often
2023
   possible to build on an unsupported CPU type by configuring with
2024
   <option>--disable-spinlocks</option>, but performance will be poor.
2025
  </para>
2026
2027
  <para>
2028
   <productname>PostgreSQL</> can be expected to work on these operating
2029
   systems: Linux (all recent distributions), Windows (Win2000 SP4 and later),
2030
   FreeBSD, OpenBSD, NetBSD, Mac OS X, AIX, HP/UX, IRIX, Solaris, Tru64 Unix,
2031
   and UnixWare.  Other Unix-like systems may also work but are not currently
2032
   being tested.  In most cases, all CPU architectures supported by
2033
   a given operating system will work.  Look in
2034
   the <xref linkend="installation-platform-notes"> below to see if
2035
   there is information
2036
   specific to your operating system, particularly if using an older system.
2037
  </para>
2038
2039
  <para>
2040
   If you have installation problems on a platform that is known
2041
   to be supported according to recent build farm results, please report
2042
   it to <email>pgsql-bugs@postgresql.org</email>.  If you are interested
2043
   in porting <productname>PostgreSQL</> to a new platform,
2044
   <email>pgsql-hackers@postgresql.org</email> is the appropriate place
2045
   to discuss that.
2046
  </para>
2047
 </sect1>
2048
2049
 <sect1 id="installation-platform-notes">
2050
  <title>Platform-Specific Notes</title>
2051
2052
  <para>
2053
   This section documents additional platform-specific issues
2054
   regarding the installation and setup of PostgreSQL.  Be sure to
2055
   read the installation instructions, and in
2056
   particular <xref linkend="install-requirements"> as well.  Also,
2057
   check <![%standalone-include[the
2058
   file <filename>src/test/regress/README</> and the documentation]]>
2059
   <![%standalone-ignore[<xref linkend="regress">]]> regarding the
2060
   interpretation of regression test results.
2061
  </para>
2062
2063
  <para>
2064
   Platforms that are not covered here have no known platform-specific
2065
   installation issues.
2066
  </para>
2067
2068
  <sect2 id="installation-notes-aix">
2069
   <title>AIX</title>
2070
2071
   <indexterm zone="installation-notes-aix">
2072
    <primary>AIX</primary>
2073
    <secondary>installation on</secondary>
2074
   </indexterm>
2075
2076
   <para>
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2077
    PostgreSQL works on AIX, but getting it installed properly can be
2078
    challenging.  AIX versions from 4.3.3 to 6.1 are considered supported.
2079
    You can use GCC or the native IBM compiler xlc.  In
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2080
    general, using recent versions of AIX and PostgreSQL helps.  Check
2081
    the build farm for up to date information about which versions of
2082
    AIX are known to work.
2083
   </para>
2084
2085
   <para>
2086
    Use the following <command>configure</command> flags in addition
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2087
    to your own if you have installed Readline or libz
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2088
    there: <literal>--with-includes=/usr/local/include
2089
    --with-libraries=/usr/local/lib</literal>.
2090
   </para>
2091
2092
   <para>
2093
    If you don't have a PowerPC or use GCC you might see rounding
2094
    differences in the geometry regression test.  There will probably
2095
    be warnings about 0.0/0.0 division and duplicate symbols which you
2096
    can safely ignore.
2097
   </para>
2098
2099
   <para>
2100
    Some of the AIX tools may be <quote>a little different</quote>
2101
    from what you may be accustomed to on other platforms.  If you are
2102
    looking for a version of <command>ldd</command>, useful for
2103
    determining what object code depends on what libraries, the
2104
    following URLs may help you:
2105
    <ulink url="http://www.faqs.org/faqs/aix-faq/part4/section-22.html"></ulink>,
2106
    <ulink url="http://www.han.de/~jum/aix/ldd.c"></ulink>.
2107
   </para>
2108
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2109
   <para>
2110
    <xref linkend="AIX-fixlevels"> shows the minimum recommended fix levels
2111
    for various AIX versions.  To check your current fix level, use
2112
    <command>oslevel -r</command> in AIX 4.3.3 to AIX 5.2 ML 7, or
2113
    <command>oslevel -s</command> in later versions.
2114
   </para>
2115
2116
   <table id="AIX-fixlevels">
2117
    <title>
2118
     Minimum recommended <systemitem class="osname">AIX</systemitem> fix levels
2119
    </title>
2120
2121
    <tgroup cols="2">
2122
     <thead>
2123
      <row>
2124
       <entry>AIX version</entry>
2125
       <entry>fix level</entry>
2126
      </row>
2127
     </thead>
2128
2129
     <tbody>
2130
      <row>
2131
       <entry>AIX 4.3.3</entry>
2132
       <entry>Maintenance Level 11 + post ML11 bundle</entry>
2133
      </row>
2134
2135
      <row>
2136
       <entry>AIX 5.1</entry>
2137
       <entry>Maintenance Level 9 + post ML9 bundle</entry>
2138
      </row>
2139
2140
      <row>
2141
       <entry>AIX 5.2</entry>
2142
       <entry>Technology Level 10 Service Pack 3</entry>
2143
      </row>
2144
2145
      <row>
2146
       <entry>AIX 5.3</entry>
2147
       <entry>Technology Level 7</entry>
2148
      </row>
2149
2150
      <row>
2151
       <entry>AIX 6.1</entry>
2152
       <entry>Base Level</entry>
2153
      </row>
2154
     </tbody>
2155
    </tgroup>
2156
   </table>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2157
2158
   <sect3>
2159
    <title>GCC issues</title>
2160
2161
    <para>
2162
     On AIX 5.3, there have been some problems getting PostgreSQL to
2163
     compile and run using GCC.
2164
    </para>
2165
2166
    <para>
2167
     You will want to use a version of GCC subsequent to 3.3.2,
2168
     particularly if you use a prepackaged version.  We had good
2169
     success with 4.0.1.  Problems with earlier versions seem to have
2170
     more to do with the way IBM packaged GCC than with actual issues
2171
     with GCC, so that if you compile GCC yourself, you might well
2172
     have success with an earlier version of GCC.
2173
    </para>
2174
   </sect3>
2175
2176
   <sect3>
2177
    <title>Unix-domain sockets broken</title>
2178
2179
    <para>
2180
     AIX 5.3 has a problem
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2181
     where <structname>sockaddr_storage</structname> is not defined to
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2182
     be large enough.  In version 5.3, IBM increased the size of
2183
     <structname>sockaddr_un</structname>, the address structure for
2184
     Unix-domain sockets, but did not correspondingly increase the
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2185
     size of <structname>sockaddr_storage</structname>.  The result of
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2186
     this is that attempts to use Unix-domain sockets with PostgreSQL
2187
     lead to libpq overflowing the data structure.  TCP/IP connections
2188
     work OK, but not Unix-domain sockets, which prevents the
2189
     regression tests from working.
2190
    </para>
2191
2192
    <para>
2193
     The problem was reported to IBM, and is recorded as bug report
1.1.4 by Martin Pitt
Import upstream version 8.4.0
2194
     PMR29657.  If you upgrade to maintenance level 5300-03 or later,
2195
     that will include this fix.  A quick workaround
2196
     is to alter <symbol>_SS_MAXSIZE</symbol> to 1025 in
2197
     <filename>/usr/include/sys/socket.h</filename>.  In either case,
2198
     recompile PostgreSQL once you have the corrected header file.
2199
    </para>
2200
   </sect3>
2201
2202
   <sect3>
2203
    <title>Internet address issues</title>
2204
2205
    <para>
2206
     PostgreSQL relies on the system's <function>getaddrinfo</> function
2207
     to parse IP addresses in <varname>listen_addresses</>,
2208
     <filename>pg_hba.conf</>, etc.  Older versions of AIX have assorted
2209
     bugs in this function.  If you have problems related to these settings,
2210
     updating to the appropriate fix level shown in <xref
2211
     linkend="AIX-fixlevels"> should take care of it.
2212
    </para>
2213
2214
    <!-- http://archives.postgresql.org/message-id/6064jt6cfm.fsf_-_@dba2.int.libertyrms.com -->
2215
2216
    <para>
2217
     One user reports:
2218
    </para>
2219
2220
    <para>
2221
     When implementing PostgreSQL version 8.1 on AIX 5.3, we
2222
     periodically ran into problems where the statistics collector
2223
     would <quote>mysteriously</quote> not come up successfully.  This
2224
     appears to be the result of unexpected behaviour in the IPv6
2225
     implementation.  It looks like PostgreSQL and IPv6 do not play
2226
     very well together at this time on AIX.
2227
    </para>
2228
2229
    <para>
2230
     Any of the following actions <quote>fix</quote> the problem.
2231
     <itemizedlist>
2232
      <listitem>
2233
       <para>
2234
        Delete the IPv6 address for localhost:
2235
<screen>
2236
(as root)
2237
# ifconfig lo0 inet6 ::1/0 delete
2238
</screen>
2239
       </para>
2240
      </listitem>
2241
2242
      <listitem>
2243
       <para>
2244
        Remove IPv6 from net services.  The
2245
        file <filename>/etc/netsvc.conf</filename> on AIX is roughly
2246
        equivalent to <filename>/etc/nsswitch.conf</filename> on
2247
        Solaris/Linux.  The default, on AIX, is thus:
2248
<programlisting>
2249
hosts=local,bind
2250
</programlisting>
2251
        Replace this with:
2252
<programlisting>
2253
hosts=local4,bind4
2254
</programlisting>
2255
        to deactivate searching for IPv6 addresses.
2256
       </para>
2257
      </listitem>
2258
     </itemizedlist>
2259
    </para>
2260
   </sect3>
2261
2262
   <sect3>
2263
    <title>Memory management</title>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2264
    <!-- http://archives.postgresql.org/message-id/603bgqmpl9.fsf@dba2.int.libertyrms.com -->
2265
2266
    <para>
2267
     AIX can be somewhat peculiar with regards to the way it does
2268
     memory management.  You can have a server with many multiples of
2269
     gigabytes of RAM free, but still get out of memory or address
2270
     space errors when running applications.  One example
2271
     is <command>createlang</command> failing with unusual errors.
2272
     For example, running as the owner of the PostgreSQL installation:
2273
<screen>
2274
-bash-3.00$ createlang plpgsql template1
2275
createlang: language installation failed: ERROR:  could not load library "/opt/dbs/pgsql748/lib/plpgsql.so": A memory address is not in the address space for the process.
2276
</screen>
1.2.5 by Martin Pitt
Import upstream version 8.4.5
2277
    Running as a non-owner in the group possessing the PostgreSQL
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2278
    installation:
2279
<screen>
2280
-bash-3.00$ createlang plpgsql template1
2281
createlang: language installation failed: ERROR:  could not load library "/opt/dbs/pgsql748/lib/plpgsql.so": Bad address
2282
</screen>
2283
     Another example is out of memory errors in the PostgreSQL server
2284
     logs, with every memory allocation near or greater than 256 MB
2285
     failing.
2286
    </para>
2287
2288
    <para>
2289
     The overall cause of all these problems is the default bittedness
2290
     and memory model used by the server process.  By default, all
2291
     binaries built on AIX are 32-bit.  This does not depend upon
2292
     hardware type or kernel in use.  These 32-bit processes are
2293
     limited to 4 GB of memory laid out in 256 MB segments using one
2294
     of a few models.  The default allows for less than 256 MB in the
2295
     heap as it shares a single segment with the stack.
2296
    </para>
2297
2298
    <para>
2299
     In the case of the <command>createlang</command> example, above,
2300
     check your umask and the permissions of the binaries in your
2301
     PostgreSQL installation.  The binaries involved in that example
2302
     were 32-bit and installed as mode 750 instead of 755.  Due to the
2303
     permissions being set in this fashion, only the owner or a member
2304
     of the possessing group can load the library.  Since it isn't
2305
     world-readable, the loader places the object into the process'
2306
     heap instead of the shared library segments where it would
2307
     otherwise be placed.
2308
    </para>
2309
2310
    <para>
2311
     The <quote>ideal</quote> solution for this is to use a 64-bit
2312
     build of PostgreSQL, but that is not always practical, because
2313
     systems with 32-bit processors can build, but not run, 64-bit
2314
     binaries.
2315
    </para>
2316
2317
    <para>
2318
     If a 32-bit binary is desired, set <symbol>LDR_CNTRL</symbol> to
2319
     <literal>MAXDATA=0x<replaceable>n</replaceable>0000000</literal>,
2320
     where 1 &lt;= n &lt;= 8, before starting the PostgreSQL server,
2321
     and try different values and <filename>postgresql.conf</filename>
2322
     settings to find a configuration that works satisfactorily.  This
2323
     use of <symbol>LDR_CNTRL</symbol> tells AIX that you want the
2324
     server to have <symbol>MAXDATA</symbol> bytes set aside for the
2325
     heap, allocated in 256 MB segments.  When you find a workable
2326
     configuration,
2327
     <command>ldedit</command> can be used to modify the binaries so
2328
     that they default to using the desired heap size.  PostgreSQL can
2329
     also be rebuilt, passing <literal>configure
2330
     LDFLAGS="-Wl,-bmaxdata:0x<replaceable>n</replaceable>0000000"</literal>
2331
     to achieve the same effect.
2332
    </para>
2333
2334
    <para>
2335
     For a 64-bit build, set <envar>OBJECT_MODE</envar> to 64 and
2336
     pass <literal>CC="gcc -maix64"</literal>
2337
     and <literal>LDFLAGS="-Wl,-bbigtoc"</literal>
2338
     to <command>configure</command>.  (Options for
2339
    <command>xlc</command> might differ.)  If you omit the export of
2340
    <envar>OBJECT_MODE</envar>, your build may fail with linker errors.  When
2341
    <envar>OBJECT_MODE</envar> is set, it tells AIX's build utilities
2342
    such as <command>ar</>, <command>as</>, and <command>ld</> what
2343
    type of objects to default to handling.
2344
    </para>
2345
2346
    <para>
2347
     By default, overcommit of paging space can happen.  While we have
2348
     not seen this occur, AIX will kill processes when it runs out of
2349
     memory and the overcommit is accessed.  The closest to this that
2350
     we have seen is fork failing because the system decided that
2351
     there was not enough memory for another process.  Like many other
2352
     parts of AIX, the paging space allocation method and
2353
     out-of-memory kill is configurable on a system- or process-wide
2354
     basis if this becomes a problem.
2355
    </para>
2356
2357
    <bibliography>
2358
     <title>References and resources</title>
2359
2360
     <biblioentry>
2361
      <biblioset relation="article">
2362
       <title><ulink url="http://publib.boulder.ibm.com/infocenter/pseries/topic/com.ibm.aix.doc/aixprggd/genprogc/lrg_prg_support.htm">Large Program Support</ulink></title>
2363
      </biblioset>
2364
      <biblioset relation="book">
2365
       <title>AIX Documentation: General Programming Concepts: Writing and Debugging Programs</title>
2366
      </biblioset>
2367
     </biblioentry>
2368
2369
     <biblioentry>
2370
      <biblioset relation="article">
2371
       <title><ulink url="http://publib.boulder.ibm.com/infocenter/pseries/topic/com.ibm.aix.doc/aixprggd/genprogc/address_space.htm">Program Address Space Overview</ulink></title>
2372
      </biblioset>
2373
      <biblioset relation="book">
2374
       <title>AIX Documentation: General Programming Concepts: Writing and Debugging Programs</title>
2375
      </biblioset>
2376
     </biblioentry>
2377
2378
     <biblioentry>
2379
      <biblioset relation="article">
2380
       <title><ulink url="http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.doc/aixbman/prftungd/resmgmt2.htm">Performance Overview of the Virtual Memory Manager (VMM)</ulink></title>
2381
      </biblioset>
2382
      <biblioset relation="book">
2383
       <title>AIX Documentation: Performance Management Guide</title>
2384
      </biblioset>
2385
     </biblioentry>
2386
2387
     <biblioentry>
2388
      <biblioset relation="article">
2389
       <title><ulink url="http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.doc/aixbman/prftungd/memperf7.htm">Page Space Allocation</ulink></title>
2390
      </biblioset>
2391
      <biblioset relation="book">
2392
       <title>AIX Documentation: Performance Management Guide</title>
2393
      </biblioset>
2394
     </biblioentry>
2395
2396
     <biblioentry>
2397
      <biblioset relation="article">
2398
       <title><ulink url="http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.doc/aixbman/prftungd/memperf6.htm">Paging-space thresholds tuning</ulink></title>
2399
      </biblioset>
2400
      <biblioset relation="book">
2401
       <title>AIX Documentation: Performance Management Guide</title>
2402
      </biblioset>
2403
     </biblioentry>
2404
2405
     <biblioentry>
2406
       <title><ulink url="  http://www.redbooks.ibm.com/abstracts/sg245674.html?Open">Developing and Porting C and C++ Applications on AIX</ulink></title>
2407
       <publisher>
2408
        <publishername>IBM Redbook</publishername>
2409
       </publisher>
2410
     </biblioentry>
2411
    </bibliography>
2412
   </sect3>
2413
  </sect2>
2414
2415
  <sect2 id="installation-notes-cygwin">
2416
   <title>Cygwin</title>
2417
2418
   <indexterm zone="installation-notes-cygwin">
1.2.3 by Martin Pitt
Import upstream version 8.4.3
2419
    <primary>Cygwin</primary>
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2420
    <secondary>installation on</secondary>
2421
   </indexterm>
2422
2423
   <para>
2424
    PostgreSQL can be built using Cygwin, a Linux-like environment for
2425
    Windows, but that method is inferior to the native Windows build
2426
    <![%standalone-ignore[(see <xref linkend="install-win32">)]]> and
2427
    is no longer recommended.
2428
   </para>
2429
2430
   <para>
2431
    When building from source, proceed according to the normal
2432
    installation procedure (i.e., <literal>./configure;
2433
    make</literal>; etc.), noting the following-Cygwin specific
2434
    differences:
2435
2436
    <itemizedlist>
2437
     <listitem>
2438
      <para>
2439
       Set your path to use the Cygwin bin directory before the
2440
       Windows utilities.  This will help prevent problems with
2441
       compilation.
2442
      </para>
2443
     </listitem>
2444
2445
     <listitem>
2446
      <para>
2447
       The GNU make command is called "make" not "gmake".
2448
      </para>
2449
     </listitem>
2450
2451
     <listitem>
2452
      <para>
2453
       The <command>adduser</command> command is not supported; use
2454
       the appropriate user management application on Windows NT,
2455
       2000, or XP.  Otherwise, skip this step.
2456
      </para>
2457
     </listitem>
2458
2459
     <listitem>
2460
      <para>
2461
       The <command>su</command> command is not supported; use ssh to
2462
       simulate su on Windows NT, 2000, or XP. Otherwise, skip this
2463
       step.
2464
      </para>
2465
     </listitem>
2466
2467
     <listitem>
2468
      <para>
2469
       OpenSSL is not supported.
2470
      </para>
2471
     </listitem>
2472
2473
     <listitem>
2474
      <para>
2475
       Start <command>cygserver</command> for shared memory support.
2476
       To do this, enter the command <literal>/usr/sbin/cygserver
2477
       &amp;</literal>.  This program needs to be running anytime you
2478
       start the PostgreSQL server or initialize a database cluster
2479
       (<command>initdb</command>).  The
2480
       default <command>cygserver</command> configuration may need to
2481
       be changed (e.g., increase <symbol>SEMMNS</symbol>) to prevent
2482
       PostgreSQL from failing due to a lack of system resources.
2483
      </para>
2484
     </listitem>
2485
2486
     <listitem>
2487
      <para>
2488
       The parallel regression tests (<literal>make check</literal>)
2489
       can generate spurious regression test failures due to
2490
       overflowing the <function>listen()</function> backlog queue
2491
       which causes connection refused errors or hangs.  You can limit
2492
       the number of connections using the make
2493
       variable <varname>MAX_CONNECTIONS</varname> thus:
2494
<programlisting>
2495
make MAX_CONNECTIONS=5 check
2496
</programlisting>
2497
       (On some systems you can have up to about 10 simultaneous
2498
       connections).
2499
      </para>
2500
     </listitem>
2501
    </itemizedlist>
2502
   </para>
2503
2504
   <para>
2505
    It is possible to install <command>cygserver</command> and the
2506
    PostgreSQL server as Windows NT services.  For information on how
2507
    to do this, please refer to the <filename>README</filename>
2508
    document included with the PostgreSQL binary package on Cygwin.
2509
    It is installed in the
2510
    directory <filename>/usr/share/doc/Cygwin</filename>.
2511
   </para>
2512
  </sect2>
2513
2514
  <sect2 id="installation-notes-hpux">
2515
   <title>HP-UX</title>
2516
2517
   <indexterm zone="installation-notes-hpux">
2518
    <primary>HP-UX</primary>
2519
    <secondary>installation on</secondary>
2520
   </indexterm>
2521
2522
   <para>
2523
    PostgreSQL 7.3+ should work on Series 700/800 PA-RISC machines
2524
    running HP-UX 10.X or 11.X, given appropriate system patch levels
2525
    and build tools.  At least one developer routinely tests on HP-UX
2526
    10.20, and we have reports of successful installations on HP-UX
2527
    11.00 and 11.11.
2528
   </para>
2529
2530
   <para>
2531
    Aside from the PostgreSQL source distribution, you will need GNU
2532
    make (HP's make will not do), and either GCC or HP's full ANSI C
1.2.5 by Martin Pitt
Import upstream version 8.4.5
2533
    compiler.  If you intend to build from Git sources rather than a
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2534
    distribution tarball, you will also need Flex (GNU lex) and Bison
2535
    (GNU yacc).  We also recommend making sure you are fairly
2536
    up-to-date on HP patches.  At a minimum, if you are building 64
2537
    bit binaries on on HP-UX 11.11 you may need PHSS_30966 (11.11) or a
2538
    successor patch otherwise <command>initdb</command> may hang:
2539
<literallayout>
2540
PHSS_30966  s700_800 ld(1) and linker tools cumulative patch
2541
</literallayout>
2542
2543
    On general principles you should be current on libc and ld/dld
2544
    patches, as well as compiler patches if you are using HP's C
2545
    compiler.  See HP's support sites such
2546
    as <ulink url="http://itrc.hp.com"></ulink> and
2547
    <ulink url="ftp://us-ffs.external.hp.com/"></ulink> for free
2548
    copies of their latest patches.
2549
   </para>
2550
2551
   <para>
2552
    If you are building on a PA-RISC 2.0 machine and want to have
2553
    64-bit binaries using GCC, you must use GCC 64-bit version. GCC
2554
    binaries for HP-UX PA-RISC and Itanium are available from
2555
    <ulink url="http://www.hp.com/go/gcc"></ulink>.  Don't forget to
2556
    get and install binutils at the same time.
2557
   </para>
2558
2559
   <para>
2560
    If you are building on a PA-RISC 2.0 machine and want the compiled
2561
    binaries to run on PA-RISC 1.1 machines you will need to specify
2562
    <option>+DAportable</option> in <envar>CFLAGS</envar>.
2563
   </para>
2564
2565
   <para>
2566
    If you are building on a HP-UX Itanium machine, you will need the
2567
    latest HP ANSI C compiler with its dependent patch or successor
2568
    patches:
2569
<literallayout>
2570
PHSS_30848  s700_800 HP C Compiler (A.05.57)
2571
PHSS_30849  s700_800 u2comp/be/plugin library Patch
2572
</literallayout>
2573
   </para>
2574
2575
   <para>
2576
    If you have both HP's C compiler and GCC's, then you might want to
2577
    explicitly select the compiler to use when you
2578
    run <command>configure</command>:
2579
<programlisting>
2580
./configure CC=cc
2581
</programlisting>
2582
    for HP's C compiler, or
2583
<programlisting>
2584
./configure CC=gcc
2585
</programlisting>
2586
    for GCC.  If you omit this setting, then configure will
2587
    pick <command>gcc</command> if it has a choice.
2588
   </para>
2589
2590
   <para>
2591
    The default install target location
2592
    is <filename>/usr/local/pgsql</filename>, which you might want to
2593
    change to something under <filename>/opt</filename>.  If so, use
2594
    the
2595
    <option>--prefix</option> switch to <command>configure</command>.
2596
   </para>
2597
2598
   <para>
2599
    In the regression tests, there might be some low-order-digit
2600
    differences in the geometry tests, which vary depending on which
2601
    compiler and math library versions you use.  Any other error is
2602
    cause for suspicion.
2603
   </para>
2604
  </sect2>
2605
2606
  <sect2 id="installation-notes-irix">
2607
   <title>IRIX</title>
2608
2609
   <indexterm zone="installation-notes-irix">
2610
    <primary>IRIX</primary>
2611
    <secondary>installation on</secondary>
2612
   </indexterm>
2613
2614
   <para>
2615
    PostgreSQL has been reported to run successfully on MIPS r8000,
2616
    r10000 (both ip25 and ip27) and r12000(ip35) processors, running
2617
    IRIX 6.5.5m, 6.5.12, 6.5.13, and 6.5.26 with MIPSPro compilers
2618
    version 7.30, 7.3.1.2m, 7.3, and 7.4.4m.
2619
   </para>
2620
2621
   <para>
2622
    You will need the MIPSPro full ANSI C compiler.  There are
2623
    problems trying to build with GCC.  It is a known GCC bug (not
2624
    fixed as of version 3.0) related to using functions that return
2625
    certain kinds of structures. This bug affects functions like
2626
    <function>inet_ntoa</>, <function>inet_lnaof</>, <function>inet_netof</>, <function>inet_makeaddr</>,
2627
    and <function>semctl</>.  It is supposed to be fixed by forcing
2628
    code to link those functions with libgcc, but this has not been
2629
    tested yet.
2630
   </para>
2631
2632
   <para>
2633
    It is known that version 7.4.1m of the MIPSPro compiler generates
2634
    incorrect code.  The symptom is <quote>invalid primary checkpoint
2635
    record</quote> when trying to start the database.)  Version 7.4.4m
2636
    is OK; the status of intermediate versions is uncertain.
2637
   </para>
2638
2639
   <para>
2640
    There may be a compilation problem like the following:
2641
<screen>
2642
cc-1020 cc: ERROR File = pqcomm.c, Line = 427
2643
  The identifier "TCP_NODELAY" is undefined.
2644
2645
                if (setsockopt(port->sock, IPPROTO_TCP, TCP_NODELAY,
2646
</screen>
2647
    Some versions include TCP definitions
2648
    in <filename>sys/xti.h</filename>, so it is necessary to
2649
    add <literal>#include &lt;sys/xti.h&gt;</literal>
2650
    in <filename>src/backend/libpq/pqcomm.c</> and in
2651
    <filename>src/interfaces/libpq/fe-connect.c</>.  If you encounter
2652
    this, please let us know so we can develop a proper fix.
2653
   </para>
2654
2655
   <para>
2656
    In the regression tests, there might be some low-order-digit
2657
    differences in the geometry tests, depending on which FPU are you
2658
    using.  Any other error is cause for suspicion.
2659
   </para>
2660
  </sect2>
2661
2662
  <sect2 id="installation-notes-mingw">
2663
   <title>MinGW/Native Windows</title>
2664
2665
   <indexterm zone="installation-notes-mingw">
2666
    <primary>MinGW</primary>
2667
    <secondary>installation on</secondary>
2668
   </indexterm>
2669
2670
   <para>
2671
    PostgreSQL for Windows can be built using MinGW, a Unix-like build
2672
    environment for Microsoft operating systems, or using
2673
    Microsoft's <productname>Visual C++</productname> compiler suite.
2674
    The MinGW build variant uses the normal build system described in
2675
    this chapter; the Visual C++ build works completely differently
2676
    and is described in <![%standalone-include[the
2677
    documentation]]><![%standalone-ignore[<xref linkend="install-win32">]]>.
2678
    It is a fully native build and uses no additional software like
1.2.3 by Martin Pitt
Import upstream version 8.4.3
2679
    MinGW.  A ready-made installer is available on the main
2680
    PostgreSQL web site.
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2681
   </para>   
2682
2683
   <para>
1.2.3 by Martin Pitt
Import upstream version 8.4.3
2684
    The native Windows port requires a 32 or 64-bit version of Windows
2685
    2000 or later. Earlier operating systems do
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2686
    not have sufficient infrastructure (but Cygwin may be used on
2687
    those).  MinGW, the Unix-like build tools, and MSYS, a collection
2688
    of Unix tools required to run shell scripts
2689
    like <command>configure</command>, can be downloaded
2690
    from <ulink url="http://www.mingw.org/"></ulink>.  Neither is
2691
    required to run the resulting binaries; they are needed only for
2692
    creating the binaries.
2693
   </para>
2694
2695
   <para>
2696
    After you have everything installed, it is suggested that you
2697
    run <application>psql</application>
2698
    under <command>CMD.EXE</command>, as the MSYS console has
2699
    buffering issues.
2700
   </para>
2701
  </sect2>
2702
2703
  <sect2 id="installation-notes-sco">
2704
   <title>SCO OpenServer and SCO UnixWare</title>
2705
2706
   <indexterm zone="installation-notes-sco">
2707
    <primary>SCO</primary>
2708
    <secondary>installation on</secondary>
2709
   </indexterm>
2710
2711
   <indexterm zone="installation-notes-sco">
2712
    <primary>UnixWare</primary>
2713
    <secondary>installation on</secondary>
2714
   </indexterm>
2715
2716
   <para>
2717
    PostgreSQL can be built on SCO UnixWare 7 and SCO OpenServer 5.
2718
    On OpenServer, you can use either the OpenServer Development Kit
2719
    or the Universal Development Kit.  However, some tweaking may be
2720
    needed, as described below.
2721
   </para>
2722
2723
   <sect3>
2724
    <title>Skunkware</title>
2725
2726
    <para>
2727
     You should locate your copy of the SCO Skunkware CD.  The
2728
     Skunkware CD is included with UnixWare 7 and current versions of
2729
     OpenServer 5.  Skunkware includes ready-to-install versions of
2730
     many popular programs that are available on the Internet.  For
2731
     example, gzip, gunzip, GNU Make, Flex, and Bison are all
2732
     included.  For UnixWare 7.1, this CD is now labeled "Open License
2733
     Software Supplement".  If you do not have this CD, the software
1.1.6 by Martin Pitt
Import upstream version 8.4.2
2734
     on it is available
2735
     from <ulink url="http://www.sco.com/skunkware/"></ulink>.
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
2736
    </para>
2737
2738
    <para>
2739
     Skunkware has different versions for UnixWare and OpenServer.
2740
     Make sure you install the correct version for your operating
2741
     system, except as noted below.
2742
    </para>
2743
2744
    <para>
2745
     On UnixWare 7.1.3 and beyond, the GCC compiler is included on the
2746
     UDK CD as is GNU Make.
2747
    </para>
2748
   </sect3>
2749
2750
   <sect3>
2751
    <title>GNU Make</title>
2752
2753
    <para>
2754
     You need to use the GNU Make program, which is on the Skunkware
2755
     CD.  By default, it installs
2756
     as <filename>/usr/local/bin/make</filename>.  To avoid confusion
2757
     with the SCO <filename>make</filename> program, you may want to rename GNU <filename>make</filename> to
2758
     <filename>gmake</filename>.
2759
    </para>
2760
2761
    <para>
2762
     As of UnixWare 7.1.3 and above, the GNU Make program is is the
2763
     OSTK portion of the UDK CD, and is
2764
     in <filename>/usr/gnu/bin/gmake</filename>.
2765
    </para>
2766
   </sect3>
2767
2768
   <sect3>
2769
    <title>Readline</title>
2770
2771
    <para>
2772
     The Readline library is on the Skunkware CD.  But it is not
2773
     included on the UnixWare 7.1 Skunkware CD.  If you have the
2774
     UnixWare 7.0.0 or 7.0.1 Skunkware CDs, you can install it from
2775
     there.  Otherwise,
2776
     try <ulink url="ftp://ftp.sco.com/skunkware"></ulink>.
2777
    </para>
2778
2779
    <para>
2780
     By default, Readline installs into <filename>/usr/local/lib</> and
2781
     <filename>/usr/local/include</>.  However, the
2782
     PostgreSQL <command>configure</command> program will not find it
2783
     there without help.  If you installed Readline, then use the
2784
     following options to <command>configure</command>:
2785
<programlisting>
2786
./configure --with-libraries=/usr/local/lib --with-includes=/usr/local/include
2787
</programlisting>
2788
    </para>
2789
   </sect3>
2790
2791
   <sect3>
2792
    <title>Using the UDK on OpenServer</title>
2793
2794
    <para>
2795
     If you are using the new Universal Development Kit (UDK) compiler
2796
     on OpenServer, you need to specify the locations of the UDK
2797
     libraries:
2798
<programlisting>
2799
./configure --with-libraries=/udk/usr/lib --with-includes=/udk/usr/include
2800
</programlisting>
2801
     Putting these together with the Readline options from above:
2802
<programlisting>
2803
./configure --with-libraries="/udk/usr/lib /usr/local/lib" --with-includes="/udk/usr/include /usr/local/include"
2804
</programlisting>
2805
    </para>
2806
   </sect3>
2807
2808
   <sect3>
2809
    <title>Reading the PostgreSQL man pages</title>
2810
2811
    <para>
2812
     By default, the PostgreSQL man pages are installed into
2813
     <filename>/usr/local/pgsql/man</filename>.  By default, UnixWare
2814
     does not look there for man pages.  To be able to read them you
2815
     need to modify the
2816
     <varname>MANPATH</varname> variable
2817
     in <filename>/etc/default/man</filename>, for example:
2818
<programlisting>
2819
MANPATH=/usr/lib/scohelp/%L/man:/usr/dt/man:/usr/man:/usr/share/man:scohelp:/usr/local/man:/usr/local/pgsql/man
2820
</programlisting>
2821
    </para>
2822
2823
    <para>
2824
     On OpenServer, some extra research needs to be invested to make
2825
     the man pages usable, because the man system is a bit different
2826
     from other platforms.  Currently, PostgreSQL will not install
2827
     them at all.
2828
    </para>
2829
   </sect3>
2830
2831
   <sect3>
2832
    <title>C99 Issues with the 7.1.1b Feature Supplement</title>
2833
2834
    <para>
2835
     For compilers earlier than the one released with OpenUNIX 8.0.0
2836
     (UnixWare 7.1.2), including the 7.1.1b Feature Supplement, you
2837
     may need to specify <option>-Xb</option>
2838
     in <varname>CFLAGS</varname> or the <varname>CC</varname>
2839
     environment variable.  The indication of this is an error in
2840
     compiling <filename>tuplesort.c</filename> referencing inline
2841
     functions.  Apparently there was a change in the 7.1.2(8.0.0)
2842
     compiler and beyond.
2843
    </para>
2844
   </sect3>
2845
2846
   <sect3>
2847
    <title><option>--enable-thread-safety</option> and UnixWare</title>
2848
2849
    <para>
2850
     If you use the <command>configure</command>
2851
     option <option>--enable-thread-safety</option>,
2852
     you <emphasis>must</emphasis> use <option>-Kpthread</option>
2853
     on <emphasis>all</emphasis> libpq-using programs.  libpq
2854
     uses <function>pthread_*</function> calls, which are only
2855
     available with the
2856
     <option>-Kpthread</>/<option>-Kthread</> flag.
2857
    </para>
2858
   </sect3>
2859
  </sect2>
2860
2861
  <sect2 id="installation-notes-solaris">
2862
   <title>Solaris</title>
2863
2864
   <indexterm zone="installation-notes-solaris">
2865
    <primary>Solaris</primary>
2866
    <secondary>installation on</secondary>
2867
   </indexterm>
2868
2869
   <para>
2870
    PostgreSQL is well-supported on Solaris.  The more up to date your
2871
    operating system, the fewer issues you will experience; details
2872
    below.
2873
   </para>
2874
2875
   <para>
2876
    Note that PostgreSQL is bundled with Solaris 10 (from update 2).
2877
    Official packages are also available on
2878
    <ulink url="http://pgfoundry.org/projects/solarispackages/"></ulink>.
2879
    Packages for older Solaris versions (8, 9) you can be obtained
2880
    from <ulink url="http://www.sunfreeware.com/"></ulink> or
2881
    <ulink url="http://www.blastwave.org/"></ulink>.
2882
   </para>
2883
2884
   <sect3>
2885
    <title>Required tools</title>
2886
2887
    <para>
2888
     You can build with either GCC or Sun's compiler suite.  For
2889
     better code optimization, Sun's compiler is strongly recommended
2890
     on the SPARC architecture.  We have heard reports of problems
2891
     when using GCC 2.95.1; gcc 2.95.3 or later is recommended.  If
2892
     you are using Sun's compiler, be careful not to select
2893
     <filename>/usr/ucb/cc</filename>;
2894
     use <filename>/opt/SUNWspro/bin/cc</filename>.
2895
    </para>
2896
2897
    <para>
2898
     You can download Sun Studio
2899
     from <ulink url="http://developers.sun.com/sunstudio/downloads/"></ulink>.
2900
     Many of GNU tools are integrated into Solaris 10, or they are
2901
     present on the Solaris companion CD.  If you like packages for
2902
     older version of Solaris, you can find these tools
2903
     at <ulink url="http://www.sunfreeware.com"></ulink>
2904
     or <ulink url="http://www.blastwave.org"></ulink>.  If you prefer
2905
     sources, look
2906
     at <ulink url="http://www.gnu.org/order/ftp.html"></ulink>.
2907
    </para>
2908
   </sect3>
2909
2910
   <sect3>
2911
    <title>Problems with OpenSSL</title>
2912
2913
    <para>
2914
     When you build PostgreSQL with OpenSSL support you might get
2915
     compilation errors in the following files:
2916
     <itemizedlist>
2917
      <listitem><para><filename>src/backend/libpq/crypt.c</filename></para></listitem>
2918
      <listitem><para><filename>src/backend/libpq/password.c</filename></para></listitem>
2919
      <listitem><para><filename>src/interfaces/libpq/fe-auth.c</filename></para></listitem>
2920
      <listitem><para><filename>src/interfaces/libpq/fe-connect.c</filename></para></listitem>
2921
     </itemizedlist>
2922
2923
     This is because of a namespace conflict between the standard
2924
     <filename>/usr/include/crypt.h</filename> header and the header
2925
     files provided by OpenSSL.
2926
    </para>
2927
2928
    <para>
2929
     Upgrading your OpenSSL installation to version 0.9.6a fixes this
2930
     problem.  Solaris 9 and above has a newer version of OpenSSL.
2931
    </para>
2932
   </sect3>
2933
2934
   <sect3>
2935
    <title>configure complains about a failed test program</title>
2936
2937
    <para>
2938
     If <command>configure</command> complains about a failed test
2939
     program, this is probably a case of the run-time linker being
2940
     unable to find some library, probably libz, libreadline or some
2941
     other non-standard library such as libssl.  To point it to the
2942
     right location, set the <envar>LDFLAGS</envar> environment
2943
     variable on the <command>configure</command> command line, e.g.,
2944
<programlisting>
2945
configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"
2946
</programlisting>
2947
     See
2948
     the <citerefentry><refentrytitle>ld</><manvolnum>1</></citerefentry>
2949
     man page for more information.
2950
    </para>
2951
   </sect3>
2952
2953
   <sect3>
2954
    <title>64-bit build sometimes crashes</title>
2955
2956
    <para>
2957
     On Solaris 7 and older, the 64-bit version of libc has a buggy
2958
     <function>vsnprintf</function> routine, which leads to erratic
2959
     core dumps in PostgreSQL.  The simplest known workaround is to
2960
     force PostgreSQL to use its own version of vsnprintf rather than
2961
     the library copy.  To do this, after you
2962
     run <command>configure</command> edit a file produced by
2963
     <command>configure</command>:
2964
     In <filename>src/Makefile.global</filename>, change the line
2965
<programlisting>
2966
LIBOBJS =
2967
</programlisting>
2968
     to read
2969
<programlisting>
2970
LIBOBJS = snprintf.o
2971
</programlisting>
2972
     (There might be other files already listed in this variable.
2973
     Order does not matter.)  Then build as usual.
2974
    </para>
2975
   </sect3>
2976
2977
   <sect3>
2978
    <title>Compiling for optimal performance</title>
2979
2980
    <para>
2981
     On the SPARC architecture, Sun Studio is strongly recommended for
2982
     compilation.  Try using the <option>-xO5</option> optimization
2983
     flag to generate significantly faster binaries.  Do not use any
2984
     flags that modify behavior of floating-point operations
2985
     and <varname>errno</varname> processing (e.g.,
2986
     <option>-fast</option>).  These flags could raise some
2987
     nonstandard PostgreSQL behavior for example in the date/time
2988
     computing.
2989
    </para>
2990
2991
    <para>
2992
     If you do not have a reason to use 64-bit binaries on SPARC,
2993
     prefer the 32-bit version.  The 64-bit operations are slower and
2994
     64-bit binaries are slower than the 32-bit variants.  And on
2995
     other hand, 32-bit code on the AMD64 CPU family is not native,
2996
     and that is why 32-bit code is significant slower on this CPU
2997
     family.
2998
    </para>
2999
3000
    <para>
3001
     Some tricks for tuning PostgreSQL and Solaris for performance can
3002
     be found
3003
     at <ulink url="http://www.sun.com/servers/coolthreads/tnb/applications_postgresql.jsp"></ulink>.
3004
     This article is primary focused on T2000 platform, but many of
3005
     the recommendations are also useful on other hardware with
3006
     Solaris.
3007
    </para>
3008
   </sect3>
3009
3010
   <sect3>
3011
    <title>Using DTrace for tracing PostgreSQL</title>
3012
3013
    <para>
3014
     Yes, using DTrace is possible.  See <![%standalone-include[the
3015
     documentation]]>
3016
     <![%standalone-ignore[<xref linkend="dynamic-trace">]]> for further
3017
     information.  You can also find more information in this
3018
     article: <ulink url="http://blogs.sun.com/robertlor/entry/user_level_dtrace_probes_in"></ulink>.
3019
    </para>
3020
3021
    <para>
3022
     If you see the linking of the postgres executable abort with an
1.1.2 by Martin Pitt
Import upstream version 8.4~beta1+cvs20090503
3023
     error message like:
1 by Martin Pitt
Import upstream version 8.4~0cvs20090328
3024
<screen>
3025
Undefined                       first referenced
3026
 symbol                             in file
3027
AbortTransaction                    utils/probes.o
3028
CommitTransaction                   utils/probes.o
3029
ld: fatal: Symbol referencing errors. No output written to postgres
3030
collect2: ld returned 1 exit status
3031
gmake: *** [postgres] Error 1
3032
</screen>
3033
     your DTrace installation is too old to handle probes in static
3034
     functions.  You need Solaris 10u4 or newer.
3035
    </para>
3036
   </sect3>
3037
  </sect2>
3038
 </sect1>
3039
3040
</chapter>