Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL error when trying to create an extension

ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory

Is what I get when I try to CREATE EXTENSION postgis; can anybody tell me why is it so and what can I do to fix it?

like image 347
Xeen Avatar asked Sep 09 '13 10:09

Xeen


People also ask

What is create extension in PostgreSQL?

Description. CREATE EXTENSION loads a new extension into the current database. There must not be an extension of the same name already loaded. Loading an extension essentially amounts to running the extension's script file.

Where can I find PostgreSQL extension?

Listing Installed Extensions Get a list of all the extensions installed on a database by using the \dx command. For example, the output for \dx when run on the Databases for PostgreSQL default database shows the only installed extension.

How do I add an extension to Pgadmin 4?

Click the Definition tab to continue. Use the Definition tab to select the Schema and Version: Use the drop-down listbox next to Schema to select the name of the schema in which to install the extension's objects. Use the drop-down listbox next to Version to select the version of the extension to install.


2 Answers

The following will get you a working postgis install on Ubuntu 12.04 (Note: also tested on 13.10)

echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/postgis.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-client-9.3
sudo -u postgres psql -c 'create extension postgis;'

Based on the docs at https://wiki.postgresql.org/wiki/Apt

like image 186
dwurf Avatar answered Oct 17 '22 03:10

dwurf


You need to install postgresql-9.1-postgis-scripts. In Ubuntu or Debian, you need to run the following command as root:

apt-get install postgresql-9.1-postgis-scripts

This adds the files needed to create the postgis extensions.

like image 26
Roldan Vargas Avatar answered Oct 17 '22 03:10

Roldan Vargas