Professional Documents
Culture Documents
project=>
Now type \q to exit.
4. Installing Postgis extension to postgresql:
sudo apt-get install -y postgis postgresql-9.3-postgis-2.1
(Note: Please install only 2.1+ versions of postgis because
previous versions do not support some tools that are required to
work with massive databases like TIGER data.)
5. Postgis works as an extension to our main postgresql and
provides additional functionality for spatial operations. To
create extension you must have an administrative permission .
Right now only postgres user has the administrative permission.
Also you do not know the password of postgres user.
5.1 To Change the password of postgres user use password less
login:
sudo -u postgres psql DATABASE_NAME
for example: sudo -u postgres psql project
and then change the password of postgres user:
ALTER USER "postgres" WITH PASSWORD 'new_password';
5.2 Now change the role of YOUR USER:
ALTER ROLE YOUR_USER SUPERUSER;
for example: ALTER ROLE kuldeep SUPERUSER;
5.3 Logout using \q.
5.4 Now login as super user:
psql -h localhost -U YOUR_USER DATABASE_NAME
for example: psql -h localhost -U kuldeep project
5.5 Now create extension Postgis:
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
6. YAY! YOU have done it. :)