一、安装PostgreSQL源

CentOS 6.x 32bit

rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-i386/pgdg-centos94-9.4-1.noarch.rpm

CentOS 6.x 64bit

rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

CentOS 7 64bit

rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm

注意:PostgreSQL9.4 版本有更新  目前变为9.4.2   将rpm 中后面的地址9.4.1 变为9.4.2即可

二、执行安装命令

yum install postgresql94-server postgresql94-contrib

三、验证是否安装成功

rpm -aq| grep postgres

执行结果如下:

postgresql94-libs-9.4.1-1PGDG.rhel7.x86_64
postgresql94-server-9.4.1-1PGDG.rhel7.x86_64
postgresql94-9.4.1-1PGDG.rhel7.x86_64
postgresql94-contrib-9.4.1-1PGDG.rhel7.x86_64

四、初始化数据库

CentOS 6.x 系统

service postgresql-9.4 initdb

CentOS 7 系统

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

五、启动服务并设置为开机启动

CentOS 6.x 系统

service postgresql-9.4 start
chkconfig postgresql-9.4 on

CentOS 7 系统

systemctl enable postgresql-9.4
systemctl start postgresql-9.4

六、开放防火墙端口

参考《阿里云中Centos下配置防火墙》

七、访问PostgreSQL

su - postgres

输出结果如下:

上一次登录:一 5月 18 15:17:29 CST 2015pts/0 上
-bash-4.2$

输入命令psql将看到PostgrSQL的版本信息。

psql (9.4.1)
输入 "help" 来获取帮助信息.

八、设置postgres用户密码

postgres=# \password postgres

注意:要加 \

九、 设置远程访问

用vi 编辑postgresql.conf  和 pg_hba.conf文件的内容

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

listen_addresses ='*'

/var/lib/pgsql/9.4/data/pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             IP地址/24         md5
# IPv6 local connections:
host    all             all             ::1/128                 trust

十、设置客户端心跳连接(防止客户端没有操作时,失去连接)

tcp_keepalives_idle = 60

tcp_keepalives_interval = 10

tcp_keepalives_count = 6 #空闲多少秒后,给idle的连接的客户端发送tcp的keepalives包, Linux下面默认是2小时

以上完成Postgresql安装和配置。

Centos6.5 下安装PostgreSQL9.4数据库的更多相关文章

  1. 【转载】CentOS6.5_X64下安装配置MongoDB数据库

    [转载]CentOS6.5_X64下安装配置MongoDB数据库 2014-05-16 10:07:09|  分类: 默认分类|举报|字号 订阅      下载LOFTER客户端 本文转载自zhm&l ...

  2. CentOS6.5下安装配置MySQL数据库

    一.MySQL简介 说到数据库,我们大多想到的是关系型数据库,比如MySQL.Oracle.SQLServer等等,这些数据库软件在Windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...

  3. linux(centos6) 下安装 postgresql-9.3.1.tar.gz

    目录 一. 环境 二.准备工作 三.先安装 make, gcc ,gcc-c++,readline-devel ,zlib-devel .如果已安装,可以忽略 四.开始安装 4.1 解压 tar -z ...

  4. centos6.5下安装mysql数据库

    centos6.5下安装mysql数据库 1.安装mysql数据库:yum install mysql-server 2.临时启动数据库:service mysqld start 3.开机启动数据库: ...

  5. CentOS6.5下安装配置MySQL

    CentOS6.5下安装配置MySQL,配置方法如下: 安装mysql数据库:# yum install -y mysql-server mysql mysql-deve 查看mysql-server ...

  6. CentOS6.5下安装JDK1.7+MYSQL5.5+TOMCAT7+nginx1.7.5环境安装文档

    ----------------CentOS6.5下安装JDK1.7+MYSQL5.5+TOMCAT7+nginx1.7.5环境安装文档----------------------- [JDK1.7安 ...

  7. CentOS6.5下安装apache2.2和PHP 5.5.28

    CentOS6.5下安装apache2.2 1. 准备程序 :httpd-2.2.27.tar.gz 下载地址:http://httpd.apache.org/download.cgi#apache2 ...

  8. CentOS6.5下安装Apache2.4+PHP7

    CentOS6.5下安装Apache2.4+PHP7 http://blog.csdn.net/along602/article/details/42695779 http://www.th7.cn/ ...

  9. 在CentOS6.8下安装Docker

    在CentOS6.8下安装Docker 一.查看系统版本 [root@localhost opt]# uname -a Linux localhost.localdomain -.el6.x86_64 ...

随机推荐

  1. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

  2. linux网络完全与防护

    7.1 网络封包联机进入主机的流程   7.1.1 封包进入主机的流程 1.经过防火墙的分析 iptables 主要功能是封包过滤 主要分析TCP/IP的封包表头来进行过滤的机制 分析的是OSI的第二 ...

  3. ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread

    ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread Thread[appclient-registration-retr ...

  4. Queue、进程、线程、协程

    参考博客地址 http://www.cnblogs.com/alex3714/articles/5230609.html 1.python GIL全局解释器锁 python调用的操作系统的原生线程,当 ...

  5. Javaweb自定义标签

    项目中用到自定义的标签文件,但是却在web.xml中没有看到相关的标签配置,原来如果web应用使用servelet2.4以上的版本就不需要在web.xml中定义了,servelet会自动加载tld文件 ...

  6. new String(“a”)与String a="a";

    String a=new String ("a"); String b=new String ("a"); //这是比较地址 System.out.printl ...

  7. map/reduce of python

    [map/reduce of python] 参考: http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac92 ...

  8. winfrom中DataGridView绑定数据控件中DataGridViewCheckBoxColumn怎么选中

    ; i < this.dataGridView1.Rows.Count; i++) { this.dataGridView1.Rows[i].Cells["CheckBoxCulums ...

  9. 【Jquery mobile】动态加载ListView 转

    [Jquery mobile]动态加载ListView 分类: Jquery Mobile2011-12-01 09:04 13984人阅读 评论(1) 收藏 举报 jquerylistviewmob ...

  10. 用Python玩转词云

    第一步:引入相关的库包: #coding:utf-8 __author__ = 'Administrator' import jieba #分词包 import numpy #numpy计算包 imp ...