Install PostgreSQL 17 on AlmaLinux 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 AlmaLinux 10 using the official PostgreSQL YUM repository.
Prerequisites
-
AlmaLinux 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
PostgreSQL provides official RPM repositories for RHEL-based systems including AlmaLinux.
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Output:
[root@vps ~]# sudo 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: 0:05:12 ago on Sun Jun 1 08:35:17 2025.
pgdg-redhat-repo-latest.noarch.rpm 1.2 MB/s | 13 kB 00:00
Dependencies resolved.
==========================================================================================================================
Package Architecture Version Repository Size
==========================================================================================================================
Upgrading:
pgdg-redhat-repo noarch 42.0-53PGDG @commandline 13 k
Transaction Summary
==========================================================================================================================
Upgrade 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 ~]# sudo dnf install -y postgresql17-server
Last metadata expiration check: 0:00:08 ago on Sun Jun 1 08:54:43 2025.
Dependencies resolved.
==========================================================================================================================
Package Architecture Version Repository Size
==========================================================================================================================
Installing:
postgresql17-server x86_64 17.5-3PGDG.rhel10 pgdg17 7.0 M
Installing dependencies:
libicu x86_64 74.2-4.el10 baseos 10 M
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 4 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 AlmaLinux 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