MicroHost

MicroHost

Did You Know?

How Can We Help?

Special Offer

Deploy your Cloud Server now and get $100 in Free Credits!

Get Started

HOW TO INSTALL POSTGRES DATABASE IN CENTOS 7

Table of Content

Introduction:
Postgres, is an open-source relational database management system also known as PostgreSQL.It was originally named POSTGRES, referring to its origins as a successor to the Ingres database developed at the University of California, Berkeley

Perquisite: 

  1. Server with root privilege
  2. packages should be updated
  3. SSH should be working

Installation :
Step 1: We can install postgress sql using below command.

[console]# yum install postgresql-server postgresql-contrib[/console]

Step 2: One we will done with the installation we will initialize the database using below command.

[console]# postgresql-setup initdb [/console]

Step 3: We will start and enable the postgress service using below command

[console]## systemctl start postgresql [/console]

[console]## systemctl enable postgresql[/console]

Step 4: Afterward, we need to setup the database.
Firstly, we will reset the password of postgres user  using the below command

[console]## passwd postgres[/console]

Step 5: Once the password has been reset, we will login to the postgres user using the below command.

[console]## su – postgres [/console]

Step 7: Now, we will initialize the bash shell for database login using below command.

[console]## su --shell /bin/bash postgres[/console]

Step 8: again we will move to the postgres user using below command

[console]## su – postgres[/console]

step 9: Now we will login the postgres database

[console]## psql postgres[/console]

step 9: We can create a test database using the below command in postgres

[console]## createdb testDB [/console]

Thank You 🙂

Special Offer

Deploy your Cloud Server now and get $100 in Free Credits!

Get Started
Table of Contents