实验环境>>>>>>>>>>>>>>>>>>
操作系统:CentOS release 6.3 (Final)
数据库版本:PostgreSQL-9.3.5

一、安装postgresql数据库,先到官网下载Yum-Repository的rpm包安装到系统,然后直接yum安装postgresql即可。

安装postgresql只需要安装postgresql-server即可,yum安装过程中会自己解决所需的make、postgresqlpostgresql-libs等依赖包。

[root@ ~]# wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
[root@ ~]# rpm -ivh pgdg-centos93-9.3-.noarch.rpm
[root@ ~]# yum install postgresql93-server.x86_64 -y //需开启网官yum仓库

在安装过程中我们可以发现安装9.3.5版本的postgresql数据库需要的依赖和依赖更新,如下图所示:

二、接下来是初始化数据库,先得修改postgres用户的环境变量。可以依次执行如下命令:

[root@ ~]# su - postgres
-bash-4.1$ echo -e 'PATH=$PATH:/usr/pgsql-9.3/bin\nexport PATH' >> .bash_profile
-bash-4.1$ source .bash_profile //使配置立即生效
-bash-4.1$ initdb //初始化数据库

三、配置postgresql数据库

1、修改postgresql配置文件/var/lib/pgsql/9.3/data/postgresql.conf

postgresql默认监听localhost,即127.0.0.1。我们可以修改监听地址为指定ip或者用星号(*)表示本机所有网卡地址。

2、修改postgresql客户端认证配置文件/var/lib/pgsql/9.3/data/pg_hba.conf 以后修改此配置文件

只需要执行pg_ctl reload命令即可使其生效而不用重启服务。对于远端主机、建议使用md5密码认证方式。如下图所示:

四、使用root用户启动postgresql服务,然后将postgresql服务加入到开机启动列表。

[root@ ~]# /etc/init.d/postgresql-9.3 start
[root@ ~]# chkconfig --level postgresql-9.3 on

当我们安装完postgresql、刚初始化数据库之后的postgresql.conf的内容一般如下:

#listen_addresses = 'localhost'         # what IP address(es) to listen on;
#port = # (change requires restart)
max_connections = # (change requires restart)
shared_buffers = 128MB # min 128kB
log_destination = 'stderr' # Valid values are combinations of
logging_collector = on # Enable capturing of stderr and csvlog
log_directory = 'pg_log' # directory where log files are written,
log_filename = 'postgresql-%a.log' # log file name pattern,
log_truncate_on_rotation = on # If on, an existing log file with the
log_rotation_age = 1d # Automatic rotation of logfiles will
log_rotation_size = # Automatic rotation of logfiles will
log_line_prefix = '< %m >' # special values:
log_timezone = 'PRC'
datestyle = 'iso, mdy'
timezone = 'PRC'
lc_messages = 'en_US.UTF-8' # locale for system error message
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
lc_numeric = 'en_US.UTF-8' # locale for number formatting
lc_time = 'en_US.UTF-8' # locale for time formatting
default_text_search_config = 'pg_catalog.english'

postgresql数据库的yum安装方法的更多相关文章

  1. MySQL数据库服务器(YUM)安装

    1. 概述2. 部署过程2.1 虚拟机console的NFS服务端配置2.2 虚拟机node15的NFS客户端配置2.3 虚拟机安装MySQL环境2.4 配置MySQL3. 错误及解决3.1 启动失败 ...

  2. centos6.5 lamp 环境 使用yum安装方法

    从网上找了一些 最后整理了下 1.安装Apache yum -y install httpd # 开机自启动 chkconfig httpd on # 启动httpd 服务 service httpd ...

  3. Mysql数据库的通用安装方法

    安装方式简介 Mysql数据库也时不时的用过一段时间,具体使用的功能都比较浅显,没有具体深入学习.最近一段在公司部署iNeedle系统时经常避免不了要安装apache和Mysql数据库.一般Mysql ...

  4. PLSQL DEVELOPER 连接远程数据库 OCI客户端安装方法

    安装使用过PLSQL Dev都知道,要连接数据库,必须配置TNS(Transparence Network Substrate),而直接安装PLSQL Dev 之后,本机是没有Oracle HOME的 ...

  5. openerp安装记录及postgresql数据库问题解决

    ubuntu-14.04下openerp安装记录1.安装PostgreSQL 数据库    a.安装         sudo apt-get install postgresql    安装后ubu ...

  6. 卸载postgresql数据库

    卸载postgresql数据库有两种方法,第一种一个个包卸载,第二种全部卸载.做这些之前请先做好备份,以防意外! 1.1.查询出postgres数据库,用命令rpm -qa |grep postgre ...

  7. PostgreSQL介绍以及如何开发框架中使用PostgreSQL数据库

    最近准备下PostgreSQL数据库开发的相关知识,本文把总结的PPT内容通过博客记录分享,本随笔的主要内容是介绍PostgreSQL数据库的基础信息,以及如何在我们的开发框架中使用PostgreSQ ...

  8. linux下各安装包的安装方法

    <转>linux下各安装包的安装方法   一.rpm包安装方式步骤: 1.找到相应的软件包,比如soft.version.rpm,下载到本机某个目录: 2.打开一个终端,su -成root ...

  9. Mysql安装方法介绍

    MySQL的yum安装方法 centos7默认不再使用mysql而是用mariadb来代替mysql [root@yxh6 ~]# yum install mysql-server 已加载插件:fas ...

随机推荐

  1. ssh 安装

    一 ssh 1.查看ssh服务的状态 输入以下命令: sudo service sshd status 如果出现 Loaded: error (Reason: No such file or dire ...

  2. [转]va_start和va_end使用详解

    转载地址:http://www.cnblogs.com/hanyonglu/archive/2011/05/07/2039916.html  本文主要介绍va_start和va_end的使用及原理. ...

  3. ASP.NET分页

    [代码][C#]代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...

  4. [转]开源中国的 IT 公司开源软件整理计划介绍

    [转]开源中国的 IT 公司开源软件整理计划介绍 http://www.oschina.net/news/61534/oschina-opensource-collection-plan-for-it ...

  5. java笔试题(2)

    简述构造器的运行机制 首先要注意的是的构造器并不是函数,所以他并不能被继承,这在我们extends的时候写子类的构造器时比较的常见,即使子类构造器参数和父类的完全一样,我们也要写super就是因为这个 ...

  6. 在Eclipse中怎样写Java注释

    java中的注释分为实现注释和文档注释 实现注释就是那些/……../和//……的注释,是注释程序用的,文档注释是/*……./的注释,是用来生成javadoc的.设置方法如下: 1.打开Eclipse的 ...

  7. JQuery常用实用的事件[较容易忽略的方法]

     JQuery常用实用的事件 注:由于JQuery片段较多就没有用插入代码文本插入,请见谅!JQuery 事件处理ready(fn)代码: $(document).ready(function(){ ...

  8. Codeforces Beta Round #80 (Div. 1 Only) D. Time to Raid Cowavans 离线+分块

    题目链接: http://codeforces.com/contest/103/problem/D D. Time to Raid Cowavans time limit per test:4 sec ...

  9. 802.11 wireless 四

    802.11 wireless 4spread spectrum(扩频 - 基于香农定理的算法)1.窄带和扩频是发送信号的两种不同方式2.扩频技术使用更小的能量在波峰3.带宽的需要,基于发送数据的量频 ...

  10. 【BZOJ】【1597】【USACO 2008 Mar】土地购买

    DP/斜率优化 Orz Hzwer…… 想到排序了,但没想到其实可以将序列转化为x递增且y递减的序列……因为x是递增的,若y[i]>y[i-1]那么第i-1个就足够小……以至于可以在搞定第 i ...