I find it much easier to administer a product if I know where every component is located. With that in mind, let's explore the directory structure for a "standard" PostgreSQL installation.
When you install PostgreSQL, whether from an RPM (Red Hat Package Manager) or from source, it will be configured to install into a particular set of directories. The exact location for any given set of PostgreSQL files is determined when the package is built from source code.
When you build a copy of PostgreSQL from source code (more on that a little later), the prefix= directory-name flag determines the installation directory. The default value for prefix is /usr/local/pgsql. You can change this by supplying a different prefix directory when you run the configure program:
$ ./configure prefix=/home/bruce/pg801
If you want more control over the location of each component, you can add some more options to the configure command line. Table 21.1 shows the location of each component. The leftmost column shows the name of a configure option, the second column lists PostgreSQL components, and the last column shows the component type.
Directory Name |
Filename |
File Type |
---|---|---|
bindir |
clusterdb |
shell script |
createdb |
shell script |
|
createlang |
shell script |
|
createuser |
shell script |
|
dropdb |
shell script |
|
droplang |
shell script |
|
dropuser |
shell script |
|
ecpg |
executable |
|
initdb |
shell script |
|
initlocation |
shell script |
|
ipcclean |
shell script |
|
pg_config |
shell script |
|
pg_controldata |
executable |
|
pg_ctl |
shell script |
|
pg_dump |
executable |
|
pg_dumpall |
executable |
|
pg_encoding |
executable |
|
pg_id |
executable |
|
pg_resetxlog |
executable |
|
pg_restore |
executable |
|
postgres |
executable |
|
postmaster |
symbolic link |
|
psql |
executable |
|
vacuumdb |
shell script |
|
sbindir |
Not used |
|
libexecdir |
Not used |
|
datadir |
conversion_create.sql |
SQL script |
/postgresql |
pg_hba.conf.sample |
example |
pg_ident.conf.sample |
example |
|
postgres.bki |
server bootstrap |
|
postgres.description |
server bootstrap |
|
postgresql.conf.sample |
example |
|
docdir |
postgresql/html/* |
Documentation in HTML form |
sysconfdir |
Not used |
|
sharedstatedir |
Not used |
|
localstatedir |
Not used |
|
libdir |
libecpg.a |
ECPG - library |
libecpg.so |
ECPG - shared |
|
libpq.a |
libpq - library |
|
libpq.so |
libpq - shared |
|
postgresql/plpgsql.so |
PL/PGSQL - shared |
|
postgresql/* |
Character mappings |
|
includedir |
ecpgerrno.h |
CPP include file |
ecpglib.h |
CPP include file |
|
ecpgtype.h |
CPP include file |
|
libpq-fe.h |
CPP include file |
|
pg_config.h |
CPP include file |
|
pg_config_os.h |
CPP include file |
|
postgres_ext.h |
CPP include file |
|
sql3types.h |
CPP include file |
|
sqlca.h |
CPP include file |
|
libpq/libpq-fs.h |
CPP include file |
|
postgresql/* |
CPP include file |
|
oldincludedir |
Not used |
|
infodir |
Not used |
|
mandir |
man1/* |
Manual pages |
man7/* |
Manual pages |
If you want, for example, to place the PostgreSQL shared libraries in a particular directory, you would add libdir= location to the configure command line.
The directories marked as not used are described when you run configure help (configure is a commonly used generic configuration program), but are not used by PostgreSQL.
Table 21.1 shows where PostgreSQL will install the content of a basic configuration. You also can configure PostgreSQL to install optional packages (such as PL/Perl). Tables 21.2 and 21.3, later in the chapter, show where PostgreSQL will install each of the optional packages.
Package Name |
Package Contents |
---|---|
base |
server (postgres, postmaster) |
contributed software (contrib) |
|
include files |
|
initdb |
|
ipcclean |
|
pg_config |
|
pg_controldata |
|
pg_ctl |
|
pg_dump |
|
pg_resetxlog |
|
psql |
|
clusterdb |
|
createdb |
|
createlang |
|
createuser |
|
dropdb |
|
droplang |
|
dropuser |
|
vacuumdb |
|
cli client interface |
|
ecpg client interface |
|
libpq client interface |
|
PL/pgSQL server-side language |
|
docs |
Documentation in SGML form (converted to HTML and man page format during build process) |
opt |
src/tools (misc. tools for use by PostgreSQL authors) |
CORBA interface |
|
Tutorial |
|
PL/Perl server-side language |
|
PL/Tcl server-side language |
|
PL/Python server-side language |
|
test |
Regression tests |
RPM Package Name |
Package Contents |
---|---|
postgresql |
clusterdb |
createdb |
|
createlang |
|
createuser |
|
dropdb |
|
droplang |
|
dropuser |
|
pg_dump |
|
pg_dumpall |
|
pg_restore |
|
psql |
|
vacuumdb |
|
documentation |
|
postgresql-server |
initdb |
ipcclean |
|
pg_controldata |
|
pg_ctl |
|
pg_resetxlog |
|
server (postgres, postmaster) |
|
PL/pgSQL |
|
server locale files |
|
timezone information |
|
postgresql-libs |
ecpg library |
libpq library |
|
client locale files |
|
postgresql-contrib |
contributed software |
postgresql-docs |
documentation |
postgresql-jdbc |
JDBC (Java) interface |
postgresql-pl |
PL/Perl |
PL/Python |
|
postgresql-python |
Python client interface |
postgresql-devel |
ecpg (embedded SQL C preprocessor) |
pg_config |
|
header files (for C development) |
|
ecpg library |
|
libpq library |
|
ecpg and pg_config documentation |
|
postgresql-test |
regression test suite |
Part I: General PostgreSQL Use
Introduction to PostgreSQL and SQL
Working with Data in PostgreSQL
PostgreSQL SQL Syntax and Use
Performance
Part II: Programming with PostgreSQL
Introduction to PostgreSQL Programming
Extending PostgreSQL
PL/pgSQL
The PostgreSQL C APIlibpq
A Simpler C APIlibpgeasy
The New PostgreSQL C++ APIlibpqxx
Embedding SQL Commands in C Programsecpg
Using PostgreSQL from an ODBC Client Application
Using PostgreSQL from a Java Client Application
Using PostgreSQL with Perl
Using PostgreSQL with PHP
Using PostgreSQL with Tcl and Tcl/Tk
Using PostgreSQL with Python
Npgsql: The .NET Data Provider
Other Useful Programming Tools
Part III: PostgreSQL Administration
Introduction to PostgreSQL Administration
PostgreSQL Administration
Internationalization and Localization
Security
Replicating PostgreSQL Data with Slony
Contributed Modules
Index