How to install PostgreSQL 11 on CentOS 7?

Windows Articles

How to install Brackets in Windows 10 plus extensions

Hello! Brackets is an open-source code editor designed by Adobe for web developers. Additionally, it has a very simple and modern interface...

How to install Docker on OpenSUSE 15.2 / 15.1?

Docker is a fairly popular technology in today’s sysadmin. It is logical to think because it means a complete change in the...

How to analyze the network with IP Tools for Android

Hi! If you want to analyze and adjust the network almost professionally, then this post is for you. Indeed, IP Tools is...

How to install GNU Fortran on Ubuntu 20.04 / 18.04?

Not everything old is bad. This is how it is. Well, while it is true that there are many programming languages today, there are...

How to install Unity Desktop on Ubuntu 20.04?

Unity Desktop was for a long time the default desktop environment in Ubuntu. Thanks to this, Ubuntu gained a great personality and...
angeloma
angeloma
Senior Writer and partner

PostgreSQL is one of the best relational database managers in the world. Its main virtue is to be a reliable rock. Today, I will show you how to install PostgreSQL 11 on CentOS 7.

In this site we have talked before about PostgreSQL, it is difficult not to do it when you have in front of a database manager as advanced and reliable as this one. Recently, version 11 of this fantastic software was released.

In this new version, it highlights the speed improvements in the processing of very large databases. Something sysadmin will surely appreciate.

On the other hand, PostgreSQL 11 adds the ability to partition data by a hash key. This translates into improved data robustness and security.

Install PostgreSQL 11 on CentOS 7

PostgreSQL 11 is a novelty. It is the first big release since October 2017. Many sysadmins will look for a way to update or install it from 0. The latter is the goal of this article.

1. Upgrade the system

First, you need to update the system. This in order to get the latest security patches available for the system. With this, you gain stability and robustness.

:~$ su
:~# yum update

1.- Upgrading centOS 7
1.- Upgrading centOS 7

Now you can continue the installation.

2. Adding the PostgreSQL repository

Actually, PostgreSQL is available for many operating systems such as Debian, Ubuntu, or CentOS 7, but the version that comes in the official repositories of each distribution is usually obsolete and outdated.

In short, you need to resort to an external repository to perform the installation. Fortunately, PostgreSQL has one and it is very easy.

First, run this command as root user:

:~# yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm

2.- Adding the repository
2.- Adding the repository

After that, the repository has been added.

You can also verify that.

:~# yum repolist

3.- The repositories added
3.- The repositories added

As you can see, the repository is added

3. Install PostgreSQL 11

Thanks to the repository, now, you can install the new version of PostgreSQL in an easy way. Just run this command:

:~# yum install postgresql11 postgresql11-server

4.- Install PostgreSQL 11
4.- Install PostgreSQL 11

After that, initialize the database:

:~# /usr/pgsql-11/bin/postgresql-11-setup initdb

Next, start and enable PostgreSQL service:

:~# systemctl enable postgresql-11
:~# systemctl start postgresql-11

5.- Starting the Postgresql 11 service
5.- Starting the Postgresql 11 service

This process must be done because of the security policies of CentOS. CentOS 7 installs the package but does not start the PostgreSQL service automatically.

Finally, check the service status.

:~# systemctl status postgresql-11

6.- Checking the status of the service
6.- Checking the status of the service

The installation has been successful

4. Using PostgreSQL 11

Before using PostgreSQL You must install sudo. You also have to add your current user to the sudoers file:

:~# yum install sudo

Then, open the file /etc/sudoers and edit it. See the image for the guide. In “angelo” write your user.

:~# nano /etc/sudoers

7.- Editing the sudoers file
7.- Editing the sudoers file

Then, close session and access as postgres user.

:~# exit
:~$ sudo -i -u postgres
:~$ psql

8.- PostgreSQL log in
8.- PostgreSQL log in

Now, you can write some commands. For example, list all database:

postgres=# \l

9.- List all databases
9.- List all databases

Conclusion

PostgreSQL is a great database manager. Each time it improves more and more and aims to be the leading open source option in this area. This new version adds performance improvements and installing it in CentOS 7 is not a big complication compared to its benefits.

Please share this article on your social networks.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Brackets in Windows 10 plus extensions

Hello! Brackets is an open-source code editor designed by Adobe for web developers. Additionally, it has a very simple and modern interface...

How to install Docker on OpenSUSE 15.2 / 15.1?

Docker is a fairly popular technology in today’s sysadmin. It is logical to think because it means a complete change in the...

How to analyze the network with IP Tools for Android

Hi! If you want to analyze and adjust the network almost professionally, then this post is for you. Indeed, IP Tools is...

How to install GNU Fortran on Ubuntu 20.04 / 18.04?

Not everything old is bad. This is how it is. Well, while it is true that there are many programming languages today, there are...

How to install Unity Desktop on Ubuntu 20.04?

Unity Desktop was for a long time the default desktop environment in Ubuntu. Thanks to this, Ubuntu gained a great personality and...