[GIS] Yum install postgis on CentOS 7

centospostgispostgresql

I have been struggling to install PostGIS on my Redhat Linux based CentOS 7 (x64) machine and so far I am still running into problems. I used this step by step tutorial developed by Regina at PostgreSQL Online to install PostgreSQL 9.5 and PostGIS and everything seems to be fine until I started installing PostGIS. I am running into dependencies problems! After installing PostgreSQL 9.5, when I typed this command:

# sudo yum install postgis2_95 postgis2_95-client

I am getting these dependency errors:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.crc.dk
* epel: ftp.crc.dk
* extras: ftp.crc.dk
* updates: ftp.crc.dk
Resolving Dependencies
--> Running transaction check
---> Package geos-devel.x86_64 0:3.5.0-1.rhel7 will be installed
--> Processing Dependency: geos = 3.5.0-1.rhel7 for package: geos-devel-3.5.0-1.rhel7.x86_64
--> Running transaction check
---> Package geos.x86_64 0:3.4.2-2.el7 will be updated
--> Processing Dependency: libgeos-3.4.2.so()(64bit) for package: grass-6.4.4-7.el7.x86_64
--> Processing Dependency: libgeos-3.4.2.so()(64bit) for package: grass-libs-6.4.4-7.el7.x86_64
---> Package geos.x86_64 0:3.5.0-1.rhel7 will be an update
--> Finished Dependency Resolution

Error: 
Package: grass-libs-6.4.4-7.el7.x86_64 (@epel)         
    Requires: libgeos-3.4.2.so()(64bit)
Removing: geos-3.4.2-2.el7.x86_64 (@epel)
libgeos-3.4.2.so()(64bit)          
Updated By: geos-3.5.0-1.rhel7.x86_64 (pgdg95)
    ~libgeos-3.5.0.so()(64bit)      
Available: geos-3.4.2-1.rhel7.x86_64 (pgdg94)        
libgeos-3.4.2.so()(64bit)
Available: geos-3.2.2-2.el6.x86_64 (elgis)        
~libgeos-3.2.2.so()(64bit)        
Available: geos-3.3.0-1.el6.x86_64 (elgis)        
~libgeos-3.3.0.so()(64bit)       
Available: geos-3.3.1-2.el6.x86_64 (elgis)       
~libgeos-3.3.1.so()(64bit)       
Available: geos-3.3.6-1_0.el6.x86_64 (elgis)           
~libgeos-3.3.6.so()(64bit)      
Available: geos-3.3.8-2.el6.x86_64 (elgis)             
~libgeos-3.3.8.so()(64bit)

Error: Package: grass-6.4.4-7.el7.x86_64 (@epel)           
Requires: libgeos-3.4.2.so()(64bit)          
Removing: geos-3.4.2-2.el7.x86_64 (@epel)
libgeos-3.4.2.so()(64bit)        
Updated By: geos-3.5.0-1.rhel7.x86_64 (pgdg95)             
~libgeos-3.5.0.so()(64bit)           
Available: geos-3.4.2-1.rhel7.x86_64 (pgdg94)
libgeos-3.4.2.so()(64bit)
Available: geos-3.2.2-2.el6.x86_64 (elgis)
~libgeos-3.2.2.so()(64bit)
Available: geos-3.3.0-1.el6.x86_64 (elgis)
~libgeos-3.3.0.so()(64bit)
Available: geos-3.3.1-2.el6.x86_64 (elgis)
~libgeos-3.3.1.so()(64bit)
Available: geos-3.3.6-1_0.el6.x86_64 (elgis)
~libgeos-3.3.6.so()(64bit)       
Available: geos-3.3.8-2.el6.x86_64 (elgis)
~libgeos-3.3.8.so()(64bit)
You could try --skip-broken to work around the problem.

Could anyone help me out to resolve these dependency issues or point out whether I am doing something wrong?

Best Answer

You may also compile from source (so you do not mess rpms)

wget https://download.osgeo.org/postgis/source/postgis-2.4.4.tar.gz
tar xvzf postgis-2.4.4.tar.gz
cd postgis-2.4.4
./configure --with-pgconfig=/usr/pgsql-9.5/bin/pg_config
make
make install

Install the following dependencies before compiling:

yum install geos-devel.x86_64
yum install proj-devel.x86_64
yum install gdal-devel.x86_64
yum install libxml2-devel.x86_64
yum install json-c-devel.x86_64