天天看点

RHEL系统安装PostgreSQL环境说明安装步骤

OS:RHEL6.4(x86_64)

postgresql版本:PostgreSQL9.2.8

基础安装:

postgresql92-libs-9.2.8-1PGDG.rhel6.x86_64.rpm

postgresql92-9.2.8-1PGDG.rhel6.x86_64.rpm

postgresql92-server-9.2.8-1PGDG.rhel6.x86_64.rpm

扩展安装:

postgresql92-contrib-9.2.8-1PGDG.rhel6.x86_64.rpm

postgresql92-devel-9.2.8-1PGDG.rhel6.x86_64.rpm

在命令行执行如下命令进行安装:

按照上面的顺序安装rpm时,会报与系统的libcrypto.so.10和libssl.so.10依赖错误,错误信息如下:

因此,我们需要对系统的openssl进行升级。

升级步骤

首先,使用下面的命令卸载系统的openssl:

然后,下载PostgreSQL9.2.8依赖的的openssl10并安装。

下载地址:

<a href="ftp://ftp.pbone.net/mirror/dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/openssl10-libs-1.0.1e-1.ius.el6.x86_64.rpm" target="_blank">ftp://ftp.pbone.net/mirror/dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/openssl10-libs-1.0.1e-1.ius.el6.x86_64.rpm</a>

最后,重新安装PostgreSQL9.2.8的rpm包。

创建自定义目录<code>/opt/pg/data</code>

更改目录所有者

使用postgres用户初始化数据目录(每次启动数据库的时加<code>-D</code>参数指定路径,或者修改postgres用户下的<code>$PGDATA</code>变量为当前数据目录)

初始化数据后,会显示启动数据库的命令。

继续阅读