⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 installation.sgml

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 SGML
📖 第 1 页 / 共 5 页
字号:
   This will create a directory   <filename>postgresql-&version;</filename> under the current directory   with the <productname>PostgreSQL</> sources.   Change into that directory for the rest   of the installation procedure.  </para> </sect1>]]> <sect1 id="install-upgrading">  <title>If You Are Upgrading</title>  <indexterm zone="install-upgrading">   <primary>upgrading</primary>  </indexterm>  <para>   The internal data storage format changes with new releases of   <productname>PostgreSQL</>. Therefore, if you are upgrading an   existing installation that does not have a version number   <quote>&majorversion;.x</quote>, you must back up and restore your   data as shown here. These instructions assume that your existing   installation is under the <filename>/usr/local/pgsql</> directory,   and that the data area is in <filename>/usr/local/pgsql/data</>.   Substitute your paths appropriately.  </para>  <procedure>   <step>    <para>     Make sure that your database is not updated during or after the     backup. This does not affect the integrity of the backup, but the     changed data would of course not be included. If necessary, edit     the permissions in the file     <filename>/usr/local/pgsql/data/pg_hba.conf</> (or equivalent) to     disallow access from everyone except you.    </para>   </step>   <step>    <para>     <indexterm>      <primary>pg_dumpall</primary>      <secondary>use during upgrade</secondary>     </indexterm>     To back up your database installation, type:<screen><userinput>pg_dumpall &gt; <replaceable>outputfile</></userinput></screen>     If you need to preserve OIDs (such as when using them as     foreign keys), then use the <option>-o</option> option when running     <application>pg_dumpall</>.    </para>    <para>     To make the backup, you can use the <application>pg_dumpall</application>     command from the version you are currently running.  For best     results, however, try to use the <application>pg_dumpall</application>     command from <productname>PostgreSQL</productname> &version;,     since this version contains bug fixes and improvements over older     versions.  While this advice might seem idiosyncratic since you     haven't installed the new version yet, it is advisable to follow     it if you plan to install the new version in parallel with the     old version.  In that case you can complete the installation     normally and transfer the data later.  This will also decrease     the downtime.    </para>   </step>   <step>    <para>     If you are installing the new version at the same location as the     old one then shut down the old server, at the latest before you     install the new files:<screen><userinput>pg_ctl stop</></screen>     On systems that have <productname>PostgreSQL</> started at boot time,     there is probably a start-up file that will accomplish the same thing. For     example, on a <systemitem class="osname">Red Hat Linux</> system one     might find that<screen><userinput>/etc/rc.d/init.d/postgresql stop</userinput></screen>     works.    </para>    <para>     Very old versions might not have <application>pg_ctl</>.  If you     can't find it or it doesn't work, find out the process ID of the     old server, for example by typing<screen><userinput>ps ax | grep postmaster</userinput></screen>     and signal it to stop this way:<screen><userinput>kill -INT <replaceable>processID</></userinput></screen>    </para>   </step>   <step>    <para>     If you are installing in the same place as the old version then     it is also a good idea to move the old installation out of the     way, in case you have trouble and need to revert to it.     Use a command like this:<screen><userinput>mv /usr/local/pgsql /usr/local/pgsql.old</></screen>    </para>   </step>  </procedure>  <para>   After you have installed <productname>PostgreSQL</> &version;, create a new database   directory and start the new server. Remember that you must execute   these commands while logged in to the special database user account   (which you already have if you are upgrading).<programlisting><userinput>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</><userinput>/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data</></programlisting>   Finally, restore your data with<screen><userinput>/usr/local/pgsql/bin/psql -d postgres -f <replaceable>outputfile</></userinput></screen>   using the <emphasis>new</> <application>psql</>.  </para>  <para>   Further discussion appears in   <![%standalone-include[the documentation,]]>   <![%standalone-ignore[<xref linkend="migration">,]]>   which you are encouraged to read in any case.  </para> </sect1> <sect1 id="install-procedure">  <title>Installation Procedure</title>  <procedure>  <step id="configure">   <title>Configuration</>   <indexterm zone="configure">    <primary>configure</primary>   </indexterm>   <para>    The first step of the installation procedure is to configure the    source tree for your system and choose the options you would like.    This is done by running the <filename>configure</> script. For a    default installation simply enter<screen><userinput>./configure</userinput></screen>    This script will run a number of tests to guess values for various    system dependent variables and detect some quirks of your    operating system, and finally will create several files in the    build tree to record what it found.  (You can also run    <filename>configure</filename> in a directory outside the source    tree if you want to keep the build directory separate.)   </para>   <para>    The default configuration will build the server and utilities, as    well as all client applications and interfaces that require only a    C compiler. All files will be installed under    <filename>/usr/local/pgsql</> by default.   </para>   <para>    You can customize the build and installation process by supplying one    or more of the following command line options to    <filename>configure</filename>:     <variablelist>      <varlistentry>       <term><option>--prefix=<replaceable>PREFIX</></option></term>       <listitem>        <para>         Install all files under the directory <replaceable>PREFIX</>         instead of <filename>/usr/local/pgsql</filename>. The actual         files will be installed into various subdirectories; no files         will ever be installed directly into the         <replaceable>PREFIX</> directory.        </para>        <para>         If you have special needs, you can also customize the         individual subdirectories with the following options. However,         if you leave these with their defaults, the installation will be         relocatable, meaning you can move the directory after         installation. (The <literal>man</> and <literal>doc</>         locations are not affected by this.)        </para>        <para>         For relocatable installs, you might want to use          <filename>configure</filename>'s <literal>--disable-rpath</>         option.  Also, you will need to tell the operating system how         to find the shared libraries.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--exec-prefix=<replaceable>EXEC-PREFIX</></option></term>       <listitem>        <para>         You can install architecture-dependent files under a         different prefix, <replaceable>EXEC-PREFIX</>, than what         <replaceable>PREFIX</> was set to. This can be useful to         share architecture-independent files between hosts. If you         omit this, then <replaceable>EXEC-PREFIX</> is set equal to         <replaceable>PREFIX</> and both architecture-dependent and         independent files will be installed under the same tree,         which is probably what you want.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--bindir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         Specifies the directory for executable programs. The default         is <filename><replaceable>EXEC-PREFIX</>/bin</>, which         normally means <filename>/usr/local/pgsql/bin</>.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--datadir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         Sets the directory for read-only data files used by the         installed programs. The default is         <filename><replaceable>PREFIX</>/share</>. Note that this has         nothing to do with where your database files will be placed.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--sysconfdir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         The directory for various configuration files,         <filename><replaceable>PREFIX</>/etc</> by default.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--libdir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         The location to install libraries and dynamically loadable         modules. The default is         <filename><replaceable>EXEC-PREFIX</>/lib</>.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--includedir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         The directory for installing C and C++ header files. The         default is <filename><replaceable>PREFIX</>/include</>.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--mandir=<replaceable>DIRECTORY</></option></term>       <listitem>        <para>         The man pages that come with <productname>PostgreSQL</> will be installed under         this directory, in their respective         <filename>man<replaceable>x</></> subdirectories.         The default is <filename><replaceable>PREFIX</>/man</>.        </para>       </listitem>      </varlistentry>      <varlistentry>       <term><option>--with-docdir=<replaceable>DIRECTORY</></option></term>       <term><option>--without-docdir</option></term>       <listitem>        <para>         Documentation files, except <quote>man</> pages, will be         installed into this directory. The default is         <filename><replaceable>PREFIX</>/doc</>.  If the option         <option>--without-docdir</option> is specified, the         documentation will not be installed by <command>make         install</command>.  This is intended for packaging scripts         that have special methods for installing documentation.        </para>       </listitem>      </varlistentry>     </variablelist>     <note>      <para>       Care has been taken to make it possible to install       <productname>PostgreSQL</> into shared installation locations       (such as <filename>/usr/local/include</filename>) without       interfering with the namespace of the rest of the system. First,       the string <quote><literal>/postgresql</literal></quote> is       automatically appended to <varname>datadir</varname>,       <varname>sysconfdir</varname>, and <varname>docdir</varname>,       unless the fully expanded directory name already contains the       string <quote><literal>postgres</></quote> or       <quote><literal>pgsql</></quote>. For example, if you choose       <filename>/usr/local</filename> as prefix, the documentation will       be installed in <filename>/usr/local/doc/postgresql</filename>,       but if the prefix is <filename>/opt/postgres</filename>, then it       will be in <filename>/opt/postgres/doc</filename>. The public C       header files of the client interfaces are installed into       <varname>includedir</varname> and are namespace-clean. The       internal header files and the server header files are installed       into private directories under <varname>includedir</varname>. See       the documentation of each interface for information about how to       get at the its header files. Finally, a private subdirectory will       also be created, if appropriate, under <varname>libdir</varname>       for dynamically loadable modules.      </para>     </note>    </para>    <para>     <variablelist>      <varlistentry>       <term><option>--with-includes=<replaceable>DIRECTORIES</></option></term>       <listitem>        <para>         <replaceable>DIRECTORIES</> is a colon-separated list of         directories that will be added to the list the compiler         searches for header files. If you have optional packages         (such as GNU <application>Readline</>) installed in a non-standard         location,         you have to use this option and probably also the corresponding         <option>--with-libraries</> option.        </para>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -