| 
	源码安装简要步骤
	
		下载PostgreSQL 源码包 下载根目录地址:http://ftp.postgresql.org/
 本人选择的是当前最新版本v9.4.1:http://ftp.postgresql.org/pub/source/v9.4.1/
 本人下载的源码压缩包地址如下:
 
$ /usr/local/postgresql 
$ tar -zxvf postgresql-9.4.1.tar.gz 
$ cd postgresql-9.4.1 
	 
$ ./configure 
$ gmake 
	 - 执行gmake install 
$ gmake install 
	 - 设置环境变量 
$ vi .bash_profile
$ PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin 
$ source .bash_profile 
$ adduser postgres 
	 - 更改用户目录(可选操作) 
$ vi /etc/passwd
$ postgres:x:528:528::/usr/local/pgsql:/bin/bash
$ cp /home/postgres/.bash_profile /usr/local/pgsql/
$ chown postgres.postgres .bash_profile
$ rm -rf postgres/ 
$ mkdir /usr/local/pgsql/data 
$ chown postgres /usr/local/pgsql/data 
$ su - postgres 
	 - 初始化数据库 
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/ 
	 - 回到root 用户 
$ exit 
	
		复制安装目录下的linux文件到/etc/init.d/ 
$ cd postgresql-9.4.1
$ cp contrib/start-scripts/linux /etc/init.d/postgresql 
	 - 添加执行权限 
$ chmod +x /etc/init.d/postgresql 
$ service postgresql restart 
	 - 让数据库开机启动 
$ chkconfig --add postgresql 
$ chkconfig postgresql on 
$ su - postgres
$ createdb test
$ psql test
test=$ create table test(id int); 
	 
 
	源码安装相关问题及解决方案
	
		./configure时,提示error: readline library not found  该情况,一般是未安装readline-devel,虽然提示中有建议使用 –without readline,但是装下又何妨,万一后面出点乱子,找个问题都难找,还是装一下吧。 
yum install readline-devel 
	
		直接执行gmake install,默认安装在哪? 
$ /usr/local/pgsql 
	
		执行postgresql命令、修改postgresql配置文件(postgresql.conf、pg_hba.conf),文件和目录在哪? 
$ /usr/local/pgsql/data 
	
		postgresql默认只允许本机访问,需要远程连接、外网访问,如何配置?  先配置监听地址 
$ vi /usr/local/pgsql/data/postgresql.conf
$ listen_addresses = '*' 
	再配置支持远程连接 
(责任编辑:IT)$ vi /usr/local/pgsql/data/pg_hba.conf
$ 将 127.0.0.1/8 改为 0.0.0.0/0 |