(Last Updated On: November 13, 2018)

This guide is for installation of PostgreSQL 11 on Fedora 29 and Fedora 28. PostgreSQL is a powerful open source relational database system with a strong reputation for reliability, feature robustness, and performance.

Key PostgreSQL 11 Enhancements:

  • Improvements to partitioning functionality
  • SQL stored procedures that support embedded transactions
  • Improvements to parallelism
  • Window functions now support all framing options shown in the SQL:2011 standard
  • Optional Just-in-Time (JIT) compilation for some SQL code, speeding evaluation of expressions
  • Performance improvements, including the ability to avoid a table rewrite for ALTER TABLE … ADD COLUMN with a non-null column default
  • Covering indexes can now be created, using the INCLUDE clause of CREATE INDEX

Read more about PostgreSQL 11 new features on the Release page. Use the steps below to install PostgreSQL 11 on your Fedora 29 / Fedora 28 system. For those new to Fedora, we have an installation guide:

How to install Fedora 29 on Physical Server / VirtualBox & Vagrant

The default version available on Fedora Repository and Modular Repository is 10.x. Check our guide to understand How to use Fedora Modular Repository

For CentOS 7, use: How to install PostgreSQL 11 on CentOS 7

Step 1: Update System

Ensure system packages are up to date:

sudo dnf update -y

Since you may have Kernel updates, it is recommended to reboot your system after an upgrade

sudo reboot

Step 2: Add the PostgreSQL Yum Repository

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

For Fedora 29 use:

sudo dnf install https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-29-x86_64/pgdg-fedora11-11-2.noarch.rpm

For Fedora 28 use:

sudo dnf install https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-28-x86_64/pgdg-fedora11-11-2.noarch.rpm

When prompted to confirm installation, press the key

Dependencies resolved.
 Package                                 Arch                             Version                        Repository                              Size
 pgdg-fedora11                           noarch                           11-2                           @commandline                           9.2 k

Transaction Summary
Install  1 Package

Total size: 9.2 k
Installed size: 3.2 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 
Installed: pgdg-fedora11-11-2.noarch
  Installing       : pgdg-fedora11-11-2.noarch                                                                                                    1/1 
Installed: pgdg-fedora11-11-2.noarch
  Verifying        : pgdg-fedora11-11-2.noarch                                                                                                    1/1 


Step 3: Install PostgreSQL Server and Client packages

After adding PostgreSQL Yum Repository, install PostgreSQL Server / Client packages:

$ sudo dnf install postgresql11-server postgresql11
PostgreSQL 11 29 - x86_64                                                                                              52 kB/s | 191 kB     00:03    
Last metadata expiration check: 0:00:01 ago on Sat 03 Nov 2018 06:54:14 PM UTC.
Dependencies resolved.
 Package                                    Arch                          Version                                 Repository                     Size
 postgresql11                               x86_64                        11.0-1PGDG.f29                          pgdg11                        1.7 M
 postgresql11-server                        x86_64                        11.0-1PGDG.f29                          pgdg11                        4.9 M
Installing dependencies:
 postgresql11-libs                          x86_64                        11.0-1PGDG.f29                          pgdg11                        371 k

Transaction Summary
Install  3 Packages

Total download size: 6.9 M
Installed size: 29 M
Is this ok [y/N]: y

Confirm the installed package:

$ rpm -qi postgresql11-server
Name        : postgresql11-server
Version     : 11.0
Release     : 1PGDG.f29
Architecture: x86_64
Install Date: Sat 03 Nov 2018 06:55:26 PM UTC
Group       : Applications/Databases
Size        : 20047636
License     : PostgreSQL
Signature   : DSA/SHA1, Tue 30 Oct 2018 05:50:03 PM UTC, Key ID 1f16d2e1442df0f8
Source RPM  : postgresql11-11.0-1PGDG.f29.src.rpm
Build Date  : Tue 30 Oct 2018 05:49:40 PM UTC
Build Host  : koji-fedora29-x86-64
Relocations : (not relocatable)
Vendor      : PostgreSQL Global Development Group
URL         : https://www.postgresql.org/
Summary     : The programs needed to create and run a PostgreSQL server
Description :
PostgreSQL is an advanced Object-Relational database management system (DBMS).
The postgresql11-server package contains the programs needed to create
and run a PostgreSQL server, which will in turn allow you to create
and maintain PostgreSQL databases.

Step 4: Initialize the database and enable automatic start

Now that the database packages have been installed, Initialize the database by running the following command

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

Then start and enable the service to start on boot

sudo systemctl start postgresql-11
sudo systemctl enable postgresql-11

PostgreSQL 11 config file is/var/lib/pgsql/11/data/postgresql.conf

If you have a running Firewall service and remote clients should connect to your database server, allow PostgreSQL service.

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

Step 5: Enable remote Acess to PostgreSQL

Edit the file /var/lib/pgsql/11/data/postgresql.conf and set Listen address to your server IP address or “*” for all interfaces.

listen_addresses = '*'

Also set PostgreSQL to accept remote connections

$ 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 service

sudo systemctl restart postgresql-11

Step 6: Set PostgreSQL admin user’s password

Set PostgreSQL admin user

$ sudo su - postgres 
[[email protected] ~]$ psql -c "alter user postgres with password 'StrongPassword'" 

Create a test user and database

[[email protected] ~]$ createuser test_user
[[email protected] ~]$ createdb test_db -O test_user
[[email protected] ~]$ grant all privileges on database test_db to test_user;

Login as a test_user  user try to create a table on the Database.

$ psql -U test_user -h localhost -d test_db

Step 7: Install pgAdmin 4 on CentOS 7 / Fedora 29 / Fedora 28

Install pgAdmin 4 on CentOS 7 / Fedora 29 / Fedora 28 to administer your PostgreSQL from a web interface.

Also read:

Using SQLPad – Web-based SQL editor for MySQL / PostgreSQL / SQL Server

How to Install TimescaleDB on Ubuntu 18.04 LTS

How to Install Apache Tomcat 9 on CentOS 7 / Fedora 29 / Fedora 28

How to Install Django on Fedora 29 / Fedora 28

How to install LAMP Stack on Fedora 29 / Fedora 28

Install and Configure phpMyAdmin on Fedora 29 / Fedora 28

How to install Docker on Fedora 29 / Fedora 28

How to install MySQL 8.0 on Fedora 29 / Fedora 28