How to Install PostgreSQL 10 on Linux and BSD

install postgresql 10 linux In ourĀ earlier article, we have covered about phpPgAdmin configuration on Centos7. In this article, I am going to show how to install the latest PostgreSQL 10 database on Linux and BSD distributions. PostgreSQL is an object-related database management system.The latest stable release of PostgreSQL 10 includes such features as logical replication using publish/subscribe, declarative table partitioning, improved query parallelism, significant general performance improvements, stronger password authentication and improved monitoring and control.

RedHat/CentOS installation

For RHEL/CentOS 6

Install the RPM repository

# yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-1.noarch.rpm

Install server packages

# yum install postgresql10-server

Install the client packages

# yum install postgresql10

Initializing database and automatic start

# service postgresql-10 initdb
# chkconfig postgresql-10 on
# service postgresql-10 start

For RHEL/CentOS 7

Install the RPM repository

# yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm

Install server packages

# yum install postgresql10-server

Install the client packages

# yum install postgresql10

Initializing database and automatic start

# /usr/pgsql-10/bin/postgresql10-setup initdb
# systemctl enable postgresql-10
# systemctl start postgresql-10

Debian installation

You will need to create file /etc/apt/sources.list.d/pgdg.list and add a line for PostgreSQL repository depending on your Debian distribution

Wheezy 7.x

deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main

Jessie 8.x

deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main

Stretch 9.x

deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main

Import key and update package list

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update

Install PostgreSQL

$ sudo apt-get install postgresql-10

Note
You may need to install sudo package as root user

$ su -
# apt install sudo

And add your non-root user to sudo group

# usermod -a -G sudo username

Ubuntu Installation

Earlier we have written an article on setup Postgresql 9.6 and access PHPpgAdmin on Ubuntu 16.04.

You will need to create file /etc/apt/sources.list.d/pgdg.list and add a line for PostgreSQL repository depending on your Ubuntu distribution

Trusty 14.04

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

Xenial 16.04

deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main

Zesty 17.04

deb http://apt.postgresql.org/pub/repos/apt/ zesty-pgdg main

Import key and update package list

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update

Install PostgreSQL

$ sudo apt-get install postgresql-10

FreeBSD 11 installation

Search for PostgreSQL package

# pkg search postgresql10

Installation

# pkg install postgresql10

To run database on startup add postgresql_enable="YES" to /etc/rc.conf

# sysrc postgresql_enable="YES"

Enable cluster before start using

# service postgresql initdb

Start PostgreSQL

# service postgresql start

Hope this article was helpful in installing the latest PostgreSQL release on any Linux or FreeBSD. For further details or additional information about database, you can refer to PostgreSQL official site.

About Pavlo Maiorchyk

Systems Administrator and hardware developer with 4 years of professional experience in IT. My goal is to deliver only best solutions and customer support.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

1 Comment