postgresql , postgis 安装

root权限下安装

1.安装postgresql 和 postgis

 # apt-get install postgresql-8.4 postgresql-8.4-postgis

2.安装完成后会自动生成postgres 账号,进入postgres账号

#su postgres

3.执行psql,进入postgres模式

#psql postgres

4.在postgres模式下修改密码,注意执行语句后以分号结尾,

#ALTER USER postgres with PASSWORD ‘ 123456’;

执行正常会显示 ALTER ROLE

5.postgres模式下退出

#\q

6.在postgres用户下,非数据库命令模式,创建需要用的gis0020库

psql -U postgres  -c  “CREATE DATABASE gis0020 WITH TEMPLATE = template0 ENCODING = ‘UTF8’;”

createlang -U postgres plpgsql gis0020

psql -U postgres -d gis0020 -f /usr/share/postgresql/8.4/contrib/postgis.sql

psql -U postgres -d gis0020 -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql

7.在postgres用户下,进入gis0020数据库

#psql -U postgres -d gis0020

8.查看数据库下的表

#\d

 

 

 

 

 

转载自:https://blog.csdn.net/tyjyhu/article/details/6944529

You may also like...

退出移动版