Database

How To Install PostgreSQL 10 On CentOS/RHEL 7/6 and Fedora 26/25

PostgreSQL-10
mm
Written by Santosh Prasad

PostgreSQL (pronounced “post-gress-Q-L”). PostgreSQL is an open source object-relational database system. It is powerful and highly scalable SQL-compliant database management system. It is developed at the University of Califonia at Berkeley Computer Science Department.

In this article I will describe how you can install PostgreSQL 10 on CentOS/RHEL and Fedora 26/25 system.

Install PostgreSQL Repository

First of all you have to install PostgreSQL yum repository on your system. To install PostgreSQL yum repository type the below command:

On CentOS/RHEL - 7
# rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

On CentOS/RHEL - 6
# rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm

On Fedora - 26
# rpm -Uvh https://yum.postgresql.org/10/fedora/fedora-24-x86_64/pgdg-fedora10-10-2.noarch.rpm

On Fedora - 25
# rpm -Uvh https://yum.postgresql.org/10/fedora/fedora-25-x86_64/pgdg-fedora10-10-2.noarch.rpm

For other operating system you can visit PostgreSQL repositories.

PostgreSQL 10 Installation

After installing PostgreSQL repository on your system, type the below command to install the PostgreSQL 10:

# yum install postgresql10-server postgresql10

Initialize PGDATA

If you are using PostgreSQL first time it is require to initialize it. Type the below command to do this:

# /usr/pgsql-10/bin/postgresql-10-setup initdb

It will take some time to initialize your PostgreSQL. PGDATA environment variable contains the path of data directory.

Default PostgreSQL data directory path is : /var/lib/pgsql/10/data/

Start PostgreSQL Server

Now start your PostgreSQL server typing below command and enable PostgreSQL service at the system boot time.

For CentOS/RHEL 7 and Fedora

# systemctl start postgresql-10.service
# systemctl enable postgresql-10.service

For CentOS/RHEL 6

# service postgresql-10 start
# chkconfig postgresql-10 on

Verify PostgreSQL Server Installation

After installing PostgreSQL server on system now lets login to access it:

# su - postgres -c "psql"

psql (10.0)
Type "help" for help.
postgres=#

You can also create password for user postgres for security purpose.

postgres=# \password postgres

Congratulation’s!

Thanks:)

Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment