source: content/databases/postgresql.xml@ 775c349a

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 775c349a was 775c349a, checked in by Igor Živković <igor@…>, 19 years ago

Updated to Python-2.4.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@3205 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 12.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY postgresql-download-http "http://gd.tuwien.ac.at/db/postgresql/v&postgresql-version;/postgresql-&postgresql-version;.tar.bz2">
8 <!ENTITY postgresql-download-ftp "ftp://ftp.fr.postgresql.org/v&postgresql-version;/postgresql-&postgresql-version;.tar.bz2">
9 <!ENTITY postgresql-md5sum "f0ea2b372a7bdaf2613e92176ebf5e0f">
10 <!ENTITY postgresql-size "10.2 MB">
11 <!ENTITY postgresql-buildsize "236 MB">
12 <!ENTITY postgresql-time "1.21 SBU">
13]>
14
15<sect1 id="postgresql" xreflabel="PostgreSQL-&postgresql-version;">
16<sect1info>
17<othername>$LastChangedBy$</othername>
18<date>$Date$</date>
19</sect1info>
20<?dbhtml filename="postgresql.html"?>
21<title>Postgre<acronym>SQL</acronym>-&postgresql-version;</title>
22
23<sect2>
24<title>Introduction to <application>Postgre<acronym>SQL</acronym></application>
25</title>
26
27<para><application>Postgre<acronym>SQL</acronym></application> is an advanced
28object-relational database management system (<acronym>ORDBMS</acronym>),
29derived from the Berkeley Postgres database management system.</para>
30
31<sect3><title>Package information</title>
32<itemizedlist spacing='compact'>
33<listitem><para>Download (HTTP): <ulink url="&postgresql-download-http;"/></para></listitem>
34<listitem><para>Download (FTP): <ulink url="&postgresql-download-ftp;"/></para></listitem>
35<listitem><para>Download MD5 sum: &postgresql-md5sum;</para></listitem>
36<listitem><para>Download size: &postgresql-size;</para></listitem>
37<listitem><para>Estimated disk space required: &postgresql-buildsize;</para></listitem>
38<listitem><para>Estimated build time: &postgresql-time;</para></listitem></itemizedlist>
39</sect3>
40
41<sect3><title>Additional downloads</title>
42<itemizedlist spacing='compact'>
43<listitem><para>Required patch: <ulink
44url="&patch-root;/postgresql-&postgresql-version;-dsssl_fix-1.patch"/></para>
45</listitem></itemizedlist>
46</sect3>
47
48<sect3><title><application>Postgre<acronym>SQL</acronym></application>
49dependencies</title>
50<sect4><title>Optional</title>
51<para>
52<xref linkend="python"/>,
53<xref linkend="tcl"/>,
54<xref linkend="tk"/>,
55<xref linkend="openssl"/>,
56<xref linkend="Linux_PAM"/>,
57<xref linkend="sgml-dtd-3"/>,
58<xref linkend="docbook-dsssl"/>,
59<xref linkend="openjade"/>,
60<xref linkend="perl-modules"/>: SGMLSpm-&SGMLSpm-version;,
61<ulink url="http://www.pdc.kth.se/kth-krb/">krb4</ulink>,
62<xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
63<xref linkend="apache-ant"/> and
64<ulink url="http://rendezvous.sourceforge.net/">Rendezvous</ulink>
65</para></sect4>
66</sect3>
67
68</sect2>
69
70<sect2>
71<title>Installation of <application>Postgre<acronym>SQL</acronym></application>
72</title>
73
74<para>In order for <command>configure</command> to properly discover
75<application>Docbook <acronym>SGML</acronym>
76<acronym>DTD</acronym></application> (v3.1), you may need to remove
77<application>OpenSP</application> catalog definitions from the system
78<acronym>SGML</acronym> catalogs. Use the following command before building
79the package to accomplish this:</para>
80
81<screen><userinput><command>sed -i.orig \
82 -e "/CATALOG \/etc\/sgml\/OpenSP-1.5.1.cat/d" \
83 /etc/sgml/catalog \
84 /etc/sgml/sgml-docbook.cat</command></userinput></screen>
85
86<para>Install <application>Postgre<acronym>SQL</acronym></application> with the
87following commands: </para>
88
89<screen><userinput><command>patch -Np1 -i ../postgresql-&postgresql-version;-dsssl_fix-1.patch &amp;&amp;
90./configure --prefix=/usr --enable-thread-safety &amp;&amp;
91make &amp;&amp;
92make install &amp;&amp;
93chown -R root:root /usr/share/doc/postgresql/html</command></userinput></screen>
94
95<para>The standard installation provides only the header files needed
96for client application development. Server-side applications require
97the entire <application>Postgre<acronym>SQL</acronym></application>
98include tree which can be installed using the following command:</para>
99
100<screen><userinput><command>make install-all-headers</command></userinput></screen>
101
102<note><para>If you are upgrading an existing system and are going to
103install the new files over the old ones, then you should
104back up your data, shut down the old server and follow the
105instructions in <ulink
106url="http://www.postgresql.org/docs/7.4/static/install-upgrading.html">the
107official <application>Postgre<acronym>SQL</acronym></application>
108documentation</ulink>.</para></note>
109
110<para>Initialize a database cluster with the following commands:</para>
111
112<screen><userinput><command>mkdir -p /srv/pgsql/data &amp;&amp;
113useradd -d /srv/pgsql/data postgres &amp;&amp;
114chown postgres /srv/pgsql/data &amp;&amp;
115su - postgres -c '/usr/bin/initdb -D /srv/pgsql/data'</command></userinput></screen>
116
117<para>Start the database server with the following command:</para>
118
119<screen><userinput><command>su - postgres -c '/usr/bin/postmaster -D /srv/pgsql/data > \
120 /srv/pgsql/data/logfile 2&gt;&amp;1 &amp;'</command></userinput></screen>
121
122<para>Create a database and verify the installation:</para>
123
124<screen><userinput><command>su - postgres -c '/usr/bin/createdb test' &amp;&amp;
125echo "create table t1 ( name varchar(20), state_province varchar(20) );" \
126 | (su - postgres -c '/usr/bin/psql test ') &amp;&amp;
127echo "insert into t1 values ('Billy', 'NewYork');" \
128 | (su - postgres -c '/usr/bin/psql test ') &amp;&amp;
129echo "insert into t1 values ('Evanidus', 'Quebec');" \
130 | (su - postgres -c '/usr/bin/psql test ') &amp;&amp;
131echo "insert into t1 values ('Jesse', 'Ontario');" \
132 | (su - postgres -c '/usr/bin/psql test ') &amp;&amp;
133echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test')</command></userinput></screen>
134
135</sect2>
136
137<sect2>
138<title>Command explanations</title>
139
140<para><parameter>--enable-thread-safety</parameter>: This switch makes the
141client libraries thread-safe by allowing concurrent threads in
142<filename class='libraryfile'>libpq</filename> and <acronym>ECPG</acronym>
143programs to safely control their private connection handles.</para>
144
145<para><command>chown -R root:root /usr/share/doc/postgresql/html</command>:
146This command corrects the improper ownership of some documentation
147files.</para>
148
149<para><command>useradd -d /srv/pgsql/data postgres</command>: Add an
150unprivileged user to run the database server.</para>
151
152<para><command>createdb test, create table t1 , insert into t1 values...,
153select * from t1</command>: Create a database, add a table to it, insert some
154rows into the table and select them to verify that the installation is working
155properly.</para>
156
157</sect2>
158
159<sect2>
160<title>Configuring <application>Postgre<acronym>SQL</acronym></application>
161</title>
162
163<sect3>
164<title>Config files</title>
165
166<para><filename>$PGDATA/pg_ident.con</filename>,
167<filename>$PGDATA/pg_hba.conf</filename> and
168<filename>$PGDATA/postgresql.conf</filename></para>
169
170<para>The <envar>PGDATA</envar> environment variable is used to distinguish
171database clusters from one another by setting it to the value of the directory
172which contains the cluster desired. The three configuration files
173exist in every <filename class="directory">PGDATA/</filename> directory.
174Details on the format of the files and the options that can be set in
175each can be found in <ulink
176url="file:///usr/share/doc/postgresql/html/index.html"/>.</para>
177
178<para>Install the <filename>/etc/rc.d/init.d/postgresql</filename>
179init script included in the <xref linkend="intro-important-bootscripts"/>
180package.</para>
181
182<screen><userinput><command>make install-postgresql</command></userinput></screen>
183
184</sect3>
185
186</sect2>
187
188<sect2>
189<title>Contents</title>
190
191<para>The <application>Postgre<acronym>SQL</acronym></application> package
192contains <command>clusterdb</command>,
193<command>createdb</command>,
194<command>createlang</command>,
195<command>createuser</command>,
196<command>dropdb</command>,
197<command>droplang</command>,
198<command>dropuser</command>,
199<command>ecpg</command>,
200<command>initdb</command>,
201<command>initlocation</command>,
202<command>ipcclean</command>,
203<command>pg_config</command>,
204<command>pg_controldata</command>,
205<command>pg_ctl</command>,
206<command>pg_dump</command>,
207<command>pg_dumpall</command>,
208<command>pg_encoding</command>,
209<command>pg_id</command>,
210<command>pg_resetxlog</command>,
211<command>pg_restore</command>,
212<command>pgtclsh</command>,
213<command>pgtksh</command>,
214<command>pltcl_delmod</command>,
215<command>pltcl_listmod</command>,
216<command>pltcl_loadmod</command>,
217<command>postgres</command>,
218<command>postmaster</command>,
219<command>psql</command>,
220<command>vacuumdb</command>,
221<filename class="libraryfile">libecpg</filename>,
222<filename class="libraryfile">libpgtcl</filename>,
223<filename class="libraryfile">libpgtypes</filename>,
224<filename class="libraryfile">libpq</filename> and various charset
225modules.</para>
226
227</sect2>
228
229<sect2><title>Description</title>
230
231<sect3><title>clusterdb</title>
232<para><command>clusterdb</command> is a utility for reclustering tables
233in a <application>Postgre<acronym>SQL</acronym></application>
234database.</para></sect3>
235
236<sect3><title>createdb</title>
237<para><command>createdb</command> creates a new
238<application>Postgre<acronym>SQL</acronym></application> database.</para>
239</sect3>
240
241<sect3><title>createlang</title>
242<para><command>createlang</command> defines a new
243<application>Postgre<acronym>SQL</acronym></application> procedural
244language.</para></sect3>
245
246<sect3><title>createuser</title>
247<para><command>createuser</command> defines a new
248<application>Postgre<acronym>SQL</acronym></application> user account.</para>
249</sect3>
250
251<sect3><title>dropdb</title>
252<para><command>dropdb</command> removes a
253<application>Postgre<acronym>SQL</acronym></application> database.</para>
254</sect3>
255
256<sect3><title>droplang</title>
257<para><command>droplang</command> removes a
258<application>Postgre<acronym>SQL</acronym></application> procedural
259language.</para></sect3>
260
261<sect3><title>dropuser</title>
262<para><command>dropuser</command> removes a
263<application>Postgre<acronym>SQL</acronym></application> user account.</para>
264</sect3>
265
266<sect3><title>ecpg</title>
267<para><command>ecpg</command> is the embedded <acronym>SQL</acronym>
268preprocessor.</para></sect3>
269
270<sect3><title>initdb</title>
271<para><command>initdb</command> create a new database cluster.</para></sect3>
272
273<sect3><title>initlocation</title>
274<para><command>initlocation</command> creates a secondary database storage
275area.</para></sect3>
276
277<sect3><title>ipcclean</title>
278<para><command>ipcclean</command> removes shared memory and semaphores left
279over by an aborted database server.</para></sect3>
280
281<sect3><title>pg_config</title>
282<para><command>pg_config</command> retrieves
283<application>Postgre<acronym>SQL</acronym></application> version
284information.</para></sect3>
285
286<sect3><title>pg_controldata</title>
287<para><command>pg_controldata</command> returns information initialized during
288<command>initdb</command>, such as the catalog version and server
289locale.</para></sect3>
290
291<sect3><title>pg_ctl</title>
292<para><command>pg_ctl</command> controls stopping and starting the database
293server.</para></sect3>
294
295<sect3><title>pg_dump</title>
296<para><command>pg_dump</command> dumps database data and metadata into scripts
297which are used to recreate the database.</para></sect3>
298
299<sect3><title>pg_dumpall</title>
300<para><command>pg_dumpall</command> recursively calls
301<command>pg_dump</command> for each database in a
302cluster.</para></sect3>
303
304<sect3><title>pg_resetxlog</title>
305<para><command>pg_resetxlog</command> clears the write-ahead log and optionally
306resets some fields in the <filename>pg_control</filename> file.</para></sect3>
307
308<sect3><title>pg_restore</title>
309<para><command>pg_restore</command> creates databases from dump files created by
310<command>pg_dump</command>.</para></sect3>
311
312<sect3><title>pgtclsh</title>
313<para><command>pgtclsh</command> is a <application>Tcl</application>
314shell interface extended with
315<application>Postgre<acronym>SQL</acronym></application> database access
316functions.</para></sect3>
317
318<sect3><title>pgtksh</title>
319<para><command>pgtksh</command> is a
320<application>Tcl</application>/<application>Tk</application> shell
321interface extended with
322<application>Postgre<acronym>SQL</acronym></application> database access
323functions.</para></sect3>
324
325<sect3><title>postgres</title>
326<para><command>postgres</command> is a single user database server, generally
327used for debugging.</para></sect3>
328
329<sect3><title>postmaster</title>
330<para><command>postmaster</command> is the multi-user database daemon.</para>
331</sect3>
332
333<sect3><title>psql</title>
334<para><command>psql</command> is a console based database shell.</para></sect3>
335
336<sect3><title>vacuumdb</title>
337<para><command>vacuumdb</command> compacts databases and generates statistics
338for the query analyzer.</para></sect3>
339
340</sect2>
341
342</sect1>
Note: See TracBrowser for help on using the repository browser.