source: content/databases/postgresql.xml@ 08254fc

10.0 10.1 11.0 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 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk upgradedb xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 08254fc was 08254fc, checked in by Bruce Dubbs <bdubbs@…>, 18 years ago

New XML - Part VII

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

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