Set up PostgreSQL on WSL2 and Access with pgAdmin on Windows

Chloe Sun
4 min readJan 6, 2021

A super detailed beginner-friendly walk-through

Install PostgreSQL on WSL 2 and Access it through pgAdmin on Windows

Why install PostgreSQL on WSL 2?

Simply because the installation of PostgreSQL on Windows is kind of a pain, and I also use WSL 2 for other development tasks. You can visit my previous post on how to set up WSL 2.

I tried to download from the official website and install PostgreSQL 13.1 for Windows x86–64, and this was the error I couldn’t get rid of — Unable to write inside TEMP environment variable path.

Installation Error Screenshot

After googling, I found a post that might be helpful for others, but it didn’t solve my problem. I was told to download 3rd party distributions and find a standalone version of PostgreSQL, and this installer works for me. This is the workaround if you have experienced the same issue but still want to install it on Windows.

Install PostgreSQL on WSL 2

Here comes the WSL 2, much easier, and you can visit the Windows WSL documentation for more detail.

  1. Open your WSL terminal (ie. Ubuntu 18.04).
  2. Update your Ubuntu…

--

--

Chloe Sun

<Architect | Software Developer | Metaverse Enthusiast> Discord: Architecting the Metaverse https://discord.com/invite/mZjcEbgyEH