How to install Postgresql-9.3.5/9.4 and PostGIS-2.1 on Ubuntu 15.04 in six easy steps.

Install Ubuntu 15.04 (Vivid Vervet)


1. check your Ubuntu version:-

lsb_release -a

Install Postgresql


2. On the server or your PC (Terminal):-

sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib

Create a database and a user for access


Replace DATABASE_NAME_HERE and USER_NAME_HERE with the values you want to use.
# this will prompt you for a database password...also note the capital letter 'O' not number '0' (zero) below:-

3. sudo -u postgres createuser -P USER_NAME_HERE
sudo -u postgres createdb -O USER_NAME_HERE DATABASE_NAME_HERE

Test Connection to Postgresql


4. psql -h localhost -U USER_NAME_HERE DATABASE_NAME_HERE

Postgresql will ask you for your password. Then you should see the following:

psql (9.3.5)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

DATABASE_NAME_HERE=>

To exit type:-

\q

To add PostGIS-2.1 support to the database


5. sudo apt-get install -y postgis postgresql-9.4-postgis-2.1
# typing 'postgresql-9.3' instead of postgresql-9.4 above will fail.

sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" DATABASE_NAME_HERE

6. Finally... install PgAdmin3 and set your 'service' connections

My thanks to Jon Saints for his original post dated from 13th August 2014 (for Ubuntu 14.04)
http://www.saintsjd.com/2014/08/13/howto-install-postgis-on-ubuntu-trusty.html
http://www.github.com/saintsjd
http://facebook.com/saintsjd

Comments

Popular posts from this blog

Qgis-server...Installing the QGIS Lizmap Plugin & Lizmap Web Client

Install QGIS 3.22 LTS with QGIS-SERVER-3.22 and Apache2 on Ubuntu 22.04 LTS

Qgis-server...Installation on Ubuntu 16.04 LTS