~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-updates

« back to all changes in this revision

Viewing changes to doc/src/sgml/installation.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

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