一、下载地址
wget https://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.gz
二、安装:
#安装依赖包
yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake -y
tar zxvf postgresql-9.2.4.tar.gz
cd postgresql-9.2.4
./configure --prefix=/usr/local/pgsql9.2.4 --with-perl --with-python
make
make install
三、安装后的配置
ln -s /usr/local/pgsql9.2.4 /usr/local/pgsql
vim /etc/profile
#add by xuekun 2016-5-11
export PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
source /etc/profile
#创建数据簇
export PGDATA=/home/osdba/pgdata
[root@localhost osdba]# useradd osdba
[root@localhost osdba]# su osdba
[osdba@localhost ~]$ initdb
#安装contrib目录下的工具(root用户下安装)
cd /home/maidong/postgresql-9.2.4
cd contrib/
make
make install
#启动和停止数据库(osdba用户下)
[osdba@localhost contrib]$ pg_ctl start -D $PGDATA
[osdba@localhost contrib]$ pg_ctl stop -D $PGDATA