1获取源码
wget --no-check-certificate https://ftp.postgresql.org/pub/source/v9.4.4/postgresql-9.4.4.tar.gz
2./configure --prefix=/home/users/baixiaoyu/pg --datadir=/home/users/baixiaoyu/pg/data
configure后的具体参数见官方文档
3gmake
4共享库设置,在.bash_profile中设置
LD_LIBRARY_PATH=/usr/local/pgsql/lib export LD_LIBRARY_PATH
5设置环境变量
PATH=/usr/local/pgsql/bin:$PATH export PATH6make install
7初始化数据库
initdb -D /home/users/baixiaoyu/pg/baixyu
8启动数据库
./postgres -D /home/users/baixiaoyu/pg/baixyu >logfile2>&1&
9关闭服务
export PGDATA=/home/users/baixiaoyu/pg/baixyu/
./pg_ctl stop -o SIGTERM
10连接服务
./psql -h 127.0.0.1 -d postgres -U baixiaoyu