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