20.5 C
Texas
angeloma
Senior Writer and partner

How to install PostgreSQL on Fedora 34?

We are celebrating the launch of Fedora 34. So we are aware that many developers use it to do their daily work. So they probably need to install some database manager. We recently explained how to install Lamp in Fedora and there you could learn how to install MariaDB. However, it is true that many developers prefer to use PostgreSQL because of its performance. So, in this post, I will teach you how to install PostgreSQL on Fedora 34.

It is not necessary talk much about PostgreSQL. However, very briefly I will explain you what it is. It is a SQL database manager, open source and well known by application developers. Mainly because it has a considerably superior performance to others like MariaDB or MySQL. So we will have enterprise power in a community program. Sounds good, no?

PostgreSQL has an updated repository for Fedora. However, due to the recent release of Fedora 34, version 11 is available. So in this sense we will have no problems.

Install PostgreSQL on Fedora 34

While PostgreSQL is an application, it has many additional libraries to extend its functionality. Or, to make it work with other programming languages such as Java, Python, C++ or PHP. In addition, we can have access to other libraries of the program for development.

- Advertisement -

So, first of all, I am going to use DNF the Fedora package manager to look for all PostgreSQL related packages.

:~$ sudo dnf search postgresql

Using DNF for search PostgreSQL
Using DNF for search PostgreSQL

As you can see, there are many packages related to PostgreSQL. But as I said before, they refer to libraries needed to extend the functionality.

Now, let’s install it.

:~$ sudo dnf install postgresql-server

2.- Install PostgreSQL on Fedora 34
2.- Install PostgreSQL on Fedora 34

Then you have to prepare PostgreSQL for the first use. So, we have to init the database and then, start the service. After that, test it.

:~$ sudo /usr/bin/postgresql-setup --initdb

3.- Initialize the sample database
3.- Initialize the sample database

Next, enable and start the service.

:~$ sudo systemctl enable postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
:~$ sudo systemctl start postgresql

Now, test the installation.

:~$ sudo su - postgres

And access to the PostgreSQL console.

:~$ psql

Then, list all databases.

:~$ \l

4.- PostgreSQL is correctly installed on Fedora 34
4.- PostgreSQL is correctly installed on Fedora 34

So, PostgreSQL is correctly installed.

Conclusion

PostgreSQL is a great database manager and today you have learned how to install it in Fedora 34. So as you can see it’s quite easy, just share this post with your friends.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article