CENTOS 7
Reference:
Pick a release from here:
http://yum.postgresql.org/repopackages.php
Add the following postgres repo:
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm
Install ifconfig:
sudo yum install net-tools
Install packages:
sudo yum install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib postgresql93-devel
Install needed epel repo:
sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
Install postgis and pgrouting extensions:
sudo yum install postgis2_93
sudo yum install pgrouting_93
Edit pg_hba.conf to allow network users to login:
vim /var/lib/pgsql/9.3/data/pg_hba.conf
# add the following
host all all 0.0.0.0/0 md5
Edit the postgresql.conf to allow hosts to connect from anywhere:
vim /var/lib/pgsql/9.3/data/postgresql.conf
# change the listen address
listen_addresses = '*'
Init the database:
/usr/pgsql-9.3/bin/postgresql93-setup initdb
Restart the service:
sudo systemctl restart postgresql-9.3.service
Get status:
sudo service postgresql-9.3 status
Create a database:
[vagrant@localhost ~]$ sudo -u postgres psql
postgres=# create user testa with password '1234';
CREATE ROLE
postgres=# create database testa with owner testa;
CREATE DATABASE
postgres=# \c testa
You are now connected to database "testa" as user "postgres".
testa=# create extension postgis;
CREATE EXTENSION
testa=# create extension postgis_topology;
CREATE EXTENSION
testa=# SELECT postgis_full_version();
POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released
2014/04/16" LIBXML="2.9.1" LIBJSON="UNKNOWN" TOPOLOGY RASTER
UBUNTU 14.04
Ubuntu Installation:
sudo aptitude update
sudo apt-get install build-essential postgresql-9.3 postgresql-server-dev-9.3 libxml2-dev libgdal-dev libproj-dev libjson0-dev xsltproc docbook-xsl docbook-mathml
sudo aptitude install postgresql-9.3-postgis-2.1
Edit pg_hba.conf to allow network users to login:
vim /etc/postgresql/9.3/main/pg_hba.conf
# add the following
host all all 0.0.0.0/0 md5
Edit the postgresql.conf to allow hosts to connect from anywhere:
vim /etc/postgresql/9.3/main/postgresql.conf
# change the listen address
listen_addresses = '*'
Restart the service:
sudo service postgresql restart
Create a database:
[vagrant@localhost ~]$ sudo -u postgres psql
postgres=# create user testa with password '1234';
CREATE ROLE
postgres=# create database testa with owner testa;
CREATE DATABASE
postgres=# \c testa
You are now connected to database "testa" as user "postgres".
testa=# create extension postgis;
CREATE EXTENSION
testa=# create extension postgis_topology;
CREATE EXTENSION
testa=# SELECT postgis_full_version();
POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released
2014/04/16" LIBXML="2.9.1" LIBJSON="UNKNOWN" TOPOLOGY RASTER