How Do You Install and Configure Postgresql on a Linux CentOS 7 Server?

Problem scenario:  You have a Linux Centos 7.3 server.  You want to get Postgresql to work on it.  What do you do?

Solution
To get Postgresql working on a CentOS 7.3 server, do the following four commands as the root user:

yum -y install postgresql-server postgresql-contrib

postgresql-setup initdb

systemctl start postgresql

systemctl enable postgresql

#  To issue SQL commands, run these two commands:

sudo -i -u postgres

psql

#  To exit the Postgres command prompt, type this followed by enter:

\q

Leave a comment

Your email address will not be published. Required fields are marked *