Setting up PostgreSQL and PostGIS on Linux Mint

I have just ordered a new home server to store all of my GIS data, so I have put together a quick guide on setting up PostGIS on Linux Mint, setting it up on Ubuntu will be very similar.

PostgreSQL come pre-installed on most Linux distros, so we don’t have to worry about installing it. However we do need to change the password for the default ‘postgres’ user. This can be done with the following:

The command sets the password for the root user ‘postgres’ and sets up your own user account with privileges to create databases and users.

If you get a response of:

Then PostgreSQL is not installed, but can be done using:

To create a database we then simply run:

In my case it was natural_earth. PostGIS is an add-on to a PostgreSQL database that that makes it spatially enabled. To install PostGIS we can launch pgAdmin, which is used to administer PostgreSQL database. As we can see we have the default ‘postgres’ databse and the one just created ‘natural_earth’.


Adding PostGIS to the database we created should be as easy as running the following SQL command in the ‘natural_earth’ database:


Unfortunately while PostgreSQL is automatically installed, PostGIS is not. So it needs to be installed through the Software Manager:


If you cannot find PostGIS it may be due to a missing personal repository, UbuntuGIS. It is a PPA (Personal Package Archive). In Software Manager it can be added from Edit> Software Sources> PPAs> Add a new PPA> ppa:ubuntugis/ppa.

With PostGIS installed we will try the command again:


With a better result. Now we can see ‘postgis’ in the Extensions for our new Database:


 PostGIS topology can be added with the following command.

You are now ready to get started loading in your spatial data.

For those interested, I have purchased a: HP 704941-421 ProLiant Micro Server for home use.


One thought on “Setting up PostgreSQL and PostGIS on Linux Mint

Leave a Reply

Your email address will not be published.