Install Postgis on CentOS
pg
- Sources
- Install packages
- Installing osm2psql
- Issues
- Initialize PGDATA
- Autostart
- Manual Start
- Test Install
- Configure
A few instructions on how to install PostGIS on CentOS 7
Sources
Install packages
sudo yum install postgresql10-server
sudo yum install postgresql10-contri
sudo yum install bc htop atop screen
sudo yum install postgis25_10
sudo yum install postgis25_10-client
Installing osm2psql
sudo yum install osm2pgsql
This failed due to conflict with geos … so build from source github instead.
sudo yum install git
git clone git://github.com/openstreetmap/osm2pgsql.git
sudo yum install cmake make gcc-c++ boost-devel expat-devel zlib-devel bzip2-devel postgresql-devel proj-devel proj-epsg lua-devel
cd osm2pgsql
mkdir build && cd build
cmake ..
make
sudo make install
Issues
ERROR: could not load library "/usr/pgsql-10/lib/postgis-2.5.so": /usr/pgsql-10/lib/postgis-2.5.so: undefined symbol: GEOSFrechetDistanceDensify
In my case ‘yum remove geos36’ solved it.
Initialize PGDATA
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
Autostart
sudo systemctl enable postgresql-10.service
Manual Start
service postgresql-10 start
Test Install
sudo -u postgres psql
Configure
On centos,
postgresql.conflives at/var/lib/pgsql/10/data/postgresql.confpg_hba.conflives atpg_hba.conf/var/lib/pgsql/10/data/pg_hba.conf