Fedora Linux is a safe haven for most open-source Linux applications and projects. Most OS users prefer to use this RHEL-based Linux distribution as an ideal candidate for learning and mastering new skillsets through its rich catalogs of educational software.
One such educational software is PostgreSQL, which is an open-source relational database management system (RDBMS) used by analytics, geospatial, mobile, web, and other enterprising applications as a primary data warehouse or data store.
PostgreSQL is favored by such applications and projects footprints because of its luring attributes. They include its diversified extension functions, support for flexible full-text search, diverse indexing techniques, and its growing community support.
Among this attribute list, the most important element is community support. It helps new and intermediate users understand the interpretation of PostgreSQL software functions and their implementation.
Installing PostgreSQL in Fedora Linux
To successfully install and get PostgreSQL database software up and running on your Fedora system, you first need to make sure you meet certain user requirements.
Since this article is dedicated to users under Fedora 35 (or later) systems, you should be a root user or have Sudoer privileges on the system. Afterward, PostgreSQL 14 installation and configuration steps to follow are straightforward.
First, update your Fedora system to apply the needed security patches that will boost its performance.
$ sudo dnf update
The Fedora base repository, by default, already has PostgreSQL. We just need to enable the module containing the database software before we can resume its installation.
$ sudo dnf module enable postgresql:14
With the PostgreSQL 14 module now enabled, we can resume its installation by executing the following command on your terminal.
$ sudo dnf install -y postgresql-server postgresql-contrib
PostgreSQL 14 installation on Fedora should take a minute or so to successfully complete.
Initialize and Starting PostgreSQL in Fedora
The immediate step to execute after installing a fresh copy of PostgreSQL 14 on your Fedora system is to initialize its database.
$ sudo postgresql-setup initdb
Starting your installed PostgreSQL software app will only keep it running until the Fedora system restarts or shuts down. Enabling your installed PostgreSQL software app will keep it running even after you restart or shut down your machine.
However, before enabling it, we need to start it first by running the following commands sequentially.
$ sudo systemctl start postgresql $ sudo systemctl enable postgresql
From here, we can check on the status of our PostgreSQL 14 installation with the following command.
$ sudo systemctl status postgresql
You can also verify your PostgreSQL 14 installation with the following command.
$ sudo -u postgres psql -c "SELECT version();"
Firewall configuration is necessary for remote clients to have access to your database. To allow this firewall access, execute the following command.
$ sudo firewall-cmd --add-service=postgresql --permanent $ sudo firewall-cmd --reload
Testing Access to PostgreSQL in Fedora
You first need to switch to PostgreSQL’s default postgres user with the following command:
$ sudo -i -u postgres
Afterward, use the psql utility to access the main database console.
From here, you can perform the needed database actions like creating a database user with his/her associated password, and also new databases. To return to the normal terminal, run:
[ You might also like: How to Log into a Postgresql Database from the Command-line ]
With this PostgreSQL 14 installation tutorial on your Fedora system, you should be able to comfortably pursue your database-driven projects to new heights.