How To Install PostgreSQL In centos7/RHEL7

PostgreSQL In centos7/RHEL7

SHORT INTRODUCTION

PostgreSQL is a powerful, open source object-relational database system (ORDBMS). Unlike other relational database systems, the SQL function enables PostgreSQL users to create unique operators, complex data types, aggregate functions, data type conversion roles, and other database objects.

Step 1: Install PostgreSQL on CentOS 7

$ sudo yum install postgresql-server postgresql-contrib

Step 2: Initialize the Database

$ sudo postgresql-setup initdb

Step 3 : Start the Database

After start and enable the service

$ sudo systemctl start postgresql
$ sudo systemctl enable postgresql

PostgreSQL Basic Setup

$ sudo passwd postgres
$ su - postgres

If you receive an error, you can set a valid shell on the user with the following command:

su --shell /bin/bash postgres

Next, you need to create a PostgreSQL user who uses the same name as the user you are creating already for Odoo:

$ sudo su - postgres -c "createuser -s odoo"

Afterwards, perform the same command:

su - postgres

To change the password, use the below command where you add your new password instead of the NewPassword:

psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'NewPassword';"

You can switch to the PostgreSQL client shell using:

psql postgres

Here you can check the list of available commands by typing h. You can use h followed by the command for which you need more information. To exit the environment you can type q.

Tags:

No responses yet

Leave a Reply

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

Latest Comments

No comments to show.