In this tutorial we will be continuing what we were doing in Part 1, by installing PostGIS for PostgreSQL 9.1. As well as creating our database and user for our WATERWATCH application. We will then configure and install PostGIS extensions onto our database to enable it to store spatial data.
If you want to check out the video, click on the link below. Remember to Like and Subscribe and hit the Notification button to make sure you're aware of the latest video we will publish.
Smart Map In Python Tutorial Series - Installing PostgreSQL and PostGIS Part 2 (Video)
Bubble plot on open street map |
Step 1: Open your Ubuntu Linux Terminal
Press CTRL + ALT + T
Step 2: Switch to root user account
~$ sudo bash
Step 3: Install PostGIS
~$ sudo apt-get install postgis postgresql-9.6-postgis-2.3
Step 4: Install pgrouting
~$ sudo apt-get install postgresql-9.6-pgrouting
Step 5: Enter the psql command line interface in full admin mode
~$ sudo -i -u postgres
Step 6: While in the psql command line, create the database
~$ createdb cptwater
Step 7: While in the psql command line, create a user
~$ createuser -s waterwatch -P
optional: my password for the user is postgres, for simplicity's sake. It will be easier to remember while we are developing the application.
Step 8: Open the cptwater database in the psql commandline
~$ psql cptwater
Step 9: Grant all privileges on the cptwater databse to the waterwatch user
~$ grant all privileges on database cptwater to waterwatch;
Step 10: Add GIS extensions to the cptwater database
~$ CREATE EXTENSION postgis;
~$ CREATE EXTENSION postgis_topology;
Step 11: Exit the psql shell
~$ \q
Step 12: Exit full admin mode
~$ exit
Conclusion
That is about all we need to cover for the second part of the PostgreSQL and PostGIS Installation. I hope you will enjoyed it and it will add some value to the projects you are currently busy with.
Stay tuned for the next tutorial in the Smart Map in Python Tutorial Series where we will be installing Python Django in a Virtual Environment.