1、安装centos6.3 desktop
2、创建用户 postgres
#groupadd postgres
# useradd -g postgres postgres
3、安装libxml2包
#tar -zvxf libxml2-2.9.1.tar.gz
#cd libxml2-2.9.1
#./configure –prefix=/usr/local/libxml2
#make
#make install
///////////////////////////
yum install gcc 从软件仓库下载gcc,然后安装,这个是编译器
yum install make 安装make,这个是自动编译源码的工具
yum install kernel-headers 安装内核头文件,编译内核,驱动必要的头文件
yum install kernel-devel 同上
yum -y install gcc-c++ G++
//////////////////////////////
4、安装proj包
#tar -zvxf proj-4.8.0.tar.gz
#cd proj-4.8.0
#./configure –prefix=/usr/local/proj
#make
#make install
5、安装geos包
#tar xvfj geos-3.2.3.tar.bz2
#cd geos-3.2.3
#./configure –prefix=/usr/local/geos(这里不需要再加其他参数,配置结果出现3个false,也不要紧)
#make
#make install
6、安装postgresql 包
#tar –zvxf postgresql-9.1.5.tar.gz
#cd postgresql-9.1.5
#./configure –prefix=/usr/local/pgsql
#make
#make install
这样在/usr/local就生成了个pgsql目录
7、添加环境变量
编辑 vi /etc/profile
PATH=$PATH:$HOME/bin
export PATH
PATH=$PATH:$HOME/bin
PGSQL_HOME=/usr/local/pgsql
PATH=$PATH:$PGSQL_HOME/bin
PROJ_HOME=/usr/local/proj
GEOS_HOME=/usr/local/geos
PATH=$PATH:$PROJ_HOME/bin:$GEOS_HOME/bin
LD_LIBRARY_PATH=$PGSQL_HOME/lib:$PROJ_HOME/lib:$GEOS_HOME/lib
export PATH
export PGSQL_HOME
export PROJ_HOME
export GEOS_HOME
export LD_LIBRARY_PATH
8、#mkdir /usr/local/pgsql/data
#cd /usr/local
把pgsql目录交给postgres
#chown -R postgres:postgres pgsql
su - postgres
#initdb –D /usr/local/pgsql/data
9、配置pg_hba.conf、postgresql.conf
在pg_hba.conf 后面加 host all all 192.168.56.0/24 trust
将postgresql.conf文件中的#listen_address=’localhost’改为listen_address=’*’
将postgresql.conf文件中的#port=5432改为port=5432
10、设置postgresql启动
拷贝安装包下面的
..../contrib/start-scripts/linux 到/etc/init.d/ 目录下
如: cp linux /etc/init.d/postgis
chmod a+x /etc/init.d/postgis
chown –R postgres:postgres /etc/init.d/postgis
这里也可以编辑这个启动文件,如配置各种路径。
最后将该项加入到系统启动里chkconfig --add postis
11、运行setup 在系统服务里确保postgis开机启动
12、安装postgis包
#tar -zvxf postgis-1.5.5.tar.gz
#cd postgis-1.5.5
#LDFLAGS=-lstdc++
#./configure --prefix=/usr/local/postgis--with-pgconfig=/usr/local/pgsql/bin/pg_config--with-projdir=/usr/local/proj --with-geosconfig=/usr/local/geos/bin/geos-config --with-xml2config=/usr/local/libxml2/bin/xml2-config
#make
#make install
13、su - postgres
14、createdb demogis
15、psql -d demogis -f postgis-1.5/postgis.sql
16、psql -d demogis -f postgis-1.5/spatial_ref_sys.sql
17、修改数据库用户密码