CentOS安装PostgreSQL9.1
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了CentOS安装PostgreSQL9.1,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5119字,纯文字阅读大概需要8分钟。
内容图文
![CentOS安装PostgreSQL9.1](/upload/InfoBanner/zyjiaocheng/551/1a7a0b8e04bd45cd8f16d64a8e2ad2a7.jpg)
以下是在CentOS 5.5上安装PostgreSQL 9.1的相关记录
以下是在CentOS 5.5上安装PostgreSQL 9.1的相关记录
(1) 从 下载postgresql9.1 rpm安装包
[root@server1 ~]# wget
(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文件,根据需要配置相关的访问策略 。
内容总结
以上是互联网集市为您收集整理的CentOS安装PostgreSQL9.1全部内容,希望文章能够帮你解决CentOS安装PostgreSQL9.1所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。