source: content/databases/postgresql.xml@ f2464092

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

added an optional command for installing postgresql server-side headers

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