安装:

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. Exiting an iOS App with Xamarin

    referenced from: http://www.redbitdev.com/exiting-ios-app-with-xamarin-ios/ The team is in the middl ...

  2. Oracle 11g客户端

    资源 下载资源,直接解压进行配置 Oracle官方资源:http://www.oracle.com/technetwork/database/features/instant-client/index ...

  3. 转:如何mac下使用wireshark

    Mac OS Mountain Lion默认是没有安装X11的,而wireshark运行需要x11,因此如果直接安装wireshark而没有安装x11,wireshark不会正常运行. 去苹果主页下载 ...

  4. 百科知识 .e,.ec文件如何打开

    1 .e是易语言源文件,你可以从以下网址下载e语言编程环境: http://www.xiazaiba.com/html/409.html   2 安装之后会自动关联.e文件.   3 打开一个e语言文 ...

  5. 可在 html5 游戏中使用的 js 工具库

    可在 html5 游戏中使用的 js 工具库 作者: 木頭 时间: September 21, 2014 分类: Utilities,Game 使用 cocos2d-js 3.0 开发游戏项目两三个月 ...

  6. Mysql导出大量数据

    outfile 导出文件   select name from t1 into outfile "/tmp/test.txt"   infile 导入文件 导入到表t1中的name ...

  7. OpenGL 与 GLSL 版本号

    来自:https://github.com/mattdesl/lwjgl-basics/wiki/GLSL-Versions You can use the #version command as t ...

  8. ARM体系结构与编程-5

    GET通经常使用于包括定义常量的源文件. 比如:GET 2440addr.inc 用AREA定义一个段.ENTRY用于指定程序的入口点,END用于告诉汇编器源文件已经结束. 比如: AREA init ...

  9. [笔记] 精通正则表达式/Mastering Regular Expressions

    / 匹配<emphasis>这个tag标注的IP地址的RE:‘<emphasis>([0-9]+(\.[0-9]+){3})</emphasis>' / 锚定--a ...

  10. cuda9,cuda8分享百度云下载

    一.文件名称: md5-cuda9cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64.debcuda-repo-ubuntu1604-9-0-local_9. ...