实验环境>>>>>>>>>>>>>>>>>>
操作系统: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. iOS-系统自带navigationController-最全设置

    // 导航栏背景色 self.navigationController.navigationBar.barTintColor = [UIColor orangeColor]; // 设置push出来的 ...

  2. linux打开端口

    客户那边有台服务器同一个局域网中都无法访问,排除lamp环境问题,发现时服务器中的防火墙没有开启80端口.于是去网上搜索了一下,在脚本之家看到一种添加代码的方法  代码如下 复制代码 vi /etc/ ...

  3. SQL Server数据库学习笔记-设计表时应该考虑的因素

    设计数据库其实就是设计数据库中的表.到底要注意些什么才能够设计好一个数据库呢?一个宗旨,8个建议. 一个宗旨“尽量少的表,每个表中尽量少的列,合理的表结构”. 8个建议: 第一个,首先要考虑的是咱们这 ...

  4. springboot常见应用属性

    # ===================================================================# COMMON SPRING BOOT PROPERTIES ...

  5. How to insert a character into a NSString

    How do I insert a space to a NSString. I need to add a space at index 5 into: NString * dir = @" ...

  6. 华为HG8240光猫-破解-联通-2016-telnet-http

    序 我与大家想法基本一致,拿到联通的光猫后,心想它应该是个路由器吧,如果让它自己拨号上网就好了,即省一台路由器,又省电了.抱着这个想法,在2013年里,我搜罗了不少文章,经过Q群,搜索,询问,阅读,理 ...

  7. appium 启动失败解决方案

    本机下载了:AppiumForWindows,启动Appium.exe 的时候,立即提示:应用程序已停止运行!! 本机环境: WIN 7 64 位,后来查了资料才知道Appium 要求安装.net f ...

  8. HDU 5446 Unknown Treasure Lucas+中国剩余定理

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5446 Unknown Treasure 问题描述 On the way to the next se ...

  9. bzoj 3232 01分数规划+最大权封闭子图判定

    我们的目标是使v/c最小化,所以构造函数g(x)=v-x*c,那么 二分一个X,判断当时的v-x*c的值是多少,然后根据g(x)函数的 单调递减性来二分,判断,直到g(x)=0的时候当前的X就是答案. ...

  10. hdu 1043 Eight 经典八数码问题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1043 The 15-puzzle has been around for over 100 years ...