安装:

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. SocketIO总结

    我在马克飞象上写的一样的内容,感觉那个样式好看的:WorkerMan的部分总结 workerman中部分函数总结 以下是把我搜集到的资料进行了一个整合.详细怎么使用.慢慢摸索吧. Worker类 中文 ...

  2. Debian Customer PPA RFC (by quqi99)

    作者:张华  发表于:2016-01-13版权声明:能够随意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 ( http://blog.csdn.net/quqi99 ) Pre ...

  3. mysql delete auto_increment列时的注意问题

    1. 说明 在对带有AUTO_INCREMENT列的表delete掉所有数据时: (1)对于MyISAM表,在delete表中所有数据时没有任何风险,随意折腾: (2)对于InnoDB表,在delet ...

  4. C和C++代码精粹笔记1

    CH1 更好的C 运算符重载规定,必须有一个为用户自定义类型 一些输出没注意到的函数: float x = 123.456, y = 12345; //cout.precision(2); //显示两 ...

  5. do export method of oracle all database tables with dmp files.

    usually we need to export the database tables to backup and others use. So we must know what to do e ...

  6. WPF01(xaml)

    XAML:(转自http://www.cnblogs.com/huangxincheng/archive/2012/06/17/2552511.html) <Window x:Class=&qu ...

  7. CUDA vs GPGPU

    http://www.kuqin.com/hardware/20080830/15726.html 一 在硬件和软件之间选择     “计算机软件和硬件的逻辑等价性”是计算机组成原理中一个非常重要的理 ...

  8. 福昕熊雨前:PDFium开源项目的背后

    今天编译android的时候,无意中看到命令行提示出输出编译external/pdfium这个目录,于是乎上百度搜索了一下,找到了如下关于PDF文件解析的开源代码的文章: http://www.csd ...

  9. Python--常用模块部分

    模块 pip install #模块名称 #安装模块 #导入模块 from collections import namedtuple collections模块 提供了几个额外的数据类型: Coun ...

  10. KVM技术

    今天是周六,看到一片KVM相关的文章,感觉写得很不错,翻译了,原文在这里:KVM Technology 在开放服务器虚拟化的应用方面,KVM虚拟化技术近年来广受关注.自从2006年10月份诞生以来,其 ...