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