source: content/databases/postgresql.xml@ b054b795

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 b054b795 was b054b795, checked in by Igor Živković <igor@…>, 20 years ago

Updated to PostgreSQL-7.4.3.

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

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