Install PostgreSQL9.4 in Linux

Source: Internet
Author: User
Tags psql
Notes on the installation of postgresql in Linux. Most of the currently searched CentOS installation commands for CentOS 6.x have been greatly changed,

Notes on how to install PostgreSQL 9.4 in Linux. Most of the currently searched CentOS installation commands for CentOS 6. X have been greatly changed,

Notes on how to install PostgreSQL 9.4 in Linux.

I. Preface

PostgreSQL, also known as Postgres, is a relational database management system applicable to various Linux operating systems, Windows, Solaris, BSD, and Mac OS X. PostgreSQL follows the PostgreSQL license and is an open source software. PostgreSQL is developed by the PostgreSQL Global Development Group and consists of a small number of companies that volunteer to supervise and manage these companies, including RedHat and EnterpriseDB.

PostgreSQL is becoming more and more popular, so it is taken for granted that it is so reliable and efficient. Compared with traditional enterprise-level relational databases, PostgreSQL is fully community-driven and has rich tools and documents to form a complete ecosystem.

Currently, the installation of most of the searched CentOS commands for Centos 6.x has changed a lot. This article mainly records the process of installing PostgreSQL in CentOS 7.1.

Ii. Install the PostgreSQL Source

CentOS 6.x 32bit

Rpm-Uvh

CentOS 6.x 64bit

Rpm-Uvh

CentOS 7 64bit

Rpm-Uvh

There are not many differences in the process of adding a source, mainly because the source address has some changes.

3. Execute the installation command

Yum update

Yum install postgresql94-server postgresql94-contrib

4. verify whether the installation is successful

Rpm-aq | grep postgres

The execution result is as follows:

Postgresql94-libs-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-server-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-contrib-9.4.1-1PGDG.rhel7.x86_64

V. initialize the database

CentOS 6.x System

Service postgresql-9.4 initdb

CentOS 7 System

/Usr/pgsql-9.4/bin/postgresql94-setup initdb

If I execute service postgresql-9.4 initdb under CentOS 7, the following problem will be reported:

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.

6. Start the service and set it to start upon startup

CentOS 6.x System

Service postgresql-9.4 start
Chkconfig postgresql-9.4 on

CentOS 7 System

Systemctl enable postgresql-9.4
Systemctl start postgresql-9.4

7. Open firewall ports

CentOS 6.x System

Vi/etc/sysconfig/iptables

Press I to enter the input mode and add the following 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 the editing mode. Enter wq to exit the VI editing page.

Restart the Firewall Service

Service iptables restart

CentOS 7 System

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

8. Access PostgreSQL

Su-postgres

The output result is as follows:

Last Logon: 15:17:29 on January 1, May 18 on CST 2015pts/0
-Bash-4.2 $

Enter the command psql to view the PostgrSQL version.

Psql (9.4.1)
Enter "help" to obtain help information.

9. Set the postgres User Password

Postgres = # \ password postgres

The above operations basically complete the installation of the entire PostgreSQL.

------------------------------------ Lili split line ------------------------------------

Install PostgreSQL 6.3 on yum in CentOS 9.3

PostgreSQL cache details

Compiling PostgreSQL on Windows

Configuration and installation of LAPP (Linux + Apache + PostgreSQL + PHP) Environment in Ubuntu

Install and configure phppgAdmin on Ubuntu

Install PostgreSQL9.3 on CentOS

Configure a Streaming Replication cluster in PostgreSQL

How to install PostgreSQL 7/6 and phpPgAdmin in CentOS 5/6. 4

------------------------------------ Lili split line ------------------------------------

PostgreSQL details: click here
PostgreSQL: click here

This article permanently updates the link address:

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.