You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

PostgreSQL is a powerful, widely used relational database management system designed to be resilient and fault tolerant. The PostgreSQL database is based on POSTGRES 4.2. As of this article update the latest release of PostgreSQL database is 13. You can check the new features, improvements and bug fixes on PostgreSQL 13 in the official release notes page.

Some changes noted in PostgreSQL 13 release.

  • Improvements from de-duplication of B-tree index entries – Space savings and performance gains from
  • Queries that use aggregates or partitioned tables gets improved performance.
  • Incremental sorting
  • Better query planning when using extended statistics
  • Parallelized vacuuming of indexes

The PostgreSQL team provides pre-built binary packages for installation YUM based and Debian based Linux systems. We will add the required repositories before installing PostgreSQL 13 on Fedora.

Install PostgreSQL 13 on Fedora 34

For Fedora 34, PostgreSQL 13 is available in system provided module. Enable the module with the commands below:

sudo dnf module reset postgresql
sudo dnf module enable postgresql:13

Then install PostgreSQL 13 on Fedora 34:

$ sudo dnf install postgresql-server postgresql
Last metadata expiration check: 0:11:17 ago on Sat 10 Apr 2021 10:18:23 PM UTC.
Dependencies resolved.
 Package                               Architecture               Version                                               Repository                           Size
 postgresql                            x86_64                     13.2-2.module_f34+11462+bc537a32                      fedora-modular                      1.7 M
 postgresql-server                     x86_64                     13.2-2.module_f34+11462+bc537a32                      fedora-modular                      5.8 M
Installing dependencies:
 libicu                                x86_64                     67.1-6.fc34                                           updates-testing                     9.7 M

Transaction Summary
Install  3 Packages

Total download size: 17 M
Installed size: 62 M
Is this ok [y/N]: y

Install PostgreSQL 13 on Fedora 33/32/31/30

For the older versions of Fedora use the following steps.

Step 1: Update System

Always work on an up-to-date Fedora system.

sudo dnf update -y
sudo dnf install -y vim bash-completion wget

Perform a reboot after successful upgrade:

sudo reboot

Step 2: Add the PostgreSQL Yum Repository

Add PostgreSQL Yum Repository to your Fedora system by running the below command:

Fedora 33:

sudo dnf install

Fedora 32:

sudo dnf install

Fedora 31:

sudo dnf install

Fedora 30:

sudo dnf install

Fedora 29:

sudo dnf install

When prompted to confirm installation, press the key.

Dependencies resolved.
 Package                                     Architecture                      Version                              Repository                               Size
 pgdg-fedora-repo                            noarch                            42.0-13                              @commandline                             10 k

Transaction Summary
Install  1 Package

Total size: 10 k
Installed size: 11 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                          1/1
  Installing       : pgdg-fedora-repo-42.0-13.noarch                                                                                                          1/1
  Verifying        : pgdg-fedora-repo-42.0-13.noarch                                                                                                          1/1



Step 3: Install PostgreSQL 13 on Fedora 33/32/31/30

After the PostgreSQL Repository is added to Fedora system, install PostgreSQL 13 Server / Client packages:

sudo dnf install postgresql13-server postgresql13

Agree to the installation prompts that you receive.

Dependencies resolved.
 Package                                       Architecture                     Version                                    Repository                        Size
 postgresql13-server                           x86_64                           13.1-3PGDG.f33                             pgdg13                           5.8 M
Installing dependencies:
 libicu                                        x86_64                           67.1-4.fc33                                fedora                           9.7 M
 postgresql13                                  x86_64                           13.1-3PGDG.f33                             pgdg13                           1.4 M
 postgresql13-libs                             x86_64                           13.1-3PGDG.f33                             pgdg13                           789 k

Transaction Summary
Install  4 Packages

Total download size: 18 M
Installed size: 65 M
Is this ok [y/N]: y

This includes GPG key importation:

Total                                                                                                                              13 MB/s |  18 MB     00:01
warning: /var/cache/dnf/pgdg13-5b69a3a370fb59a8/packages/postgresql13-13.1-3PGDG.f33.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
PostgreSQL 13 for Fedora 33 - x86_64                                                                                              1.6 MB/s | 1.7 kB     00:00
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <[email protected]>"
 Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y

Step 4: Initialize PostgreSQL database

Run the commands below to initialize the database:

$ sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
Initializing database ... OK

Start and enable postgresql database service:

$ sudo systemctl enable --now postgresql-13
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/postgresql-13.service.

Confirm service status.

$ systemctl status postgresql-13
● postgresql-13.service - PostgreSQL 13 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2021-02-08 21:25:49 UTC; 21s ago
    Process: 1076 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 1081 (postmaster)
      Tasks: 8 (limit: 1125)
     Memory: 16.2M
        CPU: 59ms
     CGroup: /system.slice/postgresql-13.service
             ├─1081 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
             ├─1082 postgres: logger
             ├─1084 postgres: checkpointer
             ├─1085 postgres: background writer
             ├─1086 postgres: walwriter
             ├─1087 postgres: autovacuum launcher
             ├─1088 postgres: stats collector
             └─1089 postgres: logical replication launcher

Feb 08 21:25:49 fed33 systemd[1]: Starting PostgreSQL 13 database server...
Feb 08 21:25:49 fed33 postmaster[1081]: 2021-02-08 21:25:49.811 UTC [1081] LOG:  redirecting log output to logging collector process
Feb 08 21:25:49 fed33 postmaster[1081]: 2021-02-08 21:25:49.811 UTC [1081] HINT:  Future log output will appear in directory "log".
Feb 08 21:25:49 fed33 systemd[1]: Started PostgreSQL 13 database server.

Step 5: Enable remote Access to PostgreSQL (Optional)

For remote clients connectivity you may have to permit access in the firewall.

sudo firewall-cmd --add-service=postgresql --permanent
sudo firewall-cmd --reload

Then edit the file /var/lib/pgsql/13/data/postgresql.conf and set Listen address to your server IP address or “*” for all interfaces, or specific IP address/subnet.

$ sudo vi /var/lib/pgsql/13/data/postgresql.conf 
listen_addresses = '*'

Also set PostgreSQL to accept remote connections from allowed hosts.

$ sudo vim /var/lib/pgsql/11/data/pg_hba.conf

# Accept from anywhere
host all all md5

# Accept from trusted subnet
host all all md5

Restart PostgreSQL 13 service after making the change.

sudo systemctl restart postgresql-13

Step 6: Set PostgreSQL admin user’s password

Set PostgreSQL admin user password.

$ sudo su - postgres
$ psql -c "alter user postgres with password 'StrongDBPassword'"

Where StrongDBPassword is the new password for postgres user.

Step 7: Install pgAdmin 4 Web Management

If you need an easy way for managing PostgreSQL database server (Similar to phpMyAdmin for MySQL), consider installing pgAdmin4.

Install pgAdmin 4 on Fedora

Enjoy running PostgreSQL 13 on Fedora 33/32/31/30 Linux system.

Other guides on Fedora;

Configuring Open vSwitch on Fedora

Install Zoom Client on Fedora

Install Brave Web Browser on Fedora

As an appreciation for the content we put out,
we would be thrilled if you support us!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here