首先,卸载掉原有的postgis和postgresql-9.1-postgis,不然你就用1.5版好了~
1 |
sudo dpkg --purge postgis postgresql-9.1-postgis |
然后,添加相应的repository 并安装PostGIS
1 |
sudo apt-add-repository ppa:sharpie/ for -science |
2 |
sudo apt-add-repository ppa:sharpie/postgis-nightly |
4 |
sudo apt-get install postgresql-9.1-postgis |
接着生成postgis模板库
2 |
createdb postgis_template |
1 |
psql -d postgis_template -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql |
2 |
psql -d postgis_template -f /usr/share/postgresql/9.1/contrib/postgis-2.1/spatial_ref_sys.sql |
最后,修改一下用户密码
2 |
ALTER USER postgres WITH PASSWORD '123456' ; |
OK了,去体验
postgis强大的空间能力吧!