Linux installation PostgreSQL 9.4

Source: Internet
Author: User
Tags psql iptables

First, preface

PostgreSQL, often referred to as Postgres, is a relational database management system for a variety of Linux operating systems, Windows, Solaris, BSD, and Mac OS X. PostgreSQL follows PostgreSQL license and is an open source software. PostgreSQL is developed by the PostgreSQL Global Development Group, which is comprised of a handful of companies that volunteer and oversee the management of Red Hat, enterprisedb, etc.

PostgreSQL's popularity is growing, which is for granted: it is so reliable and efficient. Compared to traditional enterprise-level relational databases, PostgreSQL is fully community-driven and has a wealth of tools and documentation to form a complete ecosystem.

Most of the current searches for CentOS under installation are some of the commands used for centos6.x have changed a lot, this article mainly records the process of installing PostgreSQL under Linux Centos 7.1.

Second, the installation of PostgreSQL source

CentOS 6.x 32bit

RPM-UVH http://yum.postgresql.org/9.4/redhat/rhel-6-i386/pgdg-centos94-9.4-1.noarch.rpm

CentOS 6.x 64bit

RPM-UVH http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

CentOS 7 64bit

RPM-UVH http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm

There is not much difference in the step of adding the source, mainly the source address has a certain change.

Third, execute the installation command

Yum Updateyum install postgresql94-server postgresql94-contrib

Iv. verifying that the installation is successful

rpm-aq| grep postgres

The results of the implementation are as follows:

Postgresql94-libs-9.4.1-1pgdg.rhel7.x86_64postgresql94-server-9.4.1-1pgdg.rhel7.x86_ 64postgresql94-9.4.1-1pgdg.rhel7.x86_64postgresql94-contrib-9.4.1-1pgdg.rhel7.x86_64

V. Initializing the database

CentOS 6.x System

Service postgresql-9.4 Initdb

CentOS 7 System

/usr/pgsql-9.4/bin/postgresql94-setup Initdb

If I perform a service postgresql-9.4 under CentOS 7 Initdb will report the following issue

The service command supports only basic LSB actions (start, stop, restart, Try-restart, Reload, force-reload, status). For other actions, please try to use Systemctl.

Vi. start the service and set it to boot

CentOS 6.x System

Service postgresql-9.4 Startchkconfig postgresql-9.4 on

CentOS 7 System

Systemctl Enable Postgresql-9.4systemctl start postgresql-9.4

Seven, open firewall port

CentOS 6.x System

Vi/etc/sysconfig/iptables

Press I to enter input mode and add a statement to the file

-A input-m state--state new-m tcp-p TCP--dport 5432-j accept-a input-m State--state new-m tcp-p TCP--dport 80- J ACCEPT

Press ESC to exit edit mode and enter: Wq to exit the VI editing interface.

Restart Firewall service

Service Iptables Restart

CentOS 7 System

Firewall-cmd--permanent--add-port=5432/tcpfirewall-cmd--permanent--add-port=80/tcpfirewall-cmd--reload

Viii. Visit PostgreSQL

Su-postgres

The output results are as follows:

Last login: May 15:17:29 CST 2015pts/0-bash-4.2$

Enter the command Psql to see the version information for Postgrsql.

Psql (9.4.1) Enter "help" for assistance.

Nine, set Postgres user password

postgres=# \password Postgres

The above operation basically completes the entire PostgreSQL installation.

Linux installation PostgreSQL 9.4

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.