wiki:UsersWikiPostGIS20CentOS6pgdg

How to install PostGIS 2.0 on CentOS 6 from packages

This installation method uses YUM packages maintained by Devrim GUNDUZ of the PostgreSQL Global Development Group (PGDG). For an overview of installing PostgreSQL using this method, see other details at http://wiki.postgresql.org/wiki/YUM_Installation.

Additional packages from EPEL 6 (Extra Packages for Enterprise Linux) are required to fulfill requirements for GDAL.

Configure YUM

Log into the system with root access. These instructions assume that you are using a command-line editor vi, however use whatever text utility you are comfortable with.

Open the first file for editing:

vi /etc/yum.repos.d/CentOS-Base.repo

On line 19, at the end of the [base] section, insert:

exclude=postgresql*

and near line 28 at the end of the [updates] section, insert again:

exclude=postgresql*

Save and close the file (with vi, press "esc" to go to command-mode, then type :wq).

Download and install PGDG Repository RPM file

A PGDG RPM Repository RPM needs to be downloaded for your platform and your PostgreSQL version requirements (you can choose the later). Find the correct RPM file for your system from here: http://yum.postgresql.org/repopackages.php

For example, if you have a 64-bit OS and want to install PostgreSQL 9.2:

curl -O http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
rpm -ivh pgdg-centos92-9.2-6.noarch.rpm

A second repository, EPEL 6, is required for additional packages for GDAL. For all platforms, download the epel-release-6-7.noarch file from http://download.fedoraproject.org/pub/epel/6/i386/repoview/epel-release.html which will select your local mirror. Install the RPM:

curl -O http://<some mirror>/linux/fedora/fedora-epel/6/i386/epel-release-6-7.noarch.rpm # update this!
rpm -ivh epel-release-6-7.noarch

Install PostGIS

Install everything with:

yum install postgresql92-server postgis2_92

Now perform a few post-installation setup commands, in the order: (1) Initialize the database cluster (required), (2) start database (recommended, if you want to use it straight away), (3) allow it to start-up automatically on reboot (recommended):

service postgresql-9.2 initdb
service postgresql-9.2 start
chkconfig postgresql-9.2 on

Spatially enabling a database

Spatially enabling a database using extensions is a new feature of PostgreSQL 9.2.

Connect to your database using pgAdmin or psql, and run the following commands. To add postgis with raster support:

CREATE EXTENSION postgis;

To add topology support, a second extension can be created on the database:

CREATE EXTENSION postgis_topology;
Last modified 10 years ago Last modified on Jan 11, 2014, 12:50:20 PM
Note: See TracWiki for help on using the wiki.