CentOS6.5下安装PostgreSQL

时间:2023-03-08 17:58:44

一、配置 YUM 仓库

修改原始的 yum 仓库配置:

vim /etc/yum.repos.d/CentOS-Base.repo

在[base]和[updates] 节(section)部分的尾部插入一行:

exclude = postgresql*

用以取消从默认仓库安装和更新PostgresQL 。

二、下载和安装PGDG RPM 文件

注:本例子为在CentOS6.3 32-bit 上安装 PostgrSQL 9.1

1、下载

curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-i386/pgdg-centos91-9.1-4.noarch.rpm

2、安装对应的RPM文件

rpm -ivh pgdg-centos91-9.1-4.noarch.rpm

三、安装 PostgreSQL Server

yum install postgresql91-server

四、安装后的命令

1、初始化数据库(数据目录默认路径:/var/lib/pgsql/9.1/data)

service postgresql-9.1 initdb

2、启动postgresql数据库服务

service psotgresql-9.1 start

References

1、http://wiki.postgresql.org/wiki/YUM_Installation

2、http://www.cnblogs.com/shanyou/archive/2012/08/25/2656783.html