Changes between Initial Version and Version 1 of UsersWikiPostGIS21CentOS6pgdg


Ignore:
Timestamp:
09/27/13 01:19:41 (11 years ago)
Author:
Mike Taves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiPostGIS21CentOS6pgdg

    v1 v1  
     1= How to install PostGIS 2.1 on CentOS 6 from packages =
     2
     3This 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.
     4
     5Additional packages from [http://fedoraproject.org/wiki/EPEL EPEL] 6 (Extra Packages for Enterprise Linux) are required to fulfill requirements for GDAL.
     6
     7== Configure YUM ==
     8
     9Log 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.
     10
     11Open the first file for editing:
     12{{{
     13vi /etc/yum.repos.d/CentOS-Base.repo
     14}}}
     15
     16On line 19, at the end of the `[base]` section, insert:
     17{{{
     18exclude=postgresql*
     19}}}
     20
     21and near line 28 at the end of the `[updates]` section, insert again:
     22{{{
     23exclude=postgresql*
     24}}}
     25
     26Save and close the file (with `vi`, press "esc" to go to command-mode, then type `:wq`).
     27
     28== Download and install PGDG RPM file ==
     29
     30A PGDG RPM file 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
     31
     32For example, if you have a 64-bit OS and want to install PostgreSQL 9.3:
     33{{{
     34curl -O http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
     35rpm -ivh pgdg-centos93-9.3-1.noarch.rpm
     36}}}
     37
     38A second repository, EPEL 6, is required for additional packages for GDAL. For all platforms, download the `epel-release-6-8.noarch.rpm` file from http://download.fedoraproject.org/pub/epel/6/i386/repoview/epel-release.html which will select your local mirror. Install the RPM:
     39{{{
     40curl -O http://<some mirror>/linux/fedora/fedora-epel/6/i386/epel-release-6-8.noarch.rpm # update this!
     41rpm -ivh epel-release-6-8.noarch.rpm
     42}}}
     43
     44== Install PostGIS ==
     45
     46Install everything with:
     47{{{
     48yum install postgresql93-server postgis2_93
     49}}}
     50
     51Now 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):
     52{{{
     53service postgresql-9.3 initdb
     54service postgresql-9.3 start
     55chkconfig postgresql-9.3 on
     56}}}
     57
     58== Spatially enabling a database ==
     59
     60Create a new database, e.g.:
     61{{{
     62[root@localhost ~]# su - postgres
     63-bash-4.1$ createdb postgis
     64-bash-4.1$ psql postgis
     65psql (9.3.0)
     66Type "help" for help.
     67
     68postgis=# CREATE EXTENSION postgis;
     69CREATE EXTENSION
     70postgis=# SELECT PostGIS_full_version();
     71                                                                        postgis_full_version
     72
     73---------------------------------------------------------------------------------------------------------------------------------------------------------------------
     74 POSTGIS="2.1.0 r11822" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.6" LIBJSON="UNKNOWN" RASTER
     75(1 row)
     76}}}
     77
     78To add topology support, a second extension can be created on the database:
     79{{{
     80CREATE EXTENSION postgis_topology;
     81}}}