Complete Beginner Guide to Install PostgreSQL + Apache AGE on Windows 10 Pro with WSL2 Part-1
Tags: postgres, apacheage, windows, database
Published: 2023-06-16 18:45:26

This guide aims to assist you in installing PostgreSQL and seamlessly integrating it with Apache AGE on your Windows system. It is designed to provide a step-by-step walkthrough, ensuring a straightforward installation process. While there is an informative [YouTube](https://www.youtube.com/watch?v=ddk8VX8Hm-I&ab_channel=MatheusFarias) video available, I personally encountered some minor difficulties while following it. Hence, this guide aims to simplify the process further.

Let me provide you with the information upfront: **Apache AGE** _does not currently support_ **Windows**, so we will need to use **Linux** instead. Additionally, to install **WSL2**, you will need a _minimum_ of 

- Windows 10 May 2020 (2004), Windows 10 May 2019 (1903), or Windows 10 November 2019 (1909) versions. 
- Your computer must also have **Hyper-V Virtualization** support. 

You can check your Windows version by searching for _"winver"_ in the search bar.

**It is highly unlikely that anyone reading this guide would not meet the mentioned requirements. However, if you happen to not meet the requirements, you can still follow another guide that demonstrates the installation using WSL1.**

There are various methods available to install the mentioned software. However, in my case, I chose to directly use **WSL2** in Windows without installing _Docker_ or setting up a _dual-boot_ system with Linux.

---------------------------------------------------------------

## Install WSL2

**Assumption:** _You have installed newer versions of Windows, for further procedure,_

For WSL2, run **cmd as administrator** and type `wsl.exe --install`, as shown below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2dpp2a9ee712sfovnh23.png)
After this wait for few minutes, until linux have completely installed.

**Note: Restart the System**

After restart, automatically linux will start and setup unix in that terminal, further it will prompt to enter **username** and **password**. 

Hurrah! **WSL2** has been successfully installed in your system.  

----------------------------------------------------------------

## A very Important step before Installing Postgres-SQL

Before moving forward, make sure to download the **required dependencies** by running the command `sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison` 

> Failing to do so may require you to **repeat** the process and **reinstall** PostgreSQL again.

----------------------------------------------------------------

## Install Postgres-SQL

As per the documentation, versions **11**, **12**, and **13** of PostgreSQL are supported and can be installed on _Ubuntu_ using the command `sudo apt install postgresql-11 postgresql-server-dev-11` for version 11, for example. However, I encountered difficulties when attempting this method, so I had to resort to manually downloading the source code and installing it. To do this, you can download the source code from the [PostgreSQL](https://www.postgresql.org/ftp/source/), and I recommend getting version **11.18**. Make sure to download the **tar.gz** file.

Next, you will need to navigate to the location of the _tar.gz_ file in your Linux terminal and copy it to your Linux environment's home directory. In my case, I downloaded the tar.gz file to the "Downloads" folder. Therefore, I recommend to follow below steps:

**Step:1**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ltt6k9v0xwe6tkjg39j.png)

**Step:2**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pq3dxz0up0pv6vli1p3.png)

**Step:3**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7x2473n0zpmn8a3hvvh.png)

**Step:4**

Now, navigate back to the **home directory**, type `cd` in the terminal. Once there, you can unzip the **tar** file using the command 
`tar -xzf postgresql-11.18.tar.gz`

**Step:5**

Navigate inside the unzipped folder and run the command `./configure --prefix=$(pwd) --enable-cassert --enable-debug CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer"`. After this, you will see a _**makefile**_ in your folder, now run the command `make install` to install.

Hurrah! **Postgres-SQL** has been successfully installed in your system.

**Verification Step:**

You can verify it by navigating to the **bin** folder inside your PostgreSQL installation and typing the command `./psql --version`.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lnl1qy2ncxyuvy3i7l1k.png)

----------------------------------------------------------------

## Install Apache-AGE

Now, clone the Apache AGE repository into the home directory. Therefore, I recommend to follow below steps:

**Step:1**

`git clone https://github.com/apache/age.git`

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oeblkmnyieq4e4bldjzz.png)

**Step:2**

Now, `cd` into the cloned folder and run the command `sudo make PG_CONFIG=~/postgresql-11.18/bin/pg_config install`. 

**Note:** The argument to PG_CONFIG here, is the location of the pg_config file of your PostgreSQL installation. Since, I unzipped the PostgreSQL source code directly into the home folder.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vk0a0elwmeysalvvd26e.png)

Hurrah! **Apache-AGE** has been successfully installed in your system.

-------------------------------------------------------------

Hurrah! **Postgre-SQL and Apache-AGE** has been successfully installed in your system. Start studying more about [postgresql](https://www.interdb.jp/pg/)

I hope, this blog has helped you for successful installation.

For further installation, see [Part-2](https://dev.to/vkt1271/complete-beginner-guide-to-install-post-apache-age-setup-apache-viewer-on-windows-10-pro-with-wsl2-part-2-cde).