cablop.net – Software Tips

Tips de software, hardware… y algo más

Skip to: Content | Sidebar | Footer

Instalar PostGIS en Ubuntu con PostgreSQL 8.3

29 Agosto, 2009 (11:01) | PostGIS, PostgreSQL 8.3, Ubuntu | By: 天龙

Esta instalación se realizó sobre Ubuntu 9.04 con PostgreSQL 8.3.

Instalación de PostGIS

Una vez instalado el PostgreSQL instalamos el PostGIS.

Nos vamos a sentir tentados a instalar el paquete postgis, pero este es un metapaquete que por alguna razón no nos instala el PostGIS.

El que debemos instalar es postgresql-8.3-postgis.

Por consola el comando es:

sudo apt-get install postgresql-8.3-postgis

Con eso ya tenemos instalado el PostGIS.

Nos hace falta crear ahora el template_postgis.

Creación del template_postgis

Nos logeamos en PostgreSQL al template1:

sudo -u postgres psql template1

Creamos una base de datos, template_postgis, a partir de este template:

create database template_postgis with template = template1;

Actualizamos la tabla pg_database para indicarle que la nueva base de datos es un template:

UPDATE pg_database SET datistemplate = TRUE where datname = ‘template_postgis’;

Nos conectamos a la nueva base de datos:

\c template_postgis

Agregamos las extensiones de PostGIS y le damos acceso a las tablas espaciales a todos:

CREATE LANGUAGE plpgsql ;

\i /usr/share/postgresql-8.3-postgis/lwpostgis.sql;

\i /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql;

GRANT ALL ON geometry_columns TO PUBLIC;

GRANT ALL ON spatial_ref_sys TO PUBLIC;

Restringimos futuros cambios en la base de datos:

VACUUM FREEZE;

Y con eso hemos terminado.

Fuentes:

Final steps installing PostGIS on Ubuntu para la creación del template.

Comments

Comment from raul
Time 2010.04.19 at 08:19

gracias, estaba buscando esto hace 2 días

Write a comment





To submit your comment, click the image below where it asks you to... Clickcha - The One-click Captcha