FedoraRHEL Based

How To Install PostgreSQL on Fedora 38

Install PostgreSQL Fedora 38

In this tutorial, we will show you how to install PostgreSQL on Fedora 38. Are you looking for a powerful open-source relational database management system that can handle large amounts of data with ease? Look no further than PostgreSQL! This advanced RDBMS is known for its reliability, scalability, and feature-rich capabilities, making it a popular choice for a wide range of applications, from web development to data analytics to machine learning. We’ll cover everything you need to know to get started with using PostgreSQL, including installing the PostgreSQL server and additional utilities, creating a new user and database, and connecting to the PostgreSQL command-line interface.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the PostgreSQL database on a Fedora 38.

Prerequisites

  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for PostgreSQL.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install PostgreSQL on Fedora 38

Step 1. Before we can install PostgreSQL on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install PostgreSQL without any issues:

sudo dnf upgrade --refresh

Step 2. Installing PostgreSQL on Fedora 38.

By default, PostgreSQL is not available on the Fedora 38 base repository. Now run the following command below to add the PostgreSQL repository to the system:

sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-38-x86_64/pgdg-fedora-repo-latest.noarch.rpm

Now proceed with the installation of PostgreSQL by running the following command:

sudo dnf install postgresql11-server postgresql15

Once the installation is complete, you can start the PostgreSQL service by running the following command:

sudo systemctl enable --now postgresql-15

Step 3. Setting up PostgreSQL on Fedora 38.

We will need to perform some initial configuration to set it up for use. The first step is to create a new PostgreSQL user and database. You can do this by running the following command:

sudo /usr/pgsql-11/bin/postgresql-15-setup initdb

Now you need to create a user and database for the user. This needs to be run from a postgres user account on your system.

sudo -u postgres psql

From here you can create a Postgres user and database. Here, we will assume your computer’s user account is called meilana. Note: you can also run this from the shell as well with createuser meilana and createdb --owner=meilana maria.

postgres=# CREATE USER lenny WITH PASSWORD 'j0g456';
postgres=# CREATE DATABASE my_project OWNER meilana;

It might be a good idea to add a password for the postgres user while you’re at it:

postgres=# \password postgres

Step 4. Configure Firewall.

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

sudo firewall-cmd --permanent --add-port=5432/tcp
sudo firewall-cmd --add-port=5432/tcp
sudo firewall-cmd --reload

Congratulations! You have successfully installed PostgreSQL. Thanks for using this tutorial for installing the PostgreSQL database on your Fedora 38 system. For additional help or useful information, we recommend you check the official PostgreSQL website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button