postgis+postgresql 源码安装
#准备 postgresql-9.0.2 放在主目录中,li是我自己的文件夹,可以改为你自己的文件夹
cd /home/li
tar -jxvf postgresql-9.0.2.tar.bz2
cd postgresql-9.0.2
./configure --prefix=/usr/local/pgsql
apt-get install libreadline-dev
apt-get install zliblg-dev
make
make install
#安装完毕
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
sudo echo "export POSTGRES_HOME=/usr/local/pgsql" >> /etc/profile
sudo echo "exprot LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> /etc/profile
sudo echo "export PATH=/usr/local/pgsql/bin:$PATH" >>/etc/profile
#postgis 安装:准备文件 gdal-1.9.1, geos-3.3.4, proj-4.8, json-c-0.9
cd /home/li/gdal-1.9.1
./configure --prefix=/usr/local/proj --with python
make
make install
cd /home/li/geos-3.3.4
./configure --prefix=/usr/local/geos
make
make install
cd /home/li/proj-4.8
./configure --prefix=/usr/local/proj
make
make install
cd /home/li/json-c-0.9
./configure --prefix=/usr/local/json
make
make install
sudo echo "export POSTGRES_HOME=/usr/local/pgsql" >> /etc/proifle
sudo echo "export PATH=$POSTGRES_HOME/bin:$PATH" >> /etc/proifle
sudo echo "export PGLIB=$POSTGRES_HOME/lib" >> /etc/proifle
sudo echo "export PGDATA=$POSTGRES_HOME/data" >> /etc/proifle
sudo echo "export C_INCLUDE_PATH=$POSTGRES_HOME/include" >> /etc/proifle
sudo echo "export LIBRARY_PATH=$PGLIB" >> /etc/proifle
cd /home/li/postgis-2.0.0SVN
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-projdir=/usr/local/proj --with-gdalconfig=/usr/local/gdal/bin/gdal-config --with-geosconfig=/usr/local/geos/bin/geos-config --with-jsondir=/usr/local/json-c-0.9 --with-xml2config=/usr/bin/xml2-config --with-gui --with-topology
make
make install
#测试postgis
su - postgres
cd /usr/local/pgsql/bin
createdb template_postgis
psql -f /usr/local/pgsql/share/contrib/postgis-2.0/postgis.sql -d template_postgis
psql -f /usr/local/pgsql/share/contrib/postgis-2.0/spatial_ref_sys.sql -d template_postgis
createdb -U postgres -T template_postgis mydb
#如果有什么函数找不到,查看以上装的软件有没有重复,gdal,geos,porj等,如果有重复删除就好