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/pg731
If you want more control over the location of each component, you can add some more options to the configure command line. Table 19.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.
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.
Directory Name |
Filename |
File Type |
---|---|---|
bindir |
clusterdb createdb createlang createuser dropdb droplang dropuser ecpg initdb initlocation ipcclean pg_config pg_controldata pg_ctl pg_dump pg_dumpall pg_encoding pg_id pg_resetxlog pg_restore postgres postmaster psql vacuumdb |
shell script shell script shell script shell script shell script shell script shell script executable shell script shell script shell script shell script executable shell script executable executable executable executable executable executable executable symbolic link executable shell script |
sbindir |
Not used |
|
libexecdir |
Not used |
|
datadir /postgresql |
conversion_create.sql pg_hba.conf.sample pg_ident.conf.sample postgres.bki postgres.description postgresql.conf.sample |
SQL script example example server bootstrap server bootstrap example |
docdir |
postgresql/html/* |
Documentation in HTML form |
sysconfdir |
Not used |
|
sharedstatedir |
Not used |
|
localstatedir |
Not used |
|
libdir |
libecpg.a libecpg.so libpq.a libpq.so postgresql/plpgsql.so postgresql/* |
ECPG - library ECPG - shared libpq - library libpq - shared PL/PGSQL - shared Character mappings |
includedir |
ecpgerrno.h ecpglib.h ecpgtype.h libpq-fe.h pg_config.h pg_config_os.h postgres_ext.h sql3types.h sqlca.h libpq/libpq-fs.h postgresql/* |
CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file CPP include file |
oldincludedir |
Not used |
|
infodir |
Not used |
|
mandir |
man1/* man7/* |
Manual pages Manual pages |
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 19.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 or the Java JDBC interface). Tables 19.2 and 19.3, later in the chapter, show where PostgreSQL will install each of the optional packages.