[In English]
He tenido que instalar PostgreSQL/PostGIS, esta vez en una máquina con Debian Wheezy. Estas son las diferencias respecto a la instalación en Xubuntu 14.04:
- La versión de PostgreSQL que hay disponible en el Synaptic para este Debian es la 9.1. Estos son los paquetes instalados, comparados con los que instalé en la versión 9.3:
- postgresql-server-dev-9.1
- postgresql-doc-9.1
- postgresql-client-9.1
- postgresql-client-common
- postgresql-9.1-postgis
- postgresql-9.1-postgis-2.1-scripts: no está en el repositorio.
- libpq-dv: no está en el repositorio.
- postgresql-common: ya estaba instalada.
- libpq5: ya estaba instalada.
- postgresql-doc: no está en el repositorio, pero está instalada postgresql-doc-9.1
- postgresql-client: no está en el repositorio, pero está instalada postgresql-client-9.1
- libreoffice-base-drivers: no está en el repositorio, pero están instaladas libreoffice-base-core y libreoffice-base
- postgresql-contrib-9.1
- postgis: ya estaba instalada.
- postgresql-9.1: no está en el repositorio.
- postgresql
- liblwgeom: no está en el repositorio.
- La versión de PostGIS en el repositorio es la 1.5.3-2. Esto implica que no se puede añadir directamente como extensión, sino que hay que crear una plantilla o template (que es una base de datos que alberga las funciones PostGIS). En este enlace y en este otro se puede encontrar ayuda muy útil; los pasos que yo he seguido para crear la template a partir de ellos son los siguientes:
- Crear la plantilla
- sudo -u postgres createdb template_postgis
- sudo -u postgres psql -d template_postgis -c “UPDATE pg_database SET datistemplate=true WHERE datname=’template_postgis'”
- sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
- sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
- Crear la base de datos con dicha plantilla
- sudo -u postgres createdb -T template_postgis mibasedatos
(pgAdmin debe estar cerrado, si no, da error indicando que otro usuario está utilizando template_postgis)
- sudo -u postgres createdb -T template_postgis mibasedatos
- Crear la plantilla
I had to install PostgreSQL/PostGIS, though this time in a Debian Wheezy computer. These are the differences regarding to the installation in Xubuntu 14.04:
- In Debian Wheezy, Synaptic offers PostgreSQL 9.1. These are the packages I have installed, compared to those I installed in version 9.3:
- postgresql-server-dev-9.1
- postgresql-doc-9.1
- postgresql-client-9.1
- postgresql-client-common
- postgresql-9.1-postgis
- postgresql-9.1-postgis-2.1-scripts: not in Synaptic.
- libpq-dv: not in Synaptic.
- postgresql-common: it is installed.
- libpq5: it is installed.
- postgresql-doc: not in Synaptic, but postgresql-doc-9.1
is installed. - postgresql-client: not in Synaptic, but postgresql-client-9.1
is installed. - libreoffice-base-drivers: not in Synaptic, but libreoffice-base-core and libreoffice-base are installed.
- postgresql-contrib-9.1
- postgis: it is installed.
- postgresql-9.1: not in Synaptic.
- postgresql
- liblwgeom: not in Synaptic.
- The PostGIS version in Synaptic is 1.5.3-2. This means that it cannot be added directly as an extension, but as a template (i.e., a database that stores PostGIS functions). In this this link and in this other you can find very useful information about how to create a template; using that information, these are the steps I have followed for creating my template:
- Template creation
- sudo -u postgres createdb template_postgis
- sudo -u postgres psql -d template_postgis -c “UPDATE pg_database SET datistemplate=true WHERE datname=’template_postgis'”
- sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
- sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
- Database creation using that template
- sudo -u postgres createdb -T template_postgis mydatabase
(pgAdmin must be closed; if not, an error arises noting that other user is using template_postgis)
- sudo -u postgres createdb -T template_postgis mydatabase
- Template creation