安装:

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. 重新认识一遍JavaScript - 2

    1.JavaScript没有Java和C中的int.double,怎么识别这些类型的呢?或者说不支持 问:你认为呢? 答:var 支持所有数据类型(int.double.string),取决于你输入的 ...

  2. STM32串行通信USART解说笔记

    STM32串行通信USART程序例举链接:http://blog.csdn.net/dragon12345666/article/details/24883111 1.STM32串行通信USART的相 ...

  3. 谈谈Runtime类中的freeMemory,totalMemory,maxMemory几个方法

    最近在网上看到一些人讨论到java.lang.Runtime类中的freeMemory(),totalMemory(),maxMemory ()这几个方法的一些问题,很多人感到很疑惑,为什么,在jav ...

  4. Plug and Play

    http://baike.baidu.com/view/33701.htm 即插即用 编辑   PNP是Plug-and-Play(即插即用)的缩写.它的作用是自动配置(低层)计算机中的板卡和其他设备 ...

  5. What is the relationship between Xcode, Swift and Cocoa?

    Xcode is an IDE for developing Swift or Objective-C applications, which can use the Cocoa API (which ...

  6. 运维基础-Linux发展史、安装、基本操作

    Linux是目前互联网运维.大数据.云计算方向首选操作系统平台,能够在物理服务器Dell.hp.等server,以及当前主流的云平台,阿里云,腾讯云上面部署 发展史 . . .略过..... 物理服务 ...

  7. Canvas学习笔记——动画中的三角学

    示例1,跟随鼠标的键头:   需要掌握一个重要的公式,这个方法返回从 x 轴到点 (x,y) 之间的角度 Math.atan2(dy,dx); 关键代码: function Arrow() { thi ...

  8. PE添加Style

       1. <style id="NumberStyle"> <setting> <param name="option"> ...

  9. python中的and和or(转载)

    python中的and和or 4.6. and 和 or 的特殊性质在Python 中,and 和 or 执行布尔逻辑演算,如你所期待的一样,但是它们并不返回布尔值:而是,返回它们实际进行比较的值之一 ...

  10. Eclipse-----Eclipse断点调试