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