设为首页 收藏本站
查看: 766|回复: 0

[经验分享] CentOS安装postgresql9.1

[复制链接]

尚未签到

发表于 2016-11-22 02:23:17 | 显示全部楼层 |阅读模式
  以下是在CentOS5.5上安装postgresql9.1的相关记录
(1) 从http://yum.pgrpms.org/repopackages.php 下载postgresql9.1 rpm安装包
  [iyunv@server1 ~]# wget http://yum.pgrpms.org/9.1/redhat/rhel-5-i386/pgdg-centos91-9.1-4.noarch.rpm
(2)安装pgdg-centos91-9.1-4.noarch.rpm
  [iyunv@server1 ~]# rpm -i pgdg-centos91-9.1-4.noarch.rpm  
(3)更改CentOS-Base.repo
  为方便通过yum安装postgresql9.1的相关软件,所以需要更改CentOS-Base.repo,以便于yum list postgresql* 能找到postgresql9.1的相关软件包
  只需要在 CentOS-Base.repo的[base] and [updates]中增加'exclude=postgresql*'即可
  具体操作如下:
    [iyunv@server1 ~]# cd /etc/yum.repos.d  
    [iyunv@server1 yum.repos.d]# vi CentOS-Base.repo  
      [base]
      name=CentOS-$releasever - Base
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
      #baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      exclude=postgresql*
      #released updates
      [updates]
      name=CentOS-$releasever - Updates
      mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
      #baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
      exclude=postgfesql*
      #packages used/produced in the build but not released
(4)通过yum list postgres*来检测相关的安装包
  [iyunv@server1 yum.repos.d]# yum list postgres*
    Available Packages  
    postgresql91.x86_64                         9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-contrib.x86_64                 9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-debuginfo.x86_64               9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-devel.i686                     9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-devel.x86_64                   9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-docs.x86_64                    9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-jdbc.x86_64                    9.1.901-1PGDG.rhel6           pgdg91  
    postgresql91-jdbc-debuginfo.x86_64          9.1.901-1PGDG.rhel6           pgdg91  
    postgresql91-libs.i686                      9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-libs.x86_64                    9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-odbc.x86_64                    09.00.0200-1PGDG.rhel6        pgdg91  
    postgresql91-odbc-debuginfo.x86_64          09.00.0200-1PGDG.rhel6        pgdg91  
    postgresql91-plperl.x86_64                  9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-plpython.x86_64                9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-pltcl.x86_64                   9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-python.x86_64                  4.0-2PGDG.rhel6               pgdg91  
    postgresql91-python-debuginfo.x86_64        4.0-2PGDG.rhel6               pgdg91  
    postgresql91-server.x86_64                  9.1.1-1PGDG.rhel6             pgdg91  
    postgresql91-tcl.x86_64                     1.9.0-1.rhel6                 pgdg91  
    postgresql91-tcl-debuginfo.x86_64           1.9.0-1.rhel6                 pgdg91  
    postgresql91-test.x86_64                    9.1.1-1PGDG.rhel6             pgdg91  
    postgresql_autodoc.noarch                   1.40-1.rhel6                  pgdg91  
    [iyunv@server1 yum.repos.d]#  
(6)使用yum安装postgresql9.1以及相关软件包
  [iyunv@server1 yum.repos.d]# yum install postgresql91 postgresql91-devel postgresql91-server postgresql91-libs postgresql91-contrib  
(7)初始化并启动postgresql
  [iyunv@server1 yum.repos.d]# service postgresql-9.1 initdb  
  Initializing database:                                     [  OK  ]  
  [iyunv@server1 yum.repos.d]#  
  [iyunv@server1 yum.repos.d]# service postgresql-9.1 initdb  
  Initializing database:                                     [  OK  ]  
  [iyunv@server1 yum.repos.d]#  
  
安装postgresql注意事项:
(1)如果在initdb时失败,则很有可能是因为系统默认字符编码和postgresql所认可的不一致所导致的,这时可以通过/var/lib/pgsql/9.1/pgstartup.log的相关出错信息来确认
  如果确定是编码的问题导致initdb失败,则可以通过在initdb时指定--no-locale来解决,具体方法如下
  1.1 [iyunv@GJZ bin]# su - postgres
  1.2 -bash-3.2$ /usr/local/pgsql/bin/initdb --no-locale
    The files belonging to this database system will be owned by user "postgres".
    This user must also own the server process.
    The database cluster will be initialized with locale C.
    The default database encoding has accordingly been set to SQL_ASCII.
    The default text search configuration will be set to "english".
    fixing permissions on existing directory /var/lib/pgsql/9.1/data ... ok
(2) 注意修改/var/lib/pgsql/9.1/data中的postgresql.conf和pg_hba.conf文件,根据需要配置相关的访问策略

  参考资料:
(1)http://www.davidghedini.com/pg/entry/install_postgresql_9_on_centos
(2)http://www.linuxfly.org/post/88/
(3)

  

  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-303528-1-1.html 上篇帖子: metasploit安装与配置之windows篇 (打不开安装失败可参考解决方案) 下篇帖子: postgres无法正常连接数据库FATAL: no pg_hba.conf entry for host "192.168.0.69", user "post
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表