Install PostgreSQL

Page content

In this pos I will show you how to install Postgresql on difrent Linux distributions.

PostgreSQL, also known as Postgres, is a free and open-source relational database management system (RDBMS).

Install PostgreSQL 9.6 on CentOS 7

yum install epel-release -y
yum update -y
rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

yum install -y postgresql96-server postgresql96 postgresql96-contrib unzip
/usr/pgsql-9.6/bin/postgresql96-setup initdb

nano /var/lib/pgsql/9.6/data/pg_hba.conf
local   all             all                                      trust

sudo systemctl start postgresql-9.6
sudo systemctl enable postgresql-9.6

Install PostgreSQL 10 on CentOS 7

yum install epel-release -y
yum update -y
rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

yum -y install postgresql10-server postgresql10-contrib postgresql10
/usr/pgsql-10/bin/postgresql-10-setup initdb

nano /var/lib/pgsql/10/data/pg_hba.conf
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
local   all             postgres                                peer

sudo systemctl start postgresql-10
sudo systemctl enable postgresql-10

Install PostgreSQL 10 on CentOS 8

yum install postgresql postgresql-server postgresql-contrib -y

postgresql-setup --initdb

nano /var/lib/pgsql/data/pg_hba.conf
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
local   all             postgres                                peer

systemctl start postgresql
systemctl enable postgresql

Install PostgreSQL 10 on Debian

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" > /etc/apt/sources.list.d/PostgreSQL.list'

apt update
apt-get install postgresql-10
apt-get install pgadmin4

systemctl enable postgresql.service
comments powered by Disqus