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.
Follow the steps in this section to install and configure PostgreSQL 13 on Fedora.
Update System
Always work on an up-to-date Fedora system (optional):
sudo dnf update -y
You may need to perform a reboot after successful upgrade:
sudo reboot
Install basic utilities:
sudo dnf install -y vim bash-completion wget
Reset default AppStream modules for PostgreSQL.
sudo dnf module reset postgresql -y
Add PostgreSQL Yum Repository
Add PostgreSQL Yum Repository to your Fedora system by running the below command:
Fedora 41:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-41-x86_64/pgdg-fedora-repo-latest.noarch.rpm
Fedora 40:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-40-x86_64/pgdg-fedora-repo-latest.noarch.rpm
Fedora 39:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-39-x86_64/pgdg-fedora-repo-latest.noarch.rpm
Fedora 38:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-38-x86_64/pgdg-fedora-repo-latest.noarch.rpm
When prompted to confirm installation, press the y key.
....
Transaction Summary
======================================================================================================================================================================================================
Install 1 Package
Total size: 10 k
Installed size: 12 k
Is this ok [y/N]: y
...
Complete!
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.
....
Transaction Summary
======================================================================================================================================================================================================
Install 3 Packages
Total download size: 7.9 M
Installed size: 32 M
Is this ok [y/N]: y
This includes GPG key importation:
....
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
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/multi-user.target.wants/postgresql-13.service → /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 Sat 2024-12-14 08:22:38 UTC; 5s ago
Docs: https://www.postgresql.org/docs/13/static/
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
Dec 14 08:22:38 fed-cloudspinx-com.novalocal systemd[1]: Starting postgresql-13.service - PostgreSQL 13 database ser>
Dec 14 08:22:38 fed-cloudspinx-com.novalocal postmaster[2403]: 2024-12-14 08:22:38.665 UTC [2403] LOG: redirecting >
Dec 14 08:22:38 fed-cloudspinx-com.novalocal postmaster[2403]: 2024-12-14 08:22:38.665 UTC [2403] HINT: Future log >
Dec 14 08:22:38 fed-cloudspinx-com.novalocal systemd[1]: Started postgresql-13.service - PostgreSQL 13 database serv>
Enable PostgreSQL remote access (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 vi /var/lib/pgsql/13/data/pg_hba.conf
# Accept from anywhere
host all all 0.0.0.0/0 md5
# Accept from trusted subnet
host all all 10.10.10.0/24 md5
Restart PostgreSQL 13 service after making the change.
sudo systemctl restart postgresql-13
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.
Install pgAdmin 4 Web Management
If you need an easy way for managing PostgreSQL database server (Similar to phpMyAdmin for MySQL), consider installing pgAdmin4.
Enjoy running PostgreSQL 13 on Fedora Linux system.
Recommended books to learn PostgreSQL database administration;
Other guides on Fedora;
- Configuring Open vSwitch on Fedora
- Install Zoom Client on Fedora
- Install Brave Web Browser on Fedora