How to Install PostgreSQL on Fedora 36 / Fedora 35


PostgreSQL is a free object-relational database management system (ORDBMS). It is available for Linux, FreeBSD, Solaris, Microsoft Windows, and macOS.

PostgreSQL was developed by the PostgreSQL Global Development Group and released under the PostgreSQL License.

Here, we will see how to install PostgreSQL on Fedora 36 / Fedora 35.

Install PostgreSQL on Fedora 36

Setup PostgreSQL repository

PostgreSQL development group offers packages through a dedicated repository for all Linux platforms, and the packages are fresher than those available in the OS repositories. So, configure the PostgreSQL repository by installing the PostgreSQL repository package.

# Fedora 36
sudo dnf install -y
# Fedora 35
sudo dnf install -y

Install PostgreSQL

When writing this post, PostgreSQL v14,13,12,11, and 10 are available for Fedora. You can install a specific version of PostgreSQL mentioning postgresql<version>-server in the dnf command.

For example, to install PostgreSQL 14, use the below command.

sudo dnf install -y postgresql14-server

Initialize PostgreSQL Server

After installing PostgreSQL, you will need to initialize it before using it for the first time. Change the below command based on the PostgreSQL version /usr/pgsql-<version>/bin/postgresql-<version>-setup initdb.

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb

PostgreSQL data is typically found /var/lib/pgsql/<version>/data/ directory.

After initializing the PostgreSQL database, start the PostgreSQL service and enable it on system startup.

sudo systemctl enable --now postgresql-14

Finally, check the status of the PostgreSQL service.

sudo systemctl status postgresql-14

Access PostgreSQL server

To create a database, log in as postgres (Linux user) and then access the database using the psql command. PSQL is an interactive terminal for working with the PostgreSQL database.

$ sudo su -l postgres
$ psql


psql (14.4)
Type "help" for help.

Set password for postgres (Database administrator) user.

postgres=# \password


That’s All. I hope you have learned how to install PostgreSQL on Fedora 36 / Fedora 35.

You might also like