安装:

STEP1:下载对应rpm

yum install  https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm

STEP2:安装下好的rpm

yum install postgresql96-server postgresql96-contrib

step3 初始化数据库

service postgresql-9.6 initdb

step4设置开机自启动

chkconfig postgresql-9.6 on

step5启动服务

service postgresql-9.6 start

配置:

step1 修改用户密码

  • su - postgres 切换用户,执行后提示符会变为 '-bash-4.2$'
  • psql - U postgres 登录数据库,执行后提示符变为 'postgres=#'
  • ALTER USER postgres WITH PASSWORD 'postgres' 设A置postgres用户密码
  • \q 退出数据库 (pgcluster012)

step2 开启远程访问

  • vi /var/lib/pgsql/9.6/data/postgresql.conf
  • 修改#listen_addresses = 'localhost' 为 listen_addresses='*'
  • 当然,此处‘*’也可以改为任何你想开放的服务器IP
  或者使用scp命令将之前配置好的文件拷贝过来覆盖即可scp /var/lib/pgsql/9.6/data/postgresql_backup.conf root@192.168.10.33:/var/lib/pgsql/9.6/data/

step3 信任远程连接

  • vi /var/lib/pgsql/9.6/data/pg_hba.conf
  修改如下内容,信任指定服务器连接
    # IPv4 local connections:
    host    all            all      127.0.0.1/32      trust
    host    all            all           10.211.55.6/32(需要连接的服务器IP  trust
    
 同上

step4 打开防火墙

CentOS 防火墙中内置了PostgreSQL服务,配置文件位置在/usr/lib/firewalld/services/postgresql.xml,我们只需以服务方式将PostgreSQL服务开放即可。\

Centos7:

  firewall-cmd --add-service=postgresql --permanent 开放postgresql服务

  firewall-cmd --reload 重载防火墙

centos6.8:

  查询防火墙状态:
  [root@localhost ~]# service   iptables status
  停止防火墙:
  [root@localhost ~]# service   iptables stop
  启动防火墙:
  [root@localhost ~]# service   iptables start
  重启防火墙:
  [root@localhost ~]# service   iptables restart
  永久关闭防火墙:
  [root@localhost ~]# chkconfig   iptables off
  永久关闭后启用:
  [root@localhost ~]# chkconfig   iptables on

重启PostgreSQL数据服务

  systemctl restart postgresql-9.6.service(centos 7)

  service postgresql-9.6 restart(centos
6.8)

在其他服务器上切换到postgres下测试连接

psql -h
172.11.20.45 -p 5432 -U postgres,如果可以进入就算配置完成。

总结

至此pg96安装并简单配置完成。

centos服务器安装配置Postgre9.6的更多相关文章

  1. CentOS下Redis服务器安装配置

    说明: 操作系统:CentOS 1.安装编译工具 yum install wget  make gcc gcc-c++ zlib-devel openssl openssl-devel pcre-de ...

  2. Linux下Redis服务器安装配置

    说明:操作系统:CentOS1.安装编译工具yum install wget  make gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel ...

  3. CentOS服务器安装FFmpeg指南

    CentOS服务器安装FFmpeg指南 服务器系统环境为:CentOS 6.5(final): 在服务器成功安装FFmpeg颇废了一番功夫,总结一下成功安装的过程,希望对大家有用 ^_^ : Ps:使 ...

  4. Linux 下 Memcached 缓存服务器安装配置

    Linux 下 Memcached 缓存服务器安装配置 [日期:2011-08-06] 来源:Linux社区  作者:Linux [字体:大 中 小]   [安装Memcache服务器端]我目前的平台 ...

  5. Centos网络配置

    网上搜索:centos网络配置的方法,主要包括dns.网关.IP地址,主要是配置resolv.conf\network\ifcfg-eth0这些网络配置文件. 稍后我会就centos7的网络配置进行实 ...

  6. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  7. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署

    阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...

  8. 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定

    阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...

  9. 阿里云服务器Linux CentOS安装配置(七)域名解析

    阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...

随机推荐

  1. Unable to connect to the MKS : Failed to connect to server XXXXXX:903

    Issue : 通过 vSphere 连接VM控制台的时候, 报错       Unable to connect to the MKS : Failed to connect to server X ...

  2. drag-html

    <!doctype html><html><head><meta charset="UTF-8" /><title>Ca ...

  3. Mysql的四种key

    我们看到Key那一栏,可能会有4种值,即 '','PRI','UNI','MUL'1. 如果Key是空的, 那么该列值的可以重复, 表示该列没有索引, 或者是一个非唯一的复合索引的非前导列2. 如果K ...

  4. wdatepicker ie8等问题

    官方文档:http://www.my97.net/demo/resource/2.4.asp 以下内容为使用中遇到的问题,具体该插件具有的方法请自行查阅官方文档. 1.当触发wdatepicker事件 ...

  5. UVA 11578 - Situp Benches(dp)

    题目链接:11578 - Situp Benches 题意:健♂身♂房有两个仰卧起坐坐垫,每次调整角度要花费10元/10度,每次使用要花费15,如今给定n个人的时间顺序,和所希望的角度,求最少花费 思 ...

  6. C#给指定doc文件写入宏

    private void InsertMacro() { Word.Application oWord; Word.Document oDoc; VBIDE.VBComponent oModule; ...

  7. UDIMM、RDIMM、SODIMM以及LRDIMM的区别

    DIMM简介 DIMM(Dual Inline Memory Module,双列直插内存模块)与SIMM(single in-line memory module,单边接触内存模组)相当类似,不同的只 ...

  8. oracle insert/update

    insert into table (,,) values (,,) where update table set (,)=(select , from ) where

  9. Long-term stable release maintenance

    http://en.wikipedia.org/wiki/Linux_kernel 2014.5.28 2.6.32 2 December 2009[122] 2.6.32.62[123] Willy ...

  10. Laravel建站01--开发环境部署

    内容导航 安装git 安装composer 安装Laravel 既然是开发环境,就需要源代码管理.这里使用git来管理. 一:部署开发环境之前安装git 在 Linux 上安装git 如果你想在 Li ...