How to Install PostgreSQL 11 on CentOS 7.6

Installation of PostgreSQL 11 on Centos 7.6

PostgreSQL 11 Released. PostgreSQL is an open source object-relational,highly scalable,SQL-compliant database management system.PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This tutorial covers the method to install PostgreSQL 11 on CentOS 7.6.

Installation

Check the centos version by using the following command

[root@linuxhelp ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64

Need to configure the PostgreSQL repository in your system by using the following command

 [root@linuxhelp ~]# yum install https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
BDB2053 Freeing read locks for locker 0x3d0: 17545/140054075111232
BDB2053 Freeing read locks for locker 0x3d5: 17545/140054075111232
Loaded plugins: fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm                                           | 5.6 kB  00:00:00     
Examining /var/tmp/yum-root-7eiWGV/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch
Marking /var/tmp/yum-root-7eiWGV/pgdg-redhat-repo-latest.noarch.rpm to be installed
.
.
.
  Installing : pgdg-redhat-repo-42.0-4.noarch                                                   1/1 
  Verifying  : pgdg-redhat-repo-42.0-4.noarch                                                   1/1 

Installed:
  pgdg-redhat-repo.noarch 0:42.0-4                                                                  

Complete!

Install postgresql 11 on by using the following command

[root@linuxhelp ~]# yum install postgresql11-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirrors.estointernet.in
* extras: centos.mirrors.estointernet.in
* updates: centos.mirrors.estointernet.in
pgdg10                                                                       | 3.6 kB  00:00:00     
pgdg11                                                                       | 3.6 kB  00:00:00     
pgdg94                                                                       | 3.6 kB  00:00:00     
pgdg95                                                                       | 3.6 kB  00:00:00     
pgdg96                                                                       | 3.6 kB  00:00:00     
(1/10): pgdg11/7/x86_64/group_gz                                             |  245 B  00:00:01     
(2/10): pgdg94/7/x86_64/group_gz                                             |  247 B  00:00:01     
(3/10): pgdg95/7/x86_64/group_gz                                             |  249 B  00:00:00     
(4/10): pgdg10/7/x86_64/group_gz                                             |  245 B  00:00:01     
.
.
.
Installed:
 postgresql11-server.x86_64 0:11.3-1PGDG.rhel7                                                     

Dependency Installed:
 postgresql11.x86_64 0:11.3-1PGDG.rhel7         postgresql11-libs.x86_64 0:11.3-1PGDG.rhel7        

Complete!

Need to initialize the PostgreSQL instance

[root@linuxhelp ~]# /usr/pgsql-11/bin/postgresql-11-setup initdb
Initializing database ... OK

Start the postgresql service by using the following command

[root@linuxhelp ~]# systemctl start postgresql-11.service

Enable the postgresql service by using the following command

[root@linuxhelp ~]# systemctl enable postgresql-11.service
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-11.service to /usr/lib/systemd/system/postgresql-11.service.

Enter into the postgresql by using the following command

 [root@linuxhelp ~]# sudo -u postgres psql
could not change directory to "/root": Permission denied
psql (11.3)
Type "help" for help.
Create a password for user 
postgres=# \password postgres
Enter new password: 
Enter it again: 


postgres=# \q

With this the method of installation of PostgreSQL 11 on Centos 7.6

FAQ
Q
What happened to the database dump feature in phpPgAdmin on PostgreSQL?
A
You need to configure phpPgAdmin (in the config.inc.php file) to point to the location of the pg_dump and pg_dumpall utilities on your server. Once you have done that, the database export feature will appear.
Q
Why phpPgAdmin ask me to re-enter login information for every page I access on PostgreSQL?
A
You most certainly have a problem with your PHP sessions. Make sure:

your browser accept cookies if your session ID relies on them

PHP has write access to the path set in the parameter “session.save_path” of your php.ini
Q
How do I control connections from other hosts on PostgreSQL?
A
PostgreSQL only allows connections from the local machine using Unix domain sockets or TCP/IP connections. Other machines will not be able to connect unless you modify listen_addresses in the postgresql.conf file, enable host-based authentication by modifying the $PGDATA/pg_hba.conf file, and restart.
Q
How does PostgreSQL use CPU resources?
A
The PostgreSQL server is process-based (not threaded). Each database session connects to a single PostgreSQL operating system (OS) process. Multiple sessions are automatically spread across all available CPUs by the OS.
Q
How do I change the sort ordering of textual data in PostgreSQL?
A
PostgreSQL sorts textual data according to the ordering that is defined by the current locale, which is selected during initdb.