Install PostreSQL 14 and PostGIS 3 on Ubuntu 22.04 LTS
I always get frustrated when I update my version of Ubuntu to the next LTS and
want to do some development work with the latest stable releases of PostgreSQL
and PostGIS.
I usually trawl a few web sites to find out what has changed but
each time there are slightly different ways of doing the upgrade depending on
where you land and who it is doing it. So...to (hopefully) help other people out wasting half a day or
so here is my solution.
Hope this works for you too...
To completely remove all previous installed versions of Postgresql/PostGIS libraries and docs if there is a previous version:-
:$ sudo apt --purge remove postgresql postgresql-*
:$ sudo apt autoremove
Remove old folders:-
:$ sudo rm -rf /var/lib/postgresql/
:$ sudo rm -rf /var/log/postgresql/
:$ sudo rm -rf /etc/postgresql/
Remove the old 'postgres' user:-
:$ sudo deluser postgres
Restart System:-
:$ sudo shutdown -r now
then:-
Update System after restart:-
:$ sudo apt update && sudo apt upgrade
Install Postgresql-14-postgis-3:-
:$ sudo apt -y install gnupg2
:$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
:$ echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
:$ sudo apt update
:$ sudo apt
install postgis postgresql-14-postgis-3
:$ sudo -i -u postgres
:$ createuser postgis_test
:$ createdb postgis_db -O postgis_test
:$ psql -d postgis_db
:$ sudo -u postgis_test psql postgis_db
:$ postgis_db=# CREATE EXTENSION postgis;
:$ postgis_db=# SELECT PostGIS_version();
Connect to the test database:-
:$ sudo -i -u postgres
:$ postgres@myuser:$ psql -d postgis_db
:$ postgis_db=#
To exit back to your prompt:-
:$ \q
:$ exit
Connect to postgis_db (without a password) or to set/reset a password:-
:$ sudo -u postgres psql postgis_db
:$ postgis_db=# ALTER USER postgis_test WITH PASSWORD 'geometry';
:$ ALTER ROLE
:$ postgis_db=# \q
In QGIS make a new 'PostGIS' connection:-
username: postgis_test
database: postgis_db
host i.p. 127.0.0.1 (local)
password: geometry

I really appreciate that this course is designed for people without prior coding experience. It removes a huge barrier for career changers like myself. The inclusion of fundamental topics like Python and Statistics alongside advanced concepts like CNN and RNN provides a clear, logical progression for building skills from the ground up.
ReplyDeleteWhat stands out is the focus on practical application and final project development. To ensure these projects are scalable and industry-ready, understanding basic deployment and automation principles is very useful. If you are starting your tech journey in Electronic City, combining this with DevOps Training with Placement in Electronic City could be a powerful strategy for career success. Thanks for sharing this resource.