---
title: "Memasang PostGIS"
version: 1.10
locale: id
source: https://docs.djangoproject.com/id/1.10/ref/contrib/gis/install/postgis/
canonical: https://djangodocs.dev/id/1.10/ref/contrib/gis/install/postgis/
---
# Memasang PostGIS

[PostGIS](http://postgis.net/) adds geographic object support to PostgreSQL, turning it
into a spatial database. [GEOS](/id/1.10/ref/contrib/gis/install/geolibs/#geosbuild), [PROJ.4](/id/1.10/ref/contrib/gis/install/geolibs/#proj4) and
[GDAL](/id/1.10/ref/contrib/gis/install/geolibs/#gdalbuild) should be installed prior to building PostGIS. You
might also need additional libraries, see [PostGIS requirements](http://postgis.net/docs/postgis_installation.html#install_requirements).

Modul [psycopg2](http://initd.org/psycopg/) dibutuhkan untuk digunakan sebagai pencocok basisdata ketika menggunakan GeoDjango dengan PostGIS.

Pda Debian/Ubuntu, anda disarankan memasang paket berikut: postgresql-x.x, postgresql-x.x-postgis, postgresql-server-dev-x.x, python-psycopg2 (x.x mencocokkan versi PostgreSQL  anda ingin pasang). Cara lain, anda dapat membangun [build from source](http://postgis.net/docs/postgis_installation.html#install_short_version). DIskusikan petunjuk khusus-serambi jika anda di [Mac OS X](/id/1.10/ref/contrib/gis/install/#macosx) atau [Windows](/id/1.10/ref/contrib/gis/testing/#windows).

## Post-installation

### Membuat basisdata spasial

PostGIS 2 includes an extension for PostgreSQL that's used to enable spatial
functionality:

```
$ createdb  <db name>
$ psql <db name>
> CREATE EXTENSION postgis;
```

The database user must be a superuser in order to run
`CREATE EXTENSION postgis;`. The command is run during the [`migrate`](/id/1.10/ref/django-admin/#django-admin-migrate)
process. An alternative is to use a migration operation in your project:

```
from django.contrib.postgres.operations import CreateExtension
from django.db import migrations

class Migration(migrations.Migration):

    operations = [
        CreateExtension('postgis'),
        ...
    ]
```

GeoDjango does not currently leverage any [PostGIS topology functionality](http://postgis.net/docs/Topology.html).
If you plan to use those features at some point, you can also install the
`postgis_topology` extension by issuing `CREATE EXTENSION
postgis_topology;`.

### Mengelola basisdata

To administer the database, you can either use the pgAdmin III program
(Start ‣ PostgreSQL 9.x ‣ pgAdmin III) or the
SQL Shell (Start ‣ PostgreSQL 9.x ‣ SQL Shell).
For example, to create a `geodjango` spatial database and user, the following
may be executed from the SQL Shell as the `postgres` user:

```
postgres# CREATE USER geodjango PASSWORD 'my_passwd';
postgres# CREATE DATABASE geodjango OWNER geodjango;
```
