How to install and configure CentOS7 PostgreSQL

Source: Internet
Author: User
Tags postgresql

Install yum

Yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
Yum install postgresql94-server postgresql94-contrib

Set startup

Systemctl enable postgresql-9.4.service
Systemctl start postgresql-9.4.service

Initialize database

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

Enable remote access

/Var/lib/pgsql/9.4/data/postgresql. conf

Listen_addresses = '*'
/Var/lib/pgsql/9.4/data/pg_assist.conf

# IPv4 local connections:
Host all 127.0.0.1/32 trust
Host all 192.168.117.1/32 trust
# IPv6 local connections:
Host all: 1/128 trust

Change user password

Su IPVS
Psql-U postgres
Alter user login s with password '0stgres'
\ Q

Firewall

Create a file/usr/lib/firewalld/services/ipvs94.xml

<? Xml version = "1.0" encoding = "UTF-8"?>
<Service>
<Short> IPVs 9.4 Database service </short>
<Description> S </description>
<Portprotocol = "tcp" port = "5432"/>
</Service>

Modify firewall settings

Firewall-cmd -- permanent -- add-service = ipvs94
Firewall-cmd -- reload


Enable remote access

Vi/var/lib/pgsql/9.5/data/postgresql. conf

Modify # listen_addresses = 'localhost' to listen_addresses = '*'
   

Of course, '*' can also be changed to any server IP address you want to open.


Configure phppgadmin

Edit vi/var/www/html/phpPgAdmin/conf/config. inc. php
Find $ conf ['servers'] [0] ['host'] and change it to $ conf ['servers'] [0] ['host'] = '2017. 0.0.1 ';
Find $ conf ['extra _ login_security '] and change it to $ conf ['extra _ login_security'] = false; // phppgadmin cannot log on to postgre by default.

Restart PostgreSQL data service

Systemctl restart postgresql-9.5.service

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.