How to Install PostgreSQL 14 on Fedora Linux

Last updated Wednesday, March 11, 2026 12:02 pm Joshua James 6 min read

Fedora 43 ships PostgreSQL 18.1 by default, which is fine for new deployments but not for application stacks that still depend on the 14.x branch. To install PostgreSQL 14 on Fedora, use the official PGDG repository instead of Fedora’s own postgresql-server package.

That keeps you on the PostgreSQL 14 release line, currently 14.22, while still using normal DNF updates. The steps below cover the repo setup, the versioned postgresql-14.service workflow, psql access, remote connections, troubleshooting, and clean removal.

Install PostgreSQL 14 on Fedora

Fedora 43 points postgresql-server at PostgreSQL 18.1, so PGDG is the clean path when you need PostgreSQL 14 specifically. The comparison below shows the differences that matter before you switch.

SourceFedora 43 versionServer packageService nameInitdb commandBest fit
Fedora updates repo18.1.xpostgresql-serverpostgresql.servicepostgresql-setup –initdbNew installs that want Fedora’s current PostgreSQL branch
PGDG repo14.22.xpostgresql14-serverpostgresql-14.service/usr/pgsql-14/bin/postgresql-14-setup initdbApplications that still need PostgreSQL 14 specifically

PostgreSQL’s support matrix lists PostgreSQL 14 as supported through November 12, 2026. The official PGDG Fedora and Red Hat instructions also note that Fedora’s short lifecycle makes it a better fit for development, testing, and compatibility work than for long-lived server deployments.

Update Fedora and confirm the default PostgreSQL package

Start with a normal Fedora package refresh so DNF5 has current metadata before you add PGDG packages.

sudo dnf upgrade --refresh

This guide uses sudo for commands that need root privileges. If your account is not in the sudoers file yet, follow the guide to add a user to sudoers on Fedora first.

If you want to see what Fedora would install without PGDG, check the default candidate package now.

sudo dnf info postgresql-server.x86_64
Available packages
Name           : postgresql-server
Version        : 18.1
Release        : 1.fc43
Architecture   : x86_64
Repository     : updates
Summary        : The programs needed to create and run a PostgreSQL server

That output confirms why the rest of this guide uses the PGDG package names instead of Fedora’s unversioned PostgreSQL 18 packages.

Add the PGDG repo package

The file named pgdg-fedora-repo-latest.noarch.rpm installs the repository definitions and the matching PGDG key file for your Fedora release.

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/F-$(rpm -E %fedora)-x86_64/pgdg-fedora-repo-latest.noarch.rpm

Verify that the repo package is installed before you move on.

rpm -q pgdg-fedora-repo
pgdg-fedora-repo-42.0-43PGDG.noarch

Import the PGDG signing key and keep only PostgreSQL 14 enabled

Import the PGDG Fedora key explicitly so the package install stays non-interactive. On Fedora 43, this avoids the Is this ok [y/N] prompt that otherwise appears the first time DNF hits the signed PGDG metadata.

sudo rpm --import /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-Fedora

You can confirm the key is in the RPM database with:

rpm -q gpg-pubkey --qf "%{VERSION}-%{RELEASE} %{SUMMARY}\n" | grep PostgreSQL
d4bf08ae67a0b4c7a1dbccd240bca2b408b40d20-6581afc1 PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org> public key

The repo package enables several PostgreSQL majors by default. Fedora 43 currently also carries an enabled PostgreSQL 13 entry that points to a missing path, so it is worth narrowing the enabled PGDG repos to PostgreSQL 14 plus the shared common packages.

sudo dnf config-manager setopt \
  pgdg13.enabled=0 \
  pgdg14.enabled=1 \
  pgdg15.enabled=0 \
  pgdg16.enabled=0 \
  pgdg17.enabled=0 \
  pgdg18.enabled=0 \
  pgdg-common.enabled=1

Verify that only the PostgreSQL 14 repo and the shared PGDG common repo remain enabled.

sudo dnf repo list --enabled | grep pgdg
pgdg14                PostgreSQL 14 for Fedora 43 - x86_64
pgdg-common           PostgreSQL common RPMs for Fedora 43 - x86_64

Install the PostgreSQL 14 server package

The postgresql14-server package installs the versioned server unit, and it pulls in the postgresql14 client package as a dependency.

sudo dnf install -y postgresql14-server
Package              Arch   Version         Repository      Size
Installing:
 postgresql14-server x86_64 14.22-1PGDG.f43 pgdg14      23.3 MiB
Installing dependencies:
 postgresql14        x86_64 14.22-1PGDG.f43 pgdg14       7.8 MiB
 postgresql14-libs   x86_64 14.22-1PGDG.f43 pgdg14     920.8 KiB

Transaction Summary:
 Installing:         3 packages

Complete!

Use the client-only package instead if you just need psql from this Fedora host and do not want a local PostgreSQL server.

sudo dnf install -y postgresql14

If you already installed postgresql14-server, skip the client-only command. The server package already pulled in postgresql14 and registered psql through Fedora’s alternatives system.

Initialize the database cluster and start PostgreSQL 14

PGDG packages do not create the data directory automatically. Run the versioned setup tool once, then enable the service.

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable --now postgresql-14
Initializing database ... OK

Created symlink '/etc/systemd/system/multi-user.target.wants/postgresql-14.service' → '/usr/lib/systemd/system/postgresql-14.service'.

Check the service status after the first start.

systemctl status postgresql-14 --no-pager
● postgresql-14.service - PostgreSQL 14 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-14.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Wed 2026-03-11 11:46:36 AWST; 33ms ago
       Docs: https://www.postgresql.org/docs/14/static/

Verify psql and pg_isready

The generic psql launcher is available through /usr/bin/psql, but the readiness probe stays versioned under /usr/pgsql-14/bin/pg_isready.

psql --version
/usr/pgsql-14/bin/pg_isready
psql (PostgreSQL) 14.22
/run/postgresql:5432 - accepting connections

Manage PostgreSQL 14 on Fedora

PGDG packages use a versioned systemd unit and the standard postgres operating-system account. These are the commands you will use most often after the install.

Connect to PostgreSQL as the postgres user

Use the postgres account for the first administrative login so you do not run into the common Fedora error where psql tries to use your Linux username as a database role.

sudo -u postgres psql
psql (14.22)
Type "help" for help.

postgres=#

Leave the PostgreSQL prompt with \q when you are done.

Create a database and login role

For application access, create a dedicated login role and give it ownership of a dedicated database instead of using the postgres superuser. Replace myappuser, myappdb, and the sample password with values that match your application.

CREATE ROLE myappuser LOGIN PASSWORD 'ChangeMe123!';
CREATE DATABASE myappdb OWNER myappuser;

Open psql as postgres, run those SQL statements, then verify the new credentials with a local TCP connection.

PGPASSWORD="ChangeMe123!" psql -h 127.0.0.1 -U myappuser -d myappdb -c "SELECT current_database(), current_user;"
 current_database | current_user 
------------------+--------------
 myappdb          | myappuser
(1 row)

Common PostgreSQL 14 service commands

Use restart after changes to listen_addresses. Use reload when you only changed pg_hba.conf and do not need a full restart.

sudo systemctl stop postgresql-14
sudo systemctl start postgresql-14
sudo systemctl restart postgresql-14
sudo systemctl reload postgresql-14

For deeper tuning and authentication options, the official PostgreSQL 14 documentation is the reference for every server parameter and SQL administration command.

Allow Remote PostgreSQL 14 Connections on Fedora

Skip this section if your application and PostgreSQL run on the same Fedora host. The default Fedora 43 configuration already listens on localhost and uses password authentication for TCP connections on 127.0.0.1 and ::1.

Keep listen_addresses = 'localhost' and skip the firewalld change if PostgreSQL is only used locally. Opening 5432/tcp is only necessary when remote clients need to reach the database server.

Edit postgresql.conf and pg_hba.conf

Edit the versioned PostgreSQL 14 configuration files under /var/lib/pgsql/14/data/. The first file controls which interfaces PostgreSQL listens on, and the second file controls which clients may authenticate.

sudo nano /var/lib/pgsql/14/data/postgresql.conf
sudo nano /var/lib/pgsql/14/data/pg_hba.conf

Set a listen address in postgresql.conf that matches the access you want to allow.

listen_addresses = '*'

Then add a narrow network rule to pg_hba.conf. Replace the sample subnet with the source IP range that should be allowed to connect.

host    all             all             192.168.1.0/24          scram-sha-256

Restart PostgreSQL after you change listen_addresses, then check the listening sockets.

sudo systemctl restart postgresql-14
ss -tln | grep 5432
LISTEN 0      244          0.0.0.0:5432      0.0.0.0:*   
LISTEN 0      244             [::]:5432         [::]:*

If that command still shows only 127.0.0.1:5432 and ::1:5432, PostgreSQL is still local-only and remote clients will be refused.

Open firewalld for PostgreSQL

Fedora’s default firewall already includes a postgresql service definition, so you usually do not need a custom zone just to open port 5432.

sudo firewall-cmd --permanent --add-service=postgresql
sudo firewall-cmd --reload
sudo firewall-cmd --list-services
dhcpv6-client postgresql samba-client ssh

If firewall-cmd is missing or the service is inactive on your system, install firewalld on Fedora before you expose PostgreSQL to the network.

If a local Nginx or Apache application still cannot connect after pg_hba.conf and firewalld are correct, Fedora’s default SELinux policy may be blocking the web server domain. Allow database connections with sudo setsebool -P httpd_can_network_connect_db 1 and inspect recent denials with sudo ausearch -m avc -ts recent | grep postgres. If ausearch is missing, install the audit package first with sudo dnf install audit.

Troubleshoot PostgreSQL 14 on Fedora

psql says role does not exist

This happens when you launch psql as your normal Linux user before a matching PostgreSQL role exists. The client tries your current Linux username by default.

psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "joshua" does not exist

Connect as postgres for the first admin session, or create a login role for the Linux account you want to use.

sudo -u postgres psql
sudo -u postgres psql -c "\du"
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 myappuser |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

psql says no such file or directory or connection refused

This usually means the service is stopped or the database cluster was never initialized.

psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?

Check the service first. If the cluster has not been initialized yet, run the PostgreSQL 14 setup command again before you restart the service.

systemctl status postgresql-14 --no-pager
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable --now postgresql-14
/usr/pgsql-14/bin/pg_isready
/run/postgresql:5432 - accepting connections

postgresql.service not found after the PGDG install

That error usually appears when Fedora’s default package names are mixed with PGDG’s versioned service names. PGDG 14 uses postgresql-14.service, not postgresql.service.

systemctl list-unit-files | grep postgresql
systemctl status postgresql-14 --no-pager
postgresql-14.service - PostgreSQL 14 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-14.service; enabled; preset: disabled)
     Active: active (running)

Remove PostgreSQL 14 from Fedora

Remove the PostgreSQL 14 packages and the PGDG repo package when you no longer need this major version, then confirm whether any versioned data files are still present.

Stop the service and remove the packages

sudo systemctl disable --now postgresql-14
sudo dnf remove postgresql14*

Remove the PGDG repo package

sudo dnf remove pgdg-fedora-repo

Check for leftover PostgreSQL data files

On the Fedora 43 validation run for PGDG 14.22, dnf remove postgresql14* already removed /var/lib/pgsql/14/. Check the parent directory before you delete anything else.

ls -la /var/lib/pgsql
drwx------. 1 postgres postgres 38 Mar 11 11:53 pgsql

If the 14/ subdirectory is already gone, no extra data cleanup is needed. An empty /var/lib/pgsql parent directory can remain after removal, and that does not mean PostgreSQL 14 is still installed.

Verify that PostgreSQL 14 is gone

rpm -qa | grep postgresql14

No output means the PostgreSQL 14 packages have been removed.

PostgreSQL 14 on Fedora FAQ

Do I need to open firewalld for local PostgreSQL use on Fedora?

No. If PostgreSQL and the application run on the same Fedora host, leave listen_addresses = 'localhost' in place and skip the firewalld change. Add sudo firewall-cmd --permanent --add-service=postgresql only when remote clients need to reach port 5432.

What PostgreSQL version does Fedora 43 install by default?

On Fedora 43, dnf install postgresql-server installs PostgreSQL 18.1 from Fedora’s updates repository. If you need PostgreSQL 14 instead, use the PGDG repo and the versioned package name postgresql14-server.

How do I install only the psql client on Fedora?

Install postgresql14 if you only need the PostgreSQL 14 client tools. On this Fedora 43 setup, psql is available through /usr/bin/psql, while pg_isready stays at /usr/pgsql-14/bin/pg_isready.

Why does postgresql.service not exist after the PGDG install?

PGDG packages use versioned Fedora systemd units. For PostgreSQL 14, the correct service name is postgresql-14.service. The unversioned postgresql.service belongs to Fedora’s default postgresql-server package instead.

Do I need a DNF module reset to install PostgreSQL 14 on Fedora 43?

No. This Fedora 43 workflow uses the PGDG repo package and the versioned package name postgresql14-server, so no DNF module reset is required. The important cleanup step is leaving only pgdg14 and pgdg-common enabled.

Conclusion

PostgreSQL 14 is running on Fedora 43 with the PGDG repo trimmed to the 14.x branch, the versioned postgresql-14.service unit enabled, and psql ready for local administration or remote clients. If this database will back a web stack, install Nginx on Fedora next, and if you still need host-level access rules, install firewalld on Fedora before you open the server to other machines.

Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: