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
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
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
You can also install the server package if you wish.
:~$ sudo dnf install postgresql11-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
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
Or you can show all users.
postgres=# \du
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.
Hi
I’m trying to install psotgres but a i got this error:
sudo: /usr/pgsql-11/bin/postgresql-11-setup: command not found
It looks like you need to install sudo. Or, you can run the command being a root user.
I have same issue. It’s not that sudo is missing… it’s the “postgresql-11-setup” files is missing.
anyone got a fix for it?