先去postgres的网站下载数据库
http://www.postgresql.org/ftp/binary/
解压后
执行命令
#mkdir /usr/local/pgsql
#mkdir /usr/local/pgsql/data
安装gcc
zlib-devel....
glibc-kernheaders.....
glibc_headers....
glibc-devel....
gcc-3.4.6.......
#rpm -ivf 上面的文件
#./configure -prefix=/usr/local/pgsql (--without-readline)
#make
#make install
在root下找到.bash_profile 或者 /etc/profile
add:
PGLIB=/usr/local/pgsql/lib
PGDATA=/usr/local/pgsql/data
PATH=$PATH:/usr/local/pgsql/bin
MANPATH=$MANPATH:/usr/local/pgsql/man
export PGLIB PGDATA PATH MANPATH
# su postgres
chown -R postgres.postgres /usr/local/pgsql
#/usr/local/pgsql/bin/
# ./initdb
在pg_hba.conf把你的ip地址加进去
启动与关闭命令
/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l /opt/pgsql/data/logfile start
/usr/local/pgsql/bin/pg_ctl -i -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile start
postmaster -i -D /usr/local/pgsql/data &
/opt/pgsql/bin/pg_ctl stop -D /opt/pgsql/data -l /opt/pgsql/data/logfile
/usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile -m fast
pg_ctl stop -m fast -D /usr/local/pgsql/data