Installation of PostGreSQL on Centos7
by Ritesh
Posted on October 1, 2017 at 4.15 PM
Open a Terminal and install using yum. You may have to do a yum update before the installation.
yum update
yum install postgresql


Select 'y' to accept all responses during the process.

I selected additional postgreSQL packages as well.
yum install postgresql-contribYou can deployed all the packages in a single line of command.
yum install postgresql-server postgresql-contribby a single I selected additional postgreSQL packages as well.
Initialise the database
After you have installed successfully. Its time to initialise the postgre database for first time use.sudo postgresql-setup initdb
After the database is initialised. Its time to start the postgresql service.
sudo systemctl start postgresqlChange and set the default system password for postgres user. Its created during the postgresql installation .
sudo passwd postgres

Create an postgresql user with Superuser role
[root@india conf]# su - postgres
Last login: Sun Sep 18 12:00:04 IST 2016 on pts/2
-bash-4.2$ createuser -P -s -e bheeni
Enter password for new role: mypassword@890
Enter it again:
CREATE ROLE bheeni PASSWORD 'md55177e20f4013caa6082c75fdcbdc95b1' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
-bash-4.2$