📄 installation.sgml
字号:
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.249 2005/11/05 00:04:04 tgl Exp $ --><chapter id="installation"> <title><![%standalone-include[<productname>PostgreSQL</>]]> Installation Instructions</title> <indexterm zone="installation"> <primary>installation</primary> </indexterm> <para> This <![%standalone-include;[document]]> <![%standalone-ignore;[chapter]]> describes the installation of <productname>PostgreSQL</productname> from the source code distribution. (If you are installing a pre-packaged distribution, such as an RPM or Debian package, ignore this <![%standalone-include;[document]]> <![%standalone-ignore;[chapter]]> and read the packager's instructions instead.) </para> <sect1 id="install-short"> <title>Short Version</title> <para><synopsis>./configuregmakesugmake installadduser postgresmkdir /usr/local/pgsql/datachown postgres /usr/local/pgsql/datasu - postgres/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &/usr/local/pgsql/bin/createdb test/usr/local/pgsql/bin/psql test</synopsis> The long version is the rest of this <![%standalone-include;[document.]]> <![%standalone-ignore;[chapter.]]> </para> </sect1> <sect1 id="install-requirements"> <title>Requirements</title> <para> In general, a modern Unix-compatible platform should be able to run <productname>PostgreSQL</>. The platforms that had received specific testing at the time of release are listed in <xref linkend="supported-platforms"> below. In the <filename>doc</> subdirectory of the distribution there are several platform-specific <acronym>FAQ</> documents you might wish to consult if you are having trouble. </para> <para> The following software packages are required for building <productname>PostgreSQL</>: <itemizedlist> <listitem> <para> <indexterm> <primary>make</primary> </indexterm> <acronym>GNU</> <application>make</> is required; other <application>make</> programs will <emphasis>not</> work. <acronym>GNU</> <application>make</> is often installed under the name <filename>gmake</filename>; this document will always refer to it by that name. (On some systems <acronym>GNU</acronym> <application>make</> is the default tool with the name <filename>make</>.) To test for <acronym>GNU</acronym> <application>make</application> enter<screen><userinput>gmake --version</userinput></screen> It is recommended to use version 3.76.1 or later. </para> </listitem> <listitem> <para> You need an <acronym>ISO</>/<acronym>ANSI</> C compiler. Recent versions of <productname>GCC</> are recommendable, but <productname>PostgreSQL</> is known to build with a wide variety of compilers from different vendors. </para> </listitem> <listitem> <para> <application>tar</> is required to unpack the source distribution in the first place, in addition to either <application>gzip</> or <application>bzip2</>. </para> </listitem> <listitem> <para> <indexterm> <primary>readline</primary> </indexterm> The <acronym>GNU</> <productname>Readline</> library (for comfortable line editing and command history retrieval) will be used by default. If you don't want to use it then you must specify the <option>--without-readline</option> option for <filename>configure</>. (On <productname>NetBSD</productname>, the <filename>libedit</filename> library is <productname>Readline</productname>-compatible and is used if <filename>libreadline</filename> is not found.) If you are using a package-based Linux distribution, be aware that you need both the <literal>readline</> and <literal>readline-devel</> packages, if those are separate in your distribution. </para> </listitem> <listitem> <para> <indexterm> <primary>zlib</primary> </indexterm> The <productname>zlib</productname> compression library will be used by default. If you don't want to use it then you must specify the <option>--without-zlib</option> option for <filename>configure</filename>. Using this option disables support for compressed archives in <application>pg_dump</> and <application>pg_restore</>. </para> </listitem> <listitem> <para> <indexterm> <primary>installation</primary> <secondary>on Windows</secondary> </indexterm> Additional software is needed to build <productname>PostgreSQL</productname> on <productname>Windows</>. You can build <productname>PostgreSQL</productname> for <productname>NT</>-based versions of <productname>Windows</> (like Windows XP and 2003) using <productname>MinGW</productname>; see <filename>doc/FAQ_MINGW</> for details. You can also build <productname>PostgreSQL</productname> using <productname>Cygwin</productname>; see <filename>doc/FAQ_CYGWIN</>. A <productname>Cygwin</productname>-based build will work on older versions of <productname>Windows</>, but if you have a choice, we recommend the <productname>MinGW</productname> approach. While these are the only tool sets recommended for a complete build, it is possible to build just the C client library (<application>libpq</application>) and the interactive terminal (<application>psql</application>) using other <productname>Windows</> tool sets. For details of that see <![%standalone-include[the documentation chapter "Client-Only Installation on Windows"]]> <![%standalone-ignore[<xref linkend="install-win32">]]>. </para> </listitem> </itemizedlist> </para> <para> The following packages are optional. They are not required in the default configuration, but they are needed when certain build options are enabled, as explained below. <itemizedlist> <listitem> <para> To build the server programming language <application>PL/Perl</application> you need a full <productname>Perl</productname> installation, including the <filename>libperl</filename> library and the header files. Since <application>PL/Perl</application> will be a shared library, the <indexterm><primary>libperl</primary></indexterm> <filename>libperl</filename> library must be a shared library also on most platforms. This appears to be the default in recent <productname>Perl</productname> versions, but it was not in earlier versions, and in any case it is the choice of whomever installed Perl at your site. </para> <para> If you don't have the shared library but you need one, a message like this will appear during the build to point out this fact:<screen>*** Cannot build PL/Perl because libperl is not a shared library.*** You might have to rebuild your Perl installation. Refer to*** the documentation for details.</screen> (If you don't follow the on-screen output you will merely notice that the <application>PL/Perl</application> library object, <filename>plperl.so</filename> or similar, will not be installed.) If you see this, you will have to rebuild and install <productname>Perl</productname> manually to be able to build <application>PL/Perl</application>. During the configuration process for <productname>Perl</productname>, request a shared library. </para> </listitem> <listitem> <para> To build the <application>PL/Python</> server programming language, you need a <productname>Python</productname> installation with the header files and the <application>distutils</application> module. The <application>distutils</application> module is included by default with <productname>Python</productname> 1.6 and later; users of earlier versions of <productname>Python</productname> will need to install it. </para> <para> Since <application>PL/Python</application> will be a shared library, the <indexterm><primary>libpython</primary></indexterm> <filename>libpython</filename> library must be a shared library also on most platforms. This is not the case in a default <productname>Python</productname> installation. If after building and installing you have a file called <filename>plpython.so</filename> (possibly a different extension), then everything went well. Otherwise you should have seen a notice like this flying by:<screen>*** Cannot build PL/Python because libpython is not a shared library.*** You might have to rebuild your Python installation. Refer to*** the documentation for details.</screen> That means you have to rebuild (part of) your <productname>Python</productname> installation to supply this shared library. </para> <para> If you have problems, run <productname>Python</> 2.3 or later's configure using the <literal>--enable-shared</> flag. On some operating systems you don't have to build a shared library, but you will have to convince the <productname>PostgreSQL</> build system of this. Consult the <filename>Makefile</filename> in the <filename>src/pl/plpython</filename> directory for details. </para> </listitem> <listitem> <para> If you want to build the <application>PL/Tcl</application> procedural language, you of course need a Tcl installation. </para> </listitem> <listitem> <para> To enable Native Language Support (<acronym>NLS</acronym>), that is, the ability to display a program's messages in a language other than English, you need an implementation of the <application>Gettext</> <acronym>API</acronym>. Some operating systems have this built-in (e.g., <systemitem class="osname">Linux</>, <systemitem class="osname">NetBSD</>, <systemitem class="osname">Solaris</>), for other systems you can download an add-on package from <ulink url="http://developer.postgresql.org/~petere/bsd-gettext/"></ulink>. If you are using the <application>Gettext</> implementation in the <acronym>GNU</acronym> C library then you will additionally need the <productname>GNU Gettext</productname> package for some utility programs. For any of the other implementations you will not need it. </para> </listitem> <listitem> <para> <application>Kerberos</>, <productname>OpenSSL</>, and/or <application>PAM</>, if you want to support authentication or encryption using these services. </para> </listitem> </itemizedlist> </para> <para> If you are building from a <acronym>CVS</acronym> tree instead of using a released source package, or if you want to do development, you also need the following packages: <itemizedlist> <listitem> <para> <indexterm> <primary>flex</primary> </indexterm> <indexterm> <primary>bison</primary> </indexterm> <indexterm> <primary>yacc</primary> </indexterm> GNU <application>Flex</> and <application>Bison</> are needed to build a CVS checkout or if you changed the actual scanner and parser definition files. If you need them, be sure to get <application>Flex</> 2.5.4 or later and <application>Bison</> 1.875 or later. Other <application>yacc</> programs can sometimes be used, but doing so requires extra effort and is not recommended. Other <application>lex</> programs will definitely not work. </para> </listitem> </itemizedlist> </para> <para> If you need to get a <acronym>GNU</acronym> package, you can find it at your local <acronym>GNU</acronym> mirror site (see <ulink url="http://www.gnu.org/order/ftp.html"></> for a list) or at <ulink url="ftp://ftp.gnu.org/gnu/"></ulink>. </para> <para> Also check that you have sufficient disk space. You will need about 65 MB for the source tree during compilation and about 15 MB for the installation directory. An empty database cluster takes about 25 MB, databases take about five times the amount of space that a flat text file with the same data would take. If you are going to run the regression tests you will temporarily need up to an extra 90 MB. Use the <command>df</command> command to check free disk space. </para> </sect1><![%standalone-ignore;[ <sect1 id="install-getsource"> <title>Getting The Source</title> <para> The <productname>PostgreSQL</> &version; sources can be obtained by anonymous FTP from <ulink url="ftp://ftp.postgresql.org/pub/source/v&version;/postgresql-&version;.tar.gz"></ulink>. Other download options can be found on our website: <ulink url="http://www.postgresql.org/download/"></ulink>. After you have obtained the file, unpack it:<screen><userinput>gunzip postgresql-&version;.tar.gz</userinput><userinput>tar xf postgresql-&version;.tar</userinput></screen>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -