微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

How to Install PostgreSQL 9.5 on CentOS/RHEL 7/6/5 and Fedora 23/22


Postgresql 9.5 Released. Postgresql is an open source object-relational,highly scalable,sql compliant database management system. Postgresql is developed at the University of California at Berkeley Computer Science Department. This article will help you for installing Postgresql on CentOS,RHEL and Fedora Systems.

Adding Postgresql Yum Repository

First step is to install Postgresql repository in your system,Use one of below commands as per your system architecture and operating system.

CentOS/RHEL 7
# rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm

CentOS/RHEL 6
# rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-redhat95-9.5-2.noarch.rpm

CentOS/RHEL 5
# rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-5-x86_64/pgdg-redhat95-9.5-2.noarch.rpm

Fedora 23:
# rpm -Uvh http://yum.postgresql.org/9.5/fedora/fedora-23-x86_64/pgdg-fedora95-9.5-3.noarch.rpm

Fedora 22
# rpm -Uvh http://yum.postgresql.org/9.5/fedora/fedora-22-x86_64/pgdg-fedora95-9.5-3.noarch.rpm

Fedora 21
# rpm -Uvh http://yum.postgresql.org/9.5/fedora/fedora-21-x86_64/pgdg-fedora95-9.5-2.noarch.rpm

For more details visitPostgreSQL repositorieslink page where you can get repository package rpm for varIoUs operating systems.

Installing Postgresql Server

After enabling Postgresql yum repository in your system use following command to installPostgresql 9.5on your system with yum package manager.

# yum install postgresql95-server postgresql95
Initializing PGDATA

After installing Postgresql server,It’s required to initialize it before using first time. To initialize database use below command.

# /usr/pgsql-9.5/bin/postgresql95-setup initdb

Above command will take some time to initialize Postgresql first time. PGDATA environment variable contains the path of data directory.

Postgresql data directory Path:/var/lib/pgsql/9.5/data/

Start Postgresql Server

To start Postgresql service using following command as per your operating systems. Also enable Postgresql service to auto start on system boot.

For CentOS/RHEL 7 and Fedora 23

# systemctl start postgresql-9.5
# systemctl enable postgresql-9.5

For CentOS/RHEL 6/5 and Fedora 22/21

# service  postgresql-9.5 start
# chkconfig postgresql-9.5 on
Verify Postgresql Installation

After completing above steps,you have installed Postgresql 9.5 on your server,Let’s login to postfix to verify that installation completed successfully.

# su - postgres

Usepsqlcommand to access Postgresql prompt with admin privileges.

$ psql


psql (9.5.0)
Type "help" for help.

postgres=#

You may create password for user postgres for security purpose.

postgres=# password postgres

Congratulation’s!You have successfully installed Postgresql Server. Read below article to install PHPPgAdmin.

How to Install phpPgAdmin on CentOS using Yum

Thanks for using this tutorial for installing Postgresql 9.5 on CentOS/RHEL 7/6/5 and Fedora 23/22/21 systems.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐