postgresql安装

一、yum方式安装

1.查看postgresql版本信息,默认版本通常较低,如PostgreSQL 8.4,

yum info postgresql

2.安装较新的PostgreSQL yum repository

# rpm -i http://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-redhat96-9.6-3.noarch.rpm

3.安装新版本PostgreSQL

# yum install postgresql96-server postgresql96-contrib

4.查看安装

rpm -qa | grep postgresql

查看是否安装了:

postgresql96-server-9.6.0-1PGDG.rhel6.x86_64

postgresql96-contrib-9.6.0-1PGDG.rhel6.x86_64

postgresql96-9.6.0-1PGDG.rhel6.x86_64

postgresql96-libs-9.6.0-1PGDG.rhel6.x86_64

5. 初始化并启动数据库

/etc/init.d/postgresql-9.6 initdb

/etc/init.d/postgresql-9.6 start
/etc/init.d/postgresql-9.6 stop

 6.数据文件目录

/var/lib/pgsql/9.6

卸载重新安装postgresql时需清空此文件夹

原文地址:https://www.cnblogs.com/myf008/p/5973635.html