版本信息

ubuntu    14.04.1LTS

postgresql   9.3.5

postgis       2.1.2

今天尝试着安装了postgis 2.1.2,(较简便的包安装,不是源码安装)把步骤写出来分享给大家

1.安装postgresql

首先用  apt-cachesearch postgresql 查找最新的软件包,结果如下

postgresql-9.3 - object-relational SQLdatabase, version 9.3 server

postgresql-9.3-dbg - debug symbols forpostgresql-9.3

postgresql-client-9.3 - front-end programsfor PostgreSQL 9.3

postgresql-contrib-9.3 - additionalfacilities for PostgreSQL

postgresql-9.3-debversion - Debian versionnumber type for PostgreSQL

postgresql-9.3-ip4r - IPv4 and IPv6 typesfor PostgreSQL 9.3

postgresql-9.3-orafce - Oracle supportfunctions for PostgreSQL 9.3

postgresql-9.3-pgfincore - set ofPostgreSQL functions to manage blocks in memory

安装第一个

apt-getinstall postgresql-9.3

2.安装postgis

首先用apt-cachesearch postgresql postgis查找最新的版本

apt-getinstall postgresql-9.3-postgis-2.1

注意这个包只是postgis的包并不包含postgresql 它的含义是适合postgresql 9.3的postgis 2.1版本

3.登录postgresql

在下载postgresql时,自动就会创建一个postgresql用户,可以用这个用户登录

$ sudo -s -u postgres
postgres$ psql
psql (9.1.3)
Type "help" for help.

如果想要创建自己的用户(如创建自己的用户hadoop)登录,可以这样

$USER$ sudo -s -u postgres
postgres$ createuser --superuser $USER ---- note: createuser is a command line tool to create a PostgreSQL user, not a system account
postgres$ createdb $USER
postgres$ psql
psql (9.1.3)
Type "help" for help.

postgres=# \password $USER
Enter new password:
Enter it again:
postgres=# \q
postgres$ exit
$USER$ psql
psql (9.1.3)
Type "help" for help. $USER=#

postgres@ubuntu:~$ createuser --superuser hadoop

postgres@ubuntu:~$ createdb hadoop

postgres@ubuntu:~$ psql

psql (9.3.5)

Type "help" for help.

postgres=# \password hadoop

Enter new password: 

Enter it again: 

postgres=# \q

postgres@ubuntu:~$ su hadoop

Password: 

hadoop@ubuntu:~$ psql

psql (9.3.5)

Type "help" for help.

4.连接postgresql与postgis(赋予postgresql空间数据库的能力)

hadoop=# CREATE EXTENSION postgis;

CREATE EXTENSION

hadoop=# CREATE EXTENSION postgis_topology;(支持拓扑)

CREATE EXTENSION

5.大功告成,现在开始测试功能

首先测试一下版本信息

hadoop=# SELECT version();//显示postgresql的版本

hadoop=# SELECT postgis_full_version();//显示postgis的版本

然后创建一个点

hadoop=# SELECT ST_Point(1, 2) AS MyFirstPoint;

结果为

                myfirstpoint                

--------------------------------------------

 0101000000000000000000F03F0000000000000040

(1 row)

postgres=# \q(\q为退出)



主要参考   http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1204

ubuntu安装postgresql与postgis的更多相关文章

  1. ubuntu安装postgresql以及pgadmin4当前最新(4.3)网页版

    pgAdmin4安装 1.安装安装包 sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv ...

  2. ubuntu 安装 postgresql

    安装环境: Ubuntu 10.04-desktop-i386 PostgreSQL 8.4 1. 安装PostgreSQL 输入如下命令 sudo apt-get install postgresq ...

  3. ubuntu16.04搭建geodjango+postgresql+postgis的WebGIS框架(二))安装postgresql和postgis

    卸载老版本sudo dpkg --purge postgis postgresql-9.3-postgis1.安装postgresql sudo apt-cache search postgresql ...

  4. CentOS7使用yum安装PostgreSQL和PostGIS

    更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Cent ...

  5. centos7安装postgresql和postgis

    1.安装步骤 -- 安装对应的rpm文件(其他系统的rpm包,请自行到https://yum.postgresql.org/下载)yum install -y https://download.pos ...

  6. Ubuntu 安装PostgreSQL

    安装最新版: sudo apt-get install postgresql 安装完成后,默认会: (1)创建名为"postgres"的Linux用户 (2)创建名为"p ...

  7. Ubuntu安装PostgreSQl

    warrior@pc:~$ sudo apt-get install postgresql-xx-xx #可以使用Tab键进行代码补全 warrior@pc:~$ sudo su postgres # ...

  8. ubuntu下postgreSQL安装配置

    一.安装并配置,并设置远程登陆的用户名和密码 1.安装postgreSQL sudo apt-get update sudo apt-get install postgresql-9.4 在Ubunt ...

  9. Ubuntu下postgresql安装

    第一步:在Ubuntu下安装Postgresql         1.使用 apt-get install 安装          zhang@ubuntu:~/protgresql#sudo apt ...

随机推荐

  1. Mysql高级之存储过程

    参考地址1:http://www.2cto.com/database/201411/350819.html 参考地址2:http://www.jb51.net/article/39471.htm my ...

  2. Java令牌生成器

    package Token; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; im ...

  3. android 通过工具抓包

    工具: 1.tcpdump :http://www.strazzere.com/android/tcpdump 2.wireshark:http://pan.baidu.com/s/1geooiav ...

  4. IIS8中 出现ashx 401:未授权,uploadify上传文件失败

    环境:阿里云服务器 windows2012  + IIS8 +asp.net 访问IIS 出现能正常访问aspx页面,但是通过ajax访问ashx上传文件的时候就出现ashx  Status Code ...

  5. [原创] zabbix学习之旅五:如何快速搭建一个报警系统

    通过之前的文章,我们已搭建好zabbix server.agent和mail客户端,现在万事俱备,只差在server的界面中进行相应配置,即可快速搭建一个报警系统.总的来说,快速搭建一个报警系统的顺序 ...

  6. 第九章 CSS-DOM

    另一个网友整理了很多书中的代码:http://www.cnblogs.com/jingangel/archive/2013/01/03/2843505.html 1. 三位一体的网页 浏览器看到的网页 ...

  7. sqlserver2008r2 127.0.0.1 用户sa登录失败 错误18456

    按照网上的所有方法都试过了,还是不行. 最后,将sa密码重新设置一下,解决问题.

  8. Yandex.Algorithm 2011 Round 1 D. Sum of Medians 线段树

    题目链接: Sum of Medians Time Limit:3000MSMemory Limit:262144KB 问题描述 In one well-known algorithm of find ...

  9. 【CodeForces】【338E】Optimize!

    线段树 先搞出来每个a[i]能连多少条边记为w[i]……如果对一组s[i],都满足w[i]-rank[i]>=0则这是一组合法方案,然后线段树维护w[i]-rank[i](第一个元素出去的时候后 ...

  10. Win32 Plus Extra Height of Caption Bar

    you set the size of the non-client area by handling the WM_NCCALCSIZE message. But don't do this unl ...