PostgreSQL Logo

PostgreSQL Documentation

Linux Installation & Administration Guide

PostgreSQL Installation on Linux

Enterprise PostgreSQL installation, repository configuration, Linux administration and PostgreSQL server deployment for Red Hat Enterprise Linux and Ubuntu systems.

PostgreSQL Installation on RHEL (Linux)

Step 1

Navigate to:

https://www.postgresql.org/download/

Step 2

Select operating system as Linux.

Step 3

Select appropriate Linux distribution (Example: Red Hat).

Step 4

Select PostgreSQL YUM Repository.

Step 5

Select latest PostgreSQL version.

Step 6

Select appropriate platform.

Step 7

Copy and execute the installation commands on your Linux server.

# Install PostgreSQL repository

sudo dnf install -y \
https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable built-in PostgreSQL module

sudo dnf -qy module disable postgresql

# Install PostgreSQL Server

sudo dnf install -y postgresql17-server

# Install PostgreSQL Contrib Package

sudo dnf install -y postgresql17-contrib

# Initialize Database

sudo /usr/pgsql-17/bin/postgresql-17-setup initdb

# Enable PostgreSQL Service

sudo systemctl enable postgresql-17

# Start PostgreSQL Service

sudo systemctl start postgresql-17

# Verify Service Status

sudo systemctl status postgresql-17

Create Sudo User on Linux

Create User

adduser username
passwd username

Add User to Wheel Group

usermod -aG wheel username

Verify User Membership

cat /etc/group | grep wheel

PostgreSQL Installation on Ubuntu

Step 1

Navigate to:

https://www.postgresql.org/download/

Step 2

Select Linux operating system.

Step 3

Select Ubuntu distribution.

Step 4

Ubuntu includes PostgreSQL by default. Install PostgreSQL using apt.

sudo apt install postgresql postgresql-contrib

Alternative Method — PostgreSQL APT Repository

Use PostgreSQL official repository for latest PostgreSQL versions.

Automated Repository Configuration

sudo apt install -y postgresql-common

sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

Manual Repository Configuration

# Install required packages

sudo apt install curl ca-certificates

# Create directory

sudo install -d /usr/share/postgresql-common/pgdg

# Download repository key

sudo curl -o \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
--fail \
https://www.postgresql.org/media/keys/ACCC4CF8.asc

# Configure repository

sudo sh -c \
'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
https://apt.postgresql.org/pub/repos/apt \
$(lsb_release -cs)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list'

# Update package list

sudo apt update

# Install PostgreSQL

sudo apt -y install postgresql

Need PostgreSQL Enterprise Support?

PostgreSQL administration, replication architecture, high availability, performance tuning and enterprise DBA consulting.

Contact Now ikram5@zohomail.in