Install PostgreSQL 17 on Rocky Linux 10

Introduction

PostgreSQL is a powerful, open-source object-relational database system with over 30 years of active development. It's known for its robustness, feature set, and SQL compliance. This guide explains how to install PostgreSQL 17 on Rocky Linux 10 using the official PostgreSQL YUM repository.

Prerequisites

  • Rocky Linux 10 (64-bit) system

  • Sudo/root access

  • Internet connectivity

Install PostgreSQL 17

At the time of writing this article, version 17 is the latest version available from PostgreSQL.

Add the PostgreSQL YUM Repository

Check PostgreSQL official website to find out the latest version available at the time of installation.

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

Output:

[root@vps ~]# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Last metadata expiration check: 1:35:27 ago on Fri 20 Jun 2025 03:30:40 AM UTC.
pgdg-redhat-repo-latest.noarch.rpm              285 kB/s |  13 kB     00:00
Dependencies resolved.
================================================================================
 Package                Architecture Version           Repository          Size
================================================================================
Installing:
 pgdg-redhat-repo       noarch       42.0-53PGDG       @commandline        13 k

Transaction Summary
================================================================================
Install  1 Package

Disable the Default PostgreSQL Module

AlmaLinux comes with a default PostgreSQL module, but we disable it to use the official version (v17) from the new repository.

dnf -qy module disable postgresql

Install PostgreSQL 17 Server Package

Now install PostgreSQL 17 using dnf.

dnf install -y postgresql17-server

Output:

[root@vps ~]# dnf install -y postgresql17-server
Last metadata expiration check: 0:00:16 ago on Fri 20 Jun 2025 05:06:54 AM UTC.
Dependencies resolved.
================================================================================
 Package                  Arch        Version                 Repository   Size
================================================================================
Installing:
 postgresql17-server      x86_64      17.5-3PGDG.rhel10       pgdg17      7.0 M
Installing dependencies:
 postgresql17             x86_64      17.5-3PGDG.rhel10       pgdg17      1.9 M
 postgresql17-libs        x86_64      17.5-3PGDG.rhel10       pgdg17      344 k

Transaction Summary
================================================================================
Install  3 Packages

Initialize the PostgreSQL Database

This sets up the necessary database cluster and configuration files.

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

Enable and Start the PostgreSQL Service

Make PostgreSQL start on boot and start it immediately.

systemctl enable postgresql-17
systemctl start postgresql-17

Post-Installation

Check PostgreSQL Version

Verify that PostgreSQL 17 is installed and working.

psql --version

Output:

[root@vps ~]# psql --version
psql (PostgreSQL) 17.5

Switch to the postgres User

PostgreSQL creates a system user called postgres by default. Use it to interact with the database server.

sudo -i -u postgres

Output:

[root@vps ~]# sudo -i -u postgres
[postgres@vps ~]$

Log in to PostgreSQL Command Line Interface

Once you're the postgres user, log in to the PostgreSQL shell using:

psql

Output:

[postgres@vps ~]$ psql
psql (17.5)
Type "help" for help.

postgres=# 

You should now be inside the PostgreSQL CLI. You'll see a prompt like this:

postgres=#

Exit PostgreSQL Shell and Switch Back

To exit the PostgreSQL prompt:

\q

Output:

postgres=# \q
[postgres@vps ~]$ 

Conclusion

PostgreSQL 17 is now installed and running on your Rocky Linux 10 system. You’ve added the official repository, disabled the system default module, initialized the database, and verified access using psql. You’re now ready to start creating databases, users, and applications powered by PostgreSQL.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS