原文:http://lovewinner.iteye.com/blog/1490915

安装postgresql

 

[plain] view plain copy
 
  1. sudo apt-get install postgresql-9.1 postgresql-contrib-9.1  

 

其中postgresql-contrib-9.1不是必须要安装的,如果不安装,以后使用pgadmin打开数据库时可能会提示安装以使用啥啥啥功能。嫌麻烦的话就一起安装了吧。

如果要安装其他版本的postgresql,可以用

 

[plain] view plain copy
 
  1. sudo apt-cache search postgresql  

 

查询

 

安装postgis

 

[plain] view plain copy
 
  1. sudo apt-get install postgresql-9.1-postgis  

 

 

该安装的都安装上了, postgresql已经可以使用,如果要建立一个postgis数据库,还要进行下列步骤:

 

 

生成postgis模板库

切换到postgres用户

 

[plain] view plain copy
 
  1. sudo su postgres  

 

新建库postgis_template

 

[plain] view plain copy
 
  1. createdb postgis_template  

 

执行postgis脚本,这些脚本默认在/usr/share/postgresql/9.1/contrib/postgis-1.5下

 

[plain] view plain copy
 
  1. psql -d postgis_template -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql  
  2. psql -d postgis_template -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql   

 

修改用户密码

 

[plain] view plain copy
 
  1. psql  
  2. ALTER USER postgres WITH PASSWORD '111111';  

 

 
 

相关文章:

  • 2022-02-09
  • 2021-12-25
  • 2022-01-26
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-10-21
  • 2021-04-22
  • 2021-06-03
相关资源
相似解决方案