How to install Postgresql and Postgis in Windows 10 with WSL and Debian – Tutorial

Hydrate

The normal method to install Postgresql and Postgis requires the set up of several binaries and the workflow is usually on graphical user interfaces (GUI). We wanted to come with a way to install Postgresql and Postgis in Windows 10 while keeping the shell experience from Linux. This tutorial shows the procedure to install the database inside a Debian application (it could be Ubuntu as well) in Windows 10 that can actually be accessible from QGIS.

Instructions

Enable Windows Subsystem for Linux (WSL) following the Manual Installation Steps from this link:

https://docs.microsoft.com/en-us/windows/wsl/install-win10

Install Debian or Ubuntu from the Windows Store

Insert username: “hatari” and password: “labs”

Update the Debian repositories:

sudo apt update

Install postgis that actually install postgresql 11:

sudo apt install postgis

Check status of postgresql:

sudo service postgresql status

Start postgresql engine:

sudo service postgresql start

Check postgresql version:

psql –version

Enter psql as user postgres

sudo -u postgres psql

Create user:

CREATE USER gis WITH PASSWORD ‘gis’;

Create database:

CREATE DATABASE geodatabase OWNER gis;

Change to the geodatabase:

c geodatabase;

Enable postgis on database:

CREATE EXTENSION postgis;

Check the created files:

dt

On CMD check that the port 5432 is working running as Administrator:

netstat -ab

Open QGIS and connect to Postgres as:

Tutorial

 

—————
TRANSCOM ISPFree Sigma HSE Email
Level 6 Domain Names are FREE – Register Now.

Related Posts