source: content/databases/postgresql.xml@ df7efe5

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

Added --without-readline switch to PostgreSQL instructions, reported by Matthew Burgess.

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

  • Property mode set to 100644
File size: 11.2 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="readline"/>,
38<xref linkend="Python"/>,
39<xref linkend="tcl"/>,
40<xref linkend="tk"/>,
41<xref linkend="openssl"/>,
42<xref linkend="Linux_PAM"/>,
43<ulink url="http://www.pdc.kth.se/kth-krb/">krb4</ulink>,
44<xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
45<ulink url="http://ant.apache.org/">Ant</ulink> and
46<ulink url="http://rendezvous.sourceforge.net/">Rendezvous</ulink>
47</para></sect4>
48</sect3>
49
50</sect2>
51
52<sect2>
53<title>Installation of <application>Postgre<acronym>SQL</acronym></application></title>
54
55<para>Install <application>Postgre<acronym>SQL</acronym></application> with the following commands: </para>
56
57<screen><userinput><command>./configure --prefix=/usr --without-readline &amp;&amp;
58make &amp;&amp;
59make install</command></userinput></screen>
60
61<para>The standard installation provides only the header files needed
62for client application development. Server-side applications require
63the entire <application>Postgre<acronym>SQL</acronym></application>
64include tree which can be installed using the following command:</para>
65
66<screen><userinput><command>make install-all-headers</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><option>--without-readline</option>: Omit this switch if you have
107<application>readline</application> installed and wish to utilize
108it.</para>
109
110<para><command>useradd -d /var/pgsql/data postgres</command>: Add an unprivileged user to run the database server.</para>
111
112<para><command>createdb test, create table t1 , insert into t1 values..., select *
113from t1</command>: Create a database, add a table to it, insert some rows into the table
114and select them to verify that the installation is working
115properly.</para>
116
117</sect2>
118
119<sect2>
120<title>Configuring <application>Postgre<acronym>SQL</acronym></application></title>
121
122<sect3>
123<title>Config files</title>
124
125<para><filename>$PGDATA/pg_ident.con</filename>, <filename>$PGDATA/pg_hba.conf</filename>, <filename>$PGDATA/postgresql.conf</filename></para>
126
127<para>The <envar>PGDATA</envar> environment variable is used to distinguish database
128clusters from one another by setting it to the value of the directory
129which contains the cluster desired. The three configuration files
130exist in every <filename class="directory">PGDATA/</filename> directory.
131Details on the format of the files and the options that can be set in
132each can be found in <ulink
133url="file:///usr/share/doc/postgresql/html/index.html"/>.</para>
134
135<para>Install the <filename>/etc/rc.d/init.d/postgresql</filename>
136init script included in the <xref linkend="intro-important-bootscripts"/> package.</para>
137
138<screen><userinput><command>make install-postgresql</command></userinput></screen>
139
140</sect3>
141
142</sect2>
143
144<sect2>
145<title>Contents</title>
146
147<para>The <application>Postgre<acronym>SQL</acronym></application> package contains
148<command>clusterdb</command>,
149<command>createdb</command>,
150<command>createlang</command>,
151<command>createuser</command>,
152<command>dropdb</command>,
153<command>droplang</command>,
154<command>dropuser</command>,
155<command>ecpg</command>,
156<command>initdb</command>,
157<command>initlocation</command>,
158<command>ipcclean</command>,
159<command>pg_config</command>,
160<command>pg_controldata</command>,
161<command>pg_ctl</command>,
162<command>pg_dump</command>,
163<command>pg_dumpall</command>,
164<command>pg_encoding</command>,
165<command>pg_id</command>,
166<command>pg_resetxlog</command>,
167<command>pg_restore</command>,
168<command>pgtclsh</command>,
169<command>pgtksh</command>,
170<command>pltcl_delmod</command>,
171<command>pltcl_listmod</command>,
172<command>pltcl_loadmod</command>,
173<command>postgres</command>,
174<command>postmaster</command>,
175<command>psql</command>,
176<command>vacuumdb</command>,
177<filename class="libraryfile">libecpg</filename>,
178<filename class="libraryfile">libpgtcl</filename>,
179<filename class="libraryfile">libpgtypes</filename>,
180<filename class="libraryfile">libpq</filename> and various charset
181modules.</para>
182
183</sect2>
184
185<sect2><title>Description</title>
186
187<sect3><title>clusterdb</title>
188<para><command>clusterdb</command> is a utility for reclustering tables
189in a <application>Postgre<acronym>SQL</acronym></application>
190database.</para></sect3>
191
192<sect3><title>createdb</title>
193<para><command>createdb</command> creates a new
194<application>Postgre<acronym>SQL</acronym></application> database.</para></sect3>
195
196<sect3><title>createlang</title>
197<para><command>createlang</command> defines a new
198<application>Postgre<acronym>SQL</acronym></application> procedural
199language.</para></sect3>
200
201<sect3><title>createuser</title>
202<para><command>createuser</command> defines a new
203<application>Postgre<acronym>SQL</acronym></application> user account.</para></sect3>
204
205<sect3><title>dropdb</title>
206<para><command>dropdb</command> removes a
207<application>Postgre<acronym>SQL</acronym></application> database.</para></sect3>
208
209<sect3><title>droplang</title>
210<para><command>droplang</command> removes a
211<application>Postgre<acronym>SQL</acronym></application> procedural
212language.</para></sect3>
213
214<sect3><title>dropuser</title>
215<para><command>dropuser</command> removes a
216<application>Postgre<acronym>SQL</acronym></application> user account.</para></sect3>
217
218<sect3><title>ecpg</title>
219<para><command>ecpg</command> is the embedded <acronym>SQL</acronym> preprocessor.</para></sect3>
220
221<sect3><title>initdb</title>
222<para><command>initdb</command> create a new database cluster.</para></sect3>
223
224<sect3><title>initlocation</title>
225<para><command>initlocation</command> creates a secondary database storage
226area.</para></sect3>
227
228<sect3><title>ipcclean</title>
229<para><command>ipcclean</command> removes shared memory and semaphores left over by an
230aborted database server.</para></sect3>
231
232<sect3><title>pg_config</title>
233<para><command>pg_config</command> retrieves
234<application>Postgre<acronym>SQL</acronym></application> version
235information.</para></sect3>
236
237<sect3><title>pg_controldata</title>
238<para><command>pg_controldata</command> returns information initialized during
239<command>initdb</command>, such as the catalog version and server
240locale.</para></sect3>
241
242<sect3><title>pg_ctl</title>
243<para><command>pg_ctl</command> controls stopping and starting the database
244server.</para></sect3>
245
246<sect3><title>pg_dump</title>
247<para><command>pg_dump</command> dumps database data and metadata into scripts which are
248used to recreate the database.</para></sect3>
249
250<sect3><title>pg_dumpall</title>
251<para><command>pg_dumpall</command> recursively calls
252<command>pg_dump</command> for each database in a
253cluster.</para></sect3>
254
255<sect3><title>pg_resetxlog</title>
256<para><command>pg_resetxlog</command> clears the write-ahead log and optionally resets some
257fields in the <filename>pg_control</filename> file.</para></sect3>
258
259<sect3><title>pg_restore</title>
260<para><command>pg_restore</command> creates databases from dump files created by
261<command>pg_dump</command>.</para></sect3>
262
263<sect3><title>pgtclsh</title>
264<para><command>pgtclsh</command> is a <application>Tcl</application>
265shell interface extended with
266<application>Postgre<acronym>SQL</acronym></application> database access
267functions.</para></sect3>
268
269<sect3><title>pgtksh</title>
270<para><command>pgtksh</command> is a
271<application>Tcl</application>/<application>Tk</application> shell
272interface extended with
273<application>Postgre<acronym>SQL</acronym></application> database access
274functions.</para></sect3>
275
276<sect3><title>postgres</title>
277<para><command>postgres</command> is a single user database server, generally used for
278debugging.</para></sect3>
279
280<sect3><title>postmaster</title>
281<para><command>postmaster</command> is the multi-user database daemon.</para></sect3>
282
283<sect3><title>psql</title>
284<para><command>psql</command> is a console based database shell.</para></sect3>
285
286<sect3><title>vacuumdb</title>
287<para><command>vacuumdb</command> compacts databases and generates statistics for the
288query analyzer.</para></sect3>
289
290</sect2>
291
292</sect1>
Note: See TracBrowser for help on using the repository browser.