Ubuntu installs PostgreSQL and PostGIS

Source: Internet
Author: User
Tags postgis

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.