Installing and moving the files to where they belong
This is the step where the files are copied to the correct directories. As the installation process involves writing files to directories, which an ordinary user cannot write to, we need to use su
for this step:
su
If you are interested in seeing what happens during the installation step, redirect the output to a file, for example, gmake install-world > /tmp/install.out
.
We used the keyword world
for make. We will use a similar option for installation too:
gmake install-world
If all goes well, we will see a message that says PostgreSQL, contrib, and documentation successfully made. Ready to install
. If the output was directed to a file as mentioned, we can open it and see that the installation process created a /usr/local/pgsql
directory with a few subdirectories for various components. Then, the install
command copied the directories and files to target directories and set attributes such as permissions. Refer to the highlighted portion in the following screenshot:
Inspecting the changes
As we did not make any changes to the default options, the installation files will be at /usr/local/pgsql
. In this, we have four directories, namely include
, lib
, share
, and bin
. The include
directory contains header files (.h
) extension, and the lib
directory contains all the libraries to be linked dynamically (.so
in the case of Linux/Unix systems and .dll
in the case of Windows systems). The bin
directory, of course, contains executables.
It is the share
directory that is a bit more interesting. Here, we have a number of sample files, namely, pg_hba.conf.sample
, pg_ident.conf.sample
, pg_service.conf.sample
, postgresql.conf.sample
, psqlrc.sample
, and recovery.conf.sample
. Once we initialize a cluster and make changes to various configuration files and then lose track of the changes, we can compare with these files and understand what changes have been made or roll back the changes if necessary.
This directory also has a few SQL files such as information_schema.sql
and system_view.sql
, which go into creating metadata views when a database cluster is initialized.
At the next level of directories under share
, we have the doc
directory that holds the documentation, and the man
directory that holds the manual pages, and so on. The directory of interest under share
is the one named extension
. Here, we can see all the extensions, which we can install as per our need. Most extensions have a .control
file that provides basic information, as shown here:
[jay@MyCentOS extension]$ more dblink.control # dblink extension comment = 'connect to other PostgreSQL databases from within a database' default_version = '1.1' module_pathname = '$libdir/dblink' relocatable = true
There will be SQL files that correspond to each extension, and these will be used when we install the extension in a database we choose.
The documentation to install PostgreSQL from source is at http://www.postgresql.org/docs/current/static/installation.html.
Note that we have just installed the database software. There is no database available to connect to yet. Adding a user for the database administration tasks and initializing a database cluster are the next steps.