postgresql Installation on GNU+Linux


On most GNU+Linux operating systems, PostgreSQL can easily be installed using the operating system package manager.

Red Hat family

Respositories can be found here:

Download the repository to local machine with the command

yum -y install

View available packages:

yum list available | grep postgres*

Neccesary packages are: postgresqlXX postgresqlXX-server postgresqlXX-libs postgresqlXX-contrib

These are installed with the following command: yum -y install postgresqlXX postgresqlXX-server postgresqlXX-libs postgresqlXX-contrib

Once installed you will need to start the database service as the service owner (Default is postgres). This is done with the pg_ctl command.

sudo -su postgres
./usr/pgsql-X.X/bin/pg_ctl -D /var/lib/pgsql/X.X/data start 

To access the DB in CLI enter psql

Debian family

On Debian and derived operating systems, type:

sudo apt-get install postgresql

This will install the PostgreSQL server package, at the default version offered by the operating system's package repositories.

If the version that's installed by default is not the one that you want, you can use the package manager to search for specific versions which may simultaneously be offered.

You can also use the Yum repository provided by the PostgreSQL project (known as PGDG) to get a different version. This may allow versions not yet offered by operating system package repositories.