1 <!-- doc/src/sgml/installation.sgml -->
4 Use </link> not just </> so INSTALL.html can be created without links
5 to the main documentation. Don't use <xref>.
9 <chapter id="installation">
10 <title><![%standalone-include[<productname>PostgreSQL</>]]>
11 Installation from Source Code</title>
13 <indexterm zone="installation">
14 <primary>installation</primary>
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.)
28 <sect1 id="install-short">
29 <title>Short Version</title>
38 mkdir /usr/local/pgsql/data
39 chown postgres /usr/local/pgsql/data
41 /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
42 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
43 /usr/local/pgsql/bin/createdb test
44 /usr/local/pgsql/bin/psql test
46 The long version is the rest of this
47 <![%standalone-include;[document.]]>
48 <![%standalone-ignore;[chapter.]]>
53 <sect1 id="install-requirements">
54 <title>Requirements</title>
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.
67 The following software packages are required for building
68 <productname>PostgreSQL</>:
74 <primary>make</primary>
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:
86 <userinput>gmake --version</userinput>
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.
103 <application>tar</> is required to unpack the source
104 distribution, in addition to either
105 <application>gzip</> or <application>bzip2</>.
112 <primary>readline</primary>
115 <primary>libedit</primary>
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.
142 <primary>zlib</primary>
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</>.
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:
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).
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:
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.
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.
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">]]>
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:
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.
231 That means you have to rebuild (part of) your
232 <productname>Python</productname> installation to create this
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.
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
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
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.
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:
295 <primary>flex</primary>
298 <primary>lex</primary>
301 <primary>bison</primary>
304 <primary>yacc</primary>
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.
318 <primary>perl</primary>
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.
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>.
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
350 <![%standalone-ignore;[
351 <sect1 id="install-getsource">
352 <title>Getting The Source</title>
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:
362 <userinput>gunzip postgresql-&version;.tar.gz</userinput>
363 <userinput>tar xf postgresql-&version;.tar</userinput>
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.
373 You can also get the source directly from the version control repository, see
374 <xref linkend="sourcerepo">.
379 <sect1 id="install-procedure">
380 <title>Installation Procedure</title>
384 <step id="configure">
385 <title>Configuration</title>
387 <indexterm zone="configure">
388 <primary>configure</primary>
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:
397 <userinput>./configure</userinput>
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>
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>
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.
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>:
430 <term><option>--prefix=<replaceable>PREFIX</></option></term>
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.
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.)
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.
459 <term><option>--exec-prefix=<replaceable>EXEC-PREFIX</></option></term>
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.
475 <term><option>--bindir=<replaceable>DIRECTORY</></option></term>
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</>.
486 <term><option>--sysconfdir=<replaceable>DIRECTORY</></option></term>
489 Sets the directory for various configuration files,
490 <filename><replaceable>PREFIX</>/etc</> by default.
496 <term><option>--libdir=<replaceable>DIRECTORY</></option></term>
499 Sets the location to install libraries and dynamically loadable
500 modules. The default is
501 <filename><replaceable>EXEC-PREFIX</>/lib</>.
507 <term><option>--includedir=<replaceable>DIRECTORY</></option></term>
510 Sets the directory for installing C and C++ header files. The
511 default is <filename><replaceable>PREFIX</>/include</>.
517 <term><option>--datarootdir=<replaceable>DIRECTORY</></option></term>
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</>.
529 <term><option>--datadir=<replaceable>DIRECTORY</></option></term>
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.
541 <term><option>--localedir=<replaceable>DIRECTORY</></option></term>
544 Sets the directory for installing locale data, in particular
545 message translation catalog files. The default is
546 <filename><replaceable>DATAROOTDIR</>/locale</>.
552 <term><option>--mandir=<replaceable>DIRECTORY</></option></term>
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</>.
564 <term><option>--docdir=<replaceable>DIRECTORY</></option></term>
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</>.
576 <term><option>--htmldir=<replaceable>DIRECTORY</></option></term>
579 The HTML-formatted documentation for
580 <productname>PostgreSQL</productname> will be installed under
581 this directory. The default is
582 <filename><replaceable>DATAROOTDIR</></>.
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.
619 <term><option>--with-includes=<replaceable>DIRECTORIES</></option></term>
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
627 you have to use this option and probably also the corresponding
628 <option>--with-libraries</> option.
631 Example: <literal>--with-includes=/opt/gnu/include:/usr/sup/include</>.
637 <term><option>--with-libraries=<replaceable>DIRECTORIES</></option></term>
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.
647 Example: <literal>--with-libraries=/opt/gnu/lib:/usr/sup/lib</>.
653 <term><option>--enable-nls<optional>=<replaceable>LANGUAGES</replaceable></optional></option></term>
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
669 To use this option, you will need an implementation of the
670 <application>Gettext</> API; see above.
676 <term><option>--with-pgport=<replaceable>NUMBER</></option></term>
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.
691 <term><option>--with-perl</option></term>
694 Build the <application>PL/Perl</> server-side language.
700 <term><option>--with-python</option></term>
703 Build the <application>PL/Python</> server-side language.
709 <term><option>--with-tcl</option></term>
712 Build the <application>PL/Tcl</> server-side language.
718 <term><option>--with-tclconfig=<replaceable>DIRECTORY</replaceable></option></term>
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
732 <term><option>--with-gssapi</option></term>
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.
749 <term><option>--with-krb5</option></term>
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.
765 <term><option>--with-krb-srvnam=<replaceable>NAME</></option></term>
768 The default name of the Kerberos service principal (also used
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>.
780 <primary>OpenSSL</primary>
781 <seealso>SSL</seealso>
784 <term><option>--with-openssl</option></term>
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
798 <term><option>--with-pam</option></term>
801 Build with <acronym>PAM</><indexterm><primary>PAM</></>
802 (Pluggable Authentication Modules) support.
808 <term><option>--with-ldap</option></term>
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
827 <term><option>--without-readline</option></term>
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.
839 <term><option>--with-libedit-preferred</option></term>
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</>.
851 <term><option>--with-bonjour</option></term>
854 Build with Bonjour support. This requires Bonjour support
855 in your operating system. Recommended on Mac OS X.
861 <term><option>--with-ossp-uuid</option></term>
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>
875 <term><option>--with-libxml</option></term>
878 Build with libxml (enables SQL/XML support). Libxml version 2.6.23 or
879 later is required for this feature.
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>.
898 <term><option>--with-libxslt</option></term>
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.
911 <term><option>--disable-integer-datetimes</option></term>
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.
933 <term><option>--disable-float4-byval</option></term>
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.
948 <term><option>--disable-float8-byval</option></term>
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</>.
967 <term><option>--with-segsize=<replaceable>SEGSIZE</replaceable></option></term>
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
984 Note that changing this value requires an initdb.
990 <term><option>--with-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
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
997 The value must be a power of 2 between 1 and 32 (kilobytes).
998 Note that changing this value requires an initdb.
1004 <term><option>--with-wal-segsize=<replaceable>SEGSIZE</replaceable></option></term>
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.
1018 <term><option>--with-wal-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
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
1025 The value must be a power of 2 between 1 and 64 (kilobytes).
1026 Note that changing this value requires an initdb.
1032 <term><option>--disable-spinlocks</option></term>
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.
1048 <term><option>--disable-thread-safety</option></term>
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.
1060 <term><option>--with-system-tzdata=<replaceable>DIRECTORY</replaceable></option></term>
1062 <primary>time zone data</primary>
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</>.
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
1098 <term><option>--without-zlib</option></term>
1102 <primary>zlib</primary>
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.
1114 <term><option>--enable-debug</option></term>
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.
1132 <term><option>--enable-coverage</option></term>
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
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.
1147 <term><option>--enable-profiling</option></term>
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.
1159 <term><option>--enable-cassert</option></term>
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
1178 <term><option>--enable-depend</option></term>
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.
1192 <term><option>--enable-dtrace</option></term>
1196 <primary>DTrace</primary>
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.]]>
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.
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:
1220 ./configure CC='gcc -m64' --enable-dtrace DTRACEFLAGS='-64' ...
1222 Using Sun's compiler:
1224 ./configure CC='/opt/SUNWspro/bin/cc -xtarget=native64' --enable-dtrace DTRACEFLAGS='-64' ...
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.
1244 You can specify environment variables on the
1245 <filename>configure</filename> command line, for example:
1247 <userinput>./configure CC=/opt/bin/gcc CFLAGS='-O2 -pipe'</>
1252 Here is a list of the significant variables that can be set in
1257 <term><envar>BISON</envar></term>
1266 <term><envar>CC</envar></term>
1275 <term><envar>CFLAGS</envar></term>
1278 options to pass to the C compiler
1284 <term><envar>CPP</envar></term>
1293 <term><envar>CPPFLAGS</envar></term>
1296 options to pass to the C preprocessor
1302 <term><envar>DTRACE</envar></term>
1305 location of the <command>dtrace</command> program
1311 <term><envar>DTRACEFLAGS</envar></term>
1314 options to pass to the <command>dtrace</command> program
1320 <term><envar>FLEX</envar></term>
1329 <term><envar>LDFLAGS</envar></term>
1332 options to use when linking either executables or shared libraries
1338 <term><envar>LDFLAGS_EX</envar></term>
1341 additional options for linking executables only
1347 <term><envar>LDFLAGS_SL</envar></term>
1350 additional options for linking shared libraries only
1356 <term><envar>MSGFMT</envar></term>
1359 <command>msgfmt</command> program for native language support
1365 <term><envar>PERL</envar></term>
1368 Full path to the Perl interpreter. This will be used to
1369 determine the dependencies for building PL/Perl.
1375 <term><envar>PYTHON</envar></term>
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</>
1385 <![%standalone-ignore[<xref linkend="plpython-python23">]]>
1386 for more information.
1392 <term><envar>TCLSH</envar></term>
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.
1403 <term><envar>XML2_CONFIG</envar></term>
1406 <command>xml2-config</command> program used to locate the
1407 libxml installation.
1416 <title>Build</title>
1419 To start the build, type:
1421 <userinput>gmake</userinput>
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:
1427 All of PostgreSQL is successfully made. Ready to install.
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:
1436 <userinput>gmake world</userinput>
1438 The last line displayed should be:
1440 PostgreSQL, contrib and HTML documentation successfully made. Ready to install.
1446 <title>Regression Tests</title>
1449 <primary>regression test</primary>
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
1459 <userinput>gmake check</userinput>
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.
1472 <title>Installing the Files</title>
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
1485 To install <productname>PostgreSQL</> enter:
1487 <userinput>gmake install</userinput>
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
1498 To install the documentation (HTML and man pages), enter:
1500 <userinput>gmake install-docs</userinput>
1505 If you built the world above, type instead:
1507 <userinput>gmake install-world</userinput>
1509 This also installs the documentation.
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.
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.)
1535 <title>Client-only installation:</title>
1537 If you want to install only the client applications and
1538 interface libraries, then you can use these commands:
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</>
1545 <filename>src/bin</> has a few binaries for server-only use,
1553 <title>Registering <application>eventlog</> on <systemitem
1554 class="osname">Windows</>:</title>
1556 To register a <systemitem class="osname">Windows</> <application>eventlog</>
1557 library with the operating system, issue this command after installation:
1559 <userinput>regsvr32 <replaceable>pgsql_library_directory</>/pgevent.dll</>
1561 This creates registry entries used by the event viewer.
1566 <title>Uninstallation:</title>
1568 To undo the installation use the command <command>gmake
1569 uninstall</>. However, this will not remove any created directories.
1574 <title>Cleaning:</title>
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.)
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.
1600 <sect1 id="install-post">
1601 <title>Post-Installation Setup</title>
1604 <title>Shared Libraries</title>
1607 <primary>shared library</primary>
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</>.
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</>):
1630 LD_LIBRARY_PATH=/usr/local/pgsql/lib
1631 export LD_LIBRARY_PATH
1633 or in <command>csh</> or <command>tcsh</>:
1635 setenv LD_LIBRARY_PATH /usr/local/pgsql/lib
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
1643 url="http://xahlee.org/UnixResource_dir/_/ldpath.html"></ulink>.
1647 On some systems it might be preferable to set the environment
1648 variable <envar>LD_RUN_PATH</envar> <emphasis>before</emphasis>
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>
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
1664 psql: error in loading shared libraries
1665 libpq.so.2.1: cannot open shared object file: No such file or directory
1667 then this step was necessary. Simply take care of it then.
1672 <primary>ldconfig</primary>
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:
1678 /sbin/ldconfig /usr/local/pgsql/lib
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:
1687 /sbin/ldconfig -m /usr/local/pgsql/lib
1689 instead. Other systems are not known to have an equivalent
1695 <title>Environment Variables</title>
1698 <primary><envar>PATH</envar></primary>
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.
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):
1716 PATH=/usr/local/pgsql/bin:$PATH
1719 If you are using <command>csh</> or <command>tcsh</>, then use this command:
1721 set path = ( /usr/local/pgsql/bin $path )
1727 <primary><envar>MANPATH</envar></primary>
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:
1734 MANPATH=/usr/local/pgsql/man:$MANPATH
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.
1752 <![%standalone-include;[
1753 <sect1 id="install-getting-started">
1754 <title>Getting Started</title>
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.
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
1772 <userinput>adduser postgres</>
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
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</>
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
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.
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
1816 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
1818 This will start the server in the foreground. To put the server
1819 in the background use something like:
1821 nohup /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data \
1822 </dev/null >>server.log 2>&1 </dev/null &
1827 To stop a server running in the background you can type:
1829 kill `cat /usr/local/pgsql/data/postmaster.pid`
1838 <userinput>createdb testdb</>
1842 <userinput>psql testdb</>
1844 to connect to that database. At the prompt you can enter SQL
1845 commands and start experimenting.
1851 <sect1 id="install-whatnow">
1852 <title>What Now?</title>
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.
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.
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.
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.
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
1912 <sect1 id="supported-platforms">
1913 <title>Supported Platforms</title>
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.
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.
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.
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
1961 <sect1 id="installation-platform-notes">
1962 <title>Platform-specific Notes</title>
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.
1976 Platforms that are not covered here have no known platform-specific
1977 installation issues.
1980 <sect2 id="installation-notes-aix">
1983 <indexterm zone="installation-notes-aix">
1984 <primary>AIX</primary>
1985 <secondary>installation on</secondary>
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.
1998 The minimum recommended fix levels for supported AIX versions are:
2003 <term>AIX 4.3.3</term>
2004 <listitem><para>Maintenance Level 11 + post ML11 bundle</para></listitem>
2008 <term>AIX 5.1</term>
2009 <listitem><para>Maintenance Level 9 + post ML9 bundle</para></listitem>
2013 <term>AIX 5.2</term>
2014 <listitem><para>Technology Level 10 Service Pack 3</para></listitem>
2018 <term>AIX 5.3</term>
2019 <listitem><para>Technology Level 7</para></listitem>
2023 <term>AIX 6.1</term>
2024 <listitem><para>Base Level</para></listitem>
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.
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>.
2043 <title>GCC Issues</title>
2046 On AIX 5.3, there have been some problems getting PostgreSQL to
2047 compile and run using GCC.
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.
2061 <title>Unix-Domain Sockets Broken</title>
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.
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.
2087 <title>Internet Address Issues</title>
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.
2098 <!-- http://archives.postgresql.org/message-id/6064jt6cfm.fsf_-_@dba2.int.libertyrms.com -->
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.
2114 Any of the following actions <quote>fix</quote> the problem.
2118 Delete the IPv6 address for localhost:
2121 # ifconfig lo0 inet6 ::1/0 delete
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:
2139 to deactivate searching for IPv6 addresses.
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.
2159 <title>Memory Management</title>
2160 <!-- http://archives.postgresql.org/message-id/603bgqmpl9.fsf@dba2.int.libertyrms.com -->
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:
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.
2173 Running as a non-owner in the group possessing the PostgreSQL
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
2179 Another example is out of memory errors in the PostgreSQL server
2180 logs, with every memory allocation near or greater than 256 MB
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.
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.
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
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 <= n <= 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
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.
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.
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.
2254 <title>References and Resources</title>
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>
2260 <biblioset relation="book">
2261 <title>AIX Documentation: General Programming Concepts: Writing and Debugging Programs</title>
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>
2269 <biblioset relation="book">
2270 <title>AIX Documentation: General Programming Concepts: Writing and Debugging Programs</title>
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>
2278 <biblioset relation="book">
2279 <title>AIX Documentation: Performance Management Guide</title>
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>
2287 <biblioset relation="book">
2288 <title>AIX Documentation: Performance Management Guide</title>
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>
2296 <biblioset relation="book">
2297 <title>AIX Documentation: Performance Management Guide</title>
2302 <title><ulink url=" http://www.redbooks.ibm.com/abstracts/sg245674.html?Open">Developing and Porting C and C++ Applications on AIX</ulink></title>
2304 <publishername>IBM Redbook</publishername>
2311 <sect2 id="installation-notes-cygwin">
2312 <title>Cygwin</title>
2314 <indexterm zone="installation-notes-cygwin">
2315 <primary>Cygwin</primary>
2316 <secondary>installation on</secondary>
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.
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
2335 Set your path to use the Cygwin bin directory before the
2336 Windows utilities. This will help prevent problems with
2343 The GNU make command is called <command>make</command>, not <command>gmake</command>.
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.
2357 The <command>su</command> command is not supported; use ssh to
2358 simulate su on Windows NT, 2000, or XP. Otherwise, skip this
2365 OpenSSL is not supported.
2371 Start <command>cygserver</command> for shared memory support.
2372 To do this, enter the command <literal>/usr/sbin/cygserver
2373 &</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.
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
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:
2401 make MAX_CONNECTIONS=5 check
2403 (On some systems you can have up to about 10 simultaneous
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>.
2420 <sect2 id="installation-notes-hpux">
2421 <title>HP-UX</title>
2423 <indexterm zone="installation-notes-hpux">
2424 <primary>HP-UX</primary>
2425 <secondary>installation on</secondary>
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
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:
2446 PHSS_30966 s700_800 ld(1) and linker tools cumulative patch
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.
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.
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>.
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
2476 PHSS_30848 s700_800 HP C Compiler (A.05.57)
2477 PHSS_30849 s700_800 u2comp/be/plugin library Patch
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>:
2488 for HP's C compiler, or
2492 for GCC. If you omit this setting, then configure will
2493 pick <command>gcc</command> if it has a choice.
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
2501 <option>--prefix</option> switch to <command>configure</command>.
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.
2512 <sect2 id="installation-notes-irix">
2515 <indexterm zone="installation-notes-irix">
2516 <primary>IRIX</primary>
2517 <secondary>installation on</secondary>
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.
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
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.
2546 There may be a compilation problem like the following:
2548 cc-1020 cc: ERROR File = pqcomm.c, Line = 427
2549 The identifier "TCP_NODELAY" is undefined.
2551 if (setsockopt(port->sock, IPPROTO_TCP, TCP_NODELAY,
2553 Some versions include TCP definitions
2554 in <filename>sys/xti.h</filename>, so it is necessary to
2555 add <literal>#include <sys/xti.h></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.
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.
2568 <sect2 id="installation-notes-mingw">
2569 <title>MinGW/Native Windows</title>
2571 <indexterm zone="installation-notes-mingw">
2572 <primary>MinGW</primary>
2573 <secondary>installation on</secondary>
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.
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.
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.
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
2617 <title>Collecting Crash Dumps on Windows</title>
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.
2633 <sect2 id="installation-notes-sco">
2634 <title>SCO OpenServer and SCO UnixWare</title>
2636 <indexterm zone="installation-notes-sco">
2637 <primary>SCO</primary>
2638 <secondary>installation on</secondary>
2641 <indexterm zone="installation-notes-sco">
2642 <primary>UnixWare</primary>
2643 <secondary>installation on</secondary>
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.
2654 <title>Skunkware</title>
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
2665 from <ulink url="http://www.sco.com/skunkware/"></ulink>.
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.
2675 On UnixWare 7.1.3 and beyond, the GCC compiler is included on the
2676 UDK CD as is GNU Make.
2681 <title>GNU Make</title>
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>.
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>.
2699 <title>Readline</title>
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
2706 try <ulink url="http://www.sco.com/skunkware/"></ulink>.
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>:
2716 ./configure --with-libraries=/usr/local/lib --with-includes=/usr/local/include
2722 <title>Using the UDK on OpenServer</title>
2725 If you are using the new Universal Development Kit (UDK) compiler
2726 on OpenServer, you need to specify the locations of the UDK
2729 ./configure --with-libraries=/udk/usr/lib --with-includes=/udk/usr/include
2731 Putting these together with the Readline options from above:
2733 ./configure --with-libraries="/udk/usr/lib /usr/local/lib" --with-includes="/udk/usr/include /usr/local/include"
2739 <title>Reading the PostgreSQL Man Pages</title>
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
2746 <varname>MANPATH</varname> variable
2747 in <filename>/etc/default/man</filename>, for example:
2749 MANPATH=/usr/lib/scohelp/%L/man:/usr/dt/man:/usr/man:/usr/share/man:scohelp:/usr/local/man:/usr/local/pgsql/man
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
2762 <title>C99 Issues with the 7.1.1b Feature Supplement</title>
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.
2777 <title>Threading on UnixWare</title>
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
2784 <option>-Kpthread</>/<option>-Kthread</> flag.
2789 <sect2 id="installation-notes-solaris">
2790 <title>Solaris</title>
2792 <indexterm zone="installation-notes-solaris">
2793 <primary>Solaris</primary>
2794 <secondary>installation on</secondary>
2798 PostgreSQL is well-supported on Solaris. The more up to date your
2799 operating system, the fewer issues you will experience; details
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>.
2813 <title>Required Tools</title>
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>.
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
2834 at <ulink url="http://www.gnu.org/order/ftp.html"></ulink>.
2839 <title>Problems with OpenSSL</title>
2842 When you build PostgreSQL with OpenSSL support you might get
2843 compilation errors in the following files:
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>
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.
2857 Upgrading your OpenSSL installation to version 0.9.6a fixes this
2858 problem. Solaris 9 and above has a newer version of OpenSSL.
2863 <title>configure Complains About a Failed Test Program</title>
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.,
2873 configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"
2876 the <citerefentry><refentrytitle>ld</><manvolnum>1</></citerefentry>
2877 man page for more information.
2882 <title>64-bit Build Sometimes Crashes</title>
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
2898 LIBOBJS = snprintf.o
2900 (There might be other files already listed in this variable.
2901 Order does not matter.) Then build as usual.
2906 <title>Compiling for Optimal Performance</title>
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
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
2929 Some tricks for tuning PostgreSQL and Solaris for performance can
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
2939 <title>Using DTrace for Tracing PostgreSQL</title>
2942 Yes, using DTrace is possible. See <![%standalone-include[the
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>.
2950 If you see the linking of the <command>postgres</command> executable abort with an
2953 Undefined first referenced
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
2961 your DTrace installation is too old to handle probes in static
2962 functions. You need Solaris 10u4 or newer.