source: content/databases/postgresql.xml@ bccf77a5

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 bccf77a5 was bccf77a5, checked in by Randy McMurchy <randy@…>, 20 years ago

Added instructions to PostgreSQL to correct improper ownership of documentation files

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

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