编译
git clone https://github.com/postgres/postgres.git
cd postgres/
yum -y install -y readline-devel
./configure --enable-debug
make clean && make -j
安装
启动前准备
make install -j
useradd postgres
passwd postgres
su - postgres
vim ~/.bash_profile
#在.bash_profile的末尾加入以下两行
export PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
source ~/.bash_profile
rm -rf /home/postgres/data && initdb -D /home/postgres/data
启动与连接
pg_ctl -D /home/postgres/data -l logfile start
psql -d postgres -p 5432