How to Install PostgreSQL 18 on Fedora 44
Install PostgreSQL 18 on Fedora 44 with DNF, initialize the cluster, enable the service, and create a user and database.
On this page
Fedora 44 provides PostgreSQL 18 in its native DNF repositories. The Fedora package listing currently shows PostgreSQL 18.6; the patch version may advance through Fedora updates. This guide uses Fedora’s own packages, not the PostgreSQL Global Development Group repository. See the Fedora PostgreSQL server package and the PostgreSQL versioning policy for current version and support information.
Preconditions
Before you begin the installation process, ensure you have met the following prerequisites:
- Fedora 44 with root or sudo access.
- A stable internet connection to download PostgreSQL packages.
- Familiarity with basic Linux command-line operations.
This guide initializes a new database cluster. If you already have PostgreSQL data, make a verified backup and follow our PostgreSQL 17 to 18 upgrade guide instead of initializing over the existing cluster. See the official pg_upgrade documentation for package-specific paths.
With these prerequisites in place, let’s proceed with the installation.
Installing PostgreSQL 18 on Fedora 44
Step 1: Update the System
Start by ensuring your Fedora system is up to date. Open a terminal and run the following commands:
sudo dnf update
This command will update the package list and upgrade existing packages on your system.
Step 2: Install PostgreSQL
To install PostgreSQL on Fedora, use the following command:
sudo dnf install postgresql-server postgresql-contrib
This installs the Fedora 44 PostgreSQL 18 server and the contrib extensions package.
Confirm the installed client version:
psql --version
Step 3: Initialize the PostgreSQL Database
After the installation, initialize the PostgreSQL database cluster by running:
sudo postgresql-setup --initdb
This command will create the necessary directory structure and configuration files for PostgreSQL.
Step 4: Start and Enable PostgreSQL
Start PostgreSQL now and enable it at boot:
sudo systemctl enable --now postgresql
Creating a PostgreSQL User and Database
Create an application role with a password, then create a database owned by that role. Replace your_user and your_database with your chosen names; the first command prompts for the role password:
sudo -u postgres createuser --pwprompt your_user
sudo -u postgres createdb --owner=your_user your_database
To illustrate PostgreSQL’s capabilities, let’s create a simple table in the newly created database. Access the PostgreSQL command-line tool, psql, using the following command:
psql --host=localhost --username=your_user --dbname=your_database
Once in the psql prompt, execute the following SQL commands to create a basic table:
CREATE TABLE example (
id serial PRIMARY KEY,
name VARCHAR (100),
age INT
);
Managing the PostgreSQL Service
To manage the PostgreSQL service on Fedora, you can use the following commands:
-
Start PostgreSQL service:
sudo systemctl start postgresql -
Stop PostgreSQL service:
sudo systemctl stop postgresql -
Restart PostgreSQL service:
sudo systemctl restart postgresql -
Check PostgreSQL service status:
sudo systemctl status postgresql
Conclusion
PostgreSQL 18 is now initialized and running on Fedora 44. Check the Fedora package listing when you update this guide because Fedora may ship a newer PostgreSQL 18 patch release.
If you want to learn more about PostgreSQL, please use our PostgreSQL tutorials and PostgreSQL Reference.