1. Installing PostgreSQL
$sudo Apt-cache Search PostgreSQL//Find the latest PostgreSQL package
$sudo Gem apt-get Install PostgreSQL package name//select Package name for installation
Installing PostGIS
$sudo Apt-cache Search PostGIS//Find the latest PostgreSQL
$sudo apt-get Install PostGIS package name (e.g.: postgresql-9.3-postgis-2.1)
2. After creating PostgreSQL Superuser (for the entire PostgreSQL database) and the user (use of a database)
3, landing PostgreSQL,
$sudo-U postgres psql
4. Connecting PostgreSQL and PostGIS (the ability to give the PostgreSQL spatial database)
$ create EXTENSION PostGIS; (Note whether you want to create it under your own database)
CREATE EXTENSION
$ CREATE EXTENSION postgis_topology; (Support topology)
CREATE EXTENSION
5. Test function
SELECT version ();//display versions of PostgreSQL
SELECT postgis_full_version ();//display version of PostGIS
Create a point
$SELECT St_point (1, 2) as Firstpoint;
Result is
Firstpoint
--------------------------------------------
0101000000000000000000f03f0000000000000040
(1 row)
6, uninstall PostGIS:
Extension_name [, ...] [CASCADE | RESTRICT]
such as: $DROP EXTENSION name CASCADE (with associated packages are removed together, otherwise with restric);
Ubuntu installs PostgreSQL and PostGIS