`
zhtch_123
  • 浏览: 83304 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

CentOS 安装postgreSQL9.1

 
阅读更多
以下是在CentOS5.5上安装postgresql9.1的相关记录

(1) 从http://yum.pgrpms.org/repopackages.php 下载postgresql9.1 rpm安装包
  [root@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
  [root@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*'即可
  具体操作如下:
    [root@server1 ~]# cd /etc/yum.repos.d 
    [root@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*来检测相关的安装包
  [root@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 
    [root@server1 yum.repos.d]# 
(6)使用yum安装postgresql9.1以及相关软件包
  [root@server1 yum.repos.d]# yum install postgresql91 postgresql91-devel postgresql91-server postgresql91-libs postgresql91-contrib 
(7)初始化并启动postgresql
  [root@server1 yum.repos.d]# service postgresql-9.1 initdb 
  Initializing database:                                     [  OK  ] 
  [root@server1 yum.repos.d]# 
  [root@server1 yum.repos.d]# service postgresql-9.1 initdb 
  Initializing database:                                     [  OK  ] 
  [root@server1 yum.repos.d]# 


安装postgresql注意事项:
(1)如果在initdb时失败,则很有可能是因为系统默认字符编码和postgresql所认可的不一致所导致的,这时可以通过/var/lib/pgsql/9.1/pgstartup.log的相关出错信息来确认
  如果确定是编码的问题导致initdb失败,则可以通过在initdb时指定--no-locale来解决,具体方法如下
  1.1 [root@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/

分享到:
评论

相关推荐

    CentOS安装Postgresql数据库

    ### CentOS安装PostgreSQL数据库 #### 一、PostgreSQL简介 PostgreSQL是一款强大的开源对象关系型数据库管理系统(ORDBMS),其历史可以追溯到加州大学伯克利分校计算机系开发的POSTGRES项目。随着时间的发展,该...

    Centos7安装postgresql依赖插件RPM包

    在Linux系统,特别是CentOS 7环境中安装PostgreSQL数据库时,常常需要先安装一系列依赖包以确保数据库能够正常运行。本篇文章将详细讲解在CentOS 7上安装PostgreSQL 12.5版本时,其关键依赖包RPM(Red Hat Package ...

    Linux centos7 postgresql12 离线安装包

    在Linux CentOS7系统中安装PostgreSQL 12数据库是一个常见的任务,特别是在没有互联网连接或网络环境受限的情况下,离线安装包成为了唯一的选择。本指南将详细介绍如何使用离线安装包在CentOS7上安装PostgreSQL 12。...

    Centos7安装PostgreSql全自动部署脚本完整版

    ①添加【postgres】用户,数据库安装在postgres用户目录【/home/postgres/disk_d/applications/service/postgresql】路径下, ②给新用户授权 ③解压数据库文件 ④安装数据库依赖包 ⑤编译数据库 ⑥安装数据库 ⑦...

    PostGreSQL安装部署系列:Centos 7.9 安装指定PostGreSQL-15版本数据库

    初始化数据库是PostgreSQL安装过程中必不可少的一步,可以通过执行以下命令完成: ```bash sudo /usr/pgsql-15/bin/postgresql-15-setup initdb ``` 初始化完成后,将会创建数据库目录并设置默认权限。 ##### 3.4...

    centos7升级openssh9.1p1与openssl1.1.1j安装包、相关依赖以及说明文档

    之前由于需要修复openssh与ssl的漏洞需要升级,找了很多资料都没有系统性的离线升级,所以整理资源并归纳文档 centos7升级openssh9.1p1与openssl1.1.1j安装包、相关依赖以及说明文档

    postgresql分布式安装部署

    本文旨在详细介绍如何在Ubuntu 12.04系统上进行PostgreSQL 9.1数据库的分布式安装与部署。本教程不仅包含详细的步骤指导,还提供了架构原理图以及安装过程中的截图,帮助读者更好地理解并完成整个部署流程。 #### ...

    centos操作系统安装postgresql+postgis部署配置

    可利用里面文件离线在linux(centos)操作系统中顺利安装部署,本资源可在半小时内完成各种配置,简单方便,并通过了几台服务器环境测试。 基于pg库进行地理空间数据存储的开源数据库技术方案,只有正确安装改库...

    Centos6.8安装Postgresql11数据库.docx

    CentOS 6.8 安装 PostgreSQL 11 数据库详解 作为一名 IT 行业大师,我将从给定的文件中生成相关的知识点,以下是 Centos 6.8 安装 PostgreSQL 11 数据库的详细解释: 一、环境说明 在本文中,我们将使用 CentOS ...

    postgresql14加postgis3.2在centos离线编译安装

    本教程将详细介绍如何在CentOS系统上离线编译安装PostgreSQL 14和PostGIS 3.2,这两个是用于地理空间数据库管理的重要组件。 PostgreSQL是一个强大的开源关系型数据库管理系统,它支持复杂查询、事务处理和多种数据...

    centos7.4 postgresql11-11.8 rpm 安装包

    centos7.4 postgresql11-11.8 rpm 安装包,centos7.4 postgresql11-11.8 rpm 安装包,centos7.4 postgresql11-11.8 rpm 安装包,centos7.4 postgresql11-11.8 rpm 安装包

    CentOS 一键安装PostgreSQL10.2(可更改版本)shell脚本

    CentOS 一键安装PostgreSQL10.2 shell脚本,脚本中已表明可更改版本的位置

    CentOS6平台下PostgreSQL数据库的安装

    在本文中,我们将深入探讨如何在CentOS 6平台上安装和配置PostgreSQL数据库,并了解如何在Windows环境下使用数据库管理工具pgAdmin访问这个数据库。PostgreSQL是一个开源的关系型数据库管理系统(RDBMS),它以其...

    CentOS7.4使用yum安装postgresql10.3并修改数据库存放位置

    史上最详细,可操作性最强postgresql安装文档,yum安装指定数据库安装位置,介绍安装步骤的操作原理,适合举一反三刨根问底的同学。

    CentOS7 安装 PostgreSQL11的方法步骤

    在本文中,我们将详细探讨如何在CentOS 7系统上安装PostgreSQL 11,这是一个高度先进的开源关系型数据库管理系统。PostgreSQL以其强大的功能和对SQL标准的广泛支持而闻名,它提供了复杂查询、外键、触发器、视图、...

    CentOS7 PostgreSQL安装、配置、使用详解

    标签“CentOS7 PostgreSQL安装 CentOS7 PostgreSQL安装教程 CentOS7 PostgreSQL安装实例”则进一步细化了本文的重点,为读者提供了搜索引擎优化的关键字,帮助那些正在寻找CentOS7上PostgreSQL安装指导的用户快速...

    postgresql V15 CentOS7 离线安装包 及 依赖包

    libzstd-1.5.5-1.el7.x86_64.rpm libicu-50.2-4.el7_7.x86_64.rpm postgresql15-15.3-1PGDG.rhel7.x86_64.rpm postgresql15-libs-15.3-1PGDG.rhel7....CentOS7 下 PostgreSQL15 离线安装 及 libzstd ,libicu 依赖包;

    centOS离线安装pgsql-12

    sudo yum install -y postgresql12-server sudo /usr/pgsql-12/bin/postgresql-12-setup initdb sudo systemctl enable postgresql-12 sudo systemctl start postgresql-12

Global site tag (gtag.js) - Google Analytics