How to install PostgreSQL 11 on Fedora 29?

2
1964

Fedora is a great Linux distribution and I think we’ve made that clear. Therefore, it is the one chosen to develop applications and use the database. This article is about how to install PostgreSQL 11 on Fedora 29.

PostgreSQL is a database manager relations program quite popular in the world. It is known for its robustness, its speed in processing large databases and for its compatibility with most Linux distributions.

On the other hand, a great advantage of PostgreSQL is that it is open source, so you can modify its source code and implement specific improvements for your project. In addition, the latest stable version incorporates many new features concerning security and performance.

So, today I will install PostgreSQL 11 on Fedora 29.

0. Prerequisites

It is not complicated to install PostgreSQL 11 on Fedora 29, however, there are some things to keep in mind for everything to come up smoothly.

First, you need to execute commands using sudo. There shouldn’t be any problems, but be careful what you type using sudo.

Then, while it is not necessary to be an expert in Linux commands, it helps a little bit that you have a basic knowledge about the use of the Terminal.

Finally, you must install Fedora 29. Obvious.

1. Upgrade the system

In this first step, you need to update the system. Fedora 29 is a distribution that is constantly being updated, and it is good to have the latest versions of some key packages in the system. This is why I recommend updating frequently.

Open a Terminal and run:

:~$ sudo dnf update
1.- Upgrade the system
1.- Upgrade the system

As you can see, many packages are being updated.

2. Add the PostgreSQL repository

To ensure that you are using the latest version of PostgreSQL in Fedora 29, it is necessary to add the external repository of PostgreSQL. The process is simple, but it keeps you up to date.

:~$ sudo dnf install https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-29-x86_64/pgdg-fedora11-11-2.noarch.rpm
2.- Adding the PostgreSQL repository
2.- Adding the PostgreSQL repository

With this, we will be able to start the installation.

3. Install PostgreSQL 11 on Fedora 29

Now all that remains is to install the necessary package from the terminal.

:~$ sudo dnf install postgresql11
3.- Install PostgreSQL 11 on Fedora
3.- Install PostgreSQL 11 on Fedora

You can also install the server package if you wish.

:~$ sudo dnf install postgresql11-server
4.- Installing postgresql server
4.- Installing PostgreSQL server

4. Preparing the first use

Before using PostgreSQL for the first time, it is necessary to perform a few steps first. The first step is to initialize the database.

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

Then, enable and start the service so you can use it without problems.

:~$ sudo systemctl enable postgresql-11
:~$ sudo systemctl start postgresql-11
5.- Preparing the first use of postgreSQL
5.- Preparing the first use of PostgreSQL

Now, you can start to use PostgreSQL.

5. Testing the installation

The best way to know if everything worked out is to use PostgreSQL. Nothing more than that. So, open a terminal and run.

:~$ sudo su - postgres

Now that you are logged in as a postgres user, you can use psql, which is a console to execute commands in PostgreSQL.

:~$ psql

Now, you can, for example, list all existing databases.

postgres=# \l
6.- Using PostgreSQL
6.- Using PostgreSQL

Or you can show all users.

postgres=# \du
7.- Showing all users of PostgreSQL
7.- Showing all users of PostgreSQL

And that’s it.

Conclusion

PostgreSQL is a great application and installing it in Fedora 29 is not complex, but it is very useful if you use both programs.

Please share this article with your friends.

 

Read More

If You Appreciate What We Do Here On OsRadar, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Telegram
  2. Subscribe to our email updates: Sign Up Now
  3. Become a Supporter - Make a contribution via PayPal

We are thankful for your support.

2 COMMENTS

  1. Hi
    I’m trying to install psotgres but a i got this error:
    sudo: /usr/pgsql-11/bin/postgresql-11-setup: command not found

LEAVE A REPLY

Please enter your comment!
Please enter your name here