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

[PostGIS](http://postgis.net/) menambahkan dukungan obyek geografis pada PostgreSQL, merubahnya kedalam basisdata spasial. [GEOS](/id/1.9/ref/contrib/gis/install/geolibs/#geosbuild), [PROJ.4](/id/1.9/ref/contrib/gis/install/geolibs/#proj4) and [GDAL](/id/1.9/ref/contrib/gis/install/geolibs/#gdalbuild) harus dipasang sebelum membangun PostGIS. Anda mungkin juga butuh pustaka tambahan, lihat [PostGIS requirements](http://postgis.net/docs/manual-2.1/postgis_installation.html#install_requirements).

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

On Debian/Ubuntu, you are advised to install the following packages:
postgresql-x.x, postgresql-x.x-postgis, postgresql-server-dev-x.x,
python-psycopg2 (x.x matching the PostgreSQL version you want to install).
Please also consult platform-specific instructions if you are on [Mac OS X](/id/1.9/ref/contrib/gis/install/#macosx)
or [Windows](/id/1.9/ref/contrib/gis/testing/#windows).

## Membangun dari sumber

Pertama unduh sumber arsip, dan keluarkan:

```
$ wget http://download.osgeo.org/postgis/source/postgis-2.1.5.tar.gz
$ tar xzf postgis-2.1.5.tar.gz
$ cd postgis-2.1.5
```

Selanjutnya, konfigurasi, buat dan pasang PostGIS:

```
$ ./configure
```

Akhirnya, make dan install:

```
$ make
$ sudo make install
$ cd ..
```

> **Note**
>
> GeoDjango does not automatically create a spatial database.  Please consult
> the section on [Membuat basisdata spasial](#spatialdb-template91) for more information.

## Post-installation

### Membuat basisdata spasial

PostGIS 2 includes an extension for Postgres 9.1+ that can be 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;`.

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;`.

> **Changed in Django 1.8**
>
> The `CREATE EXTENSION postgis` command is now automatically run during
> the [`migrate`](/id/1.9/ref/django-admin/#django-admin-migrate) process. You can still create it manually if you
> wish.

### 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;
```
