It took me quite a lot of time to figure out how do you do that! Though it looks like it is just 3 apt get install command, so simple right? but took quite a toll of my life to figure those 3 out. If you are reading this, probably you are also going through something semilar!
>sudo apt-get install postgresql postgresql-contrib postgis > psql --version psql (PostgreSQL) 9.5.2 > sudo psql --username=postgres --dbname=jobcue -c "CREATE EXTENSION postgis;" Password for user postgres: ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory >sudo apt-get install postgresql-9.5-postgis-2.0 > sudo psql --username=postgres --dbname=jobcue -c "CREATE EXTENSION postgis;" Password for user postgres: ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory > sudo apt-get install postgresql-9.5-postgis-scripts > sudo psql --username=postgres --dbname=jobcue -c "CREATE EXTENSION postgis;" Password for user postgres: CREATE EXTENSION