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