How to Download and Install PostgreSQL on Windows

In this PostgreSQL tutorial, we are diving into the realm of database management by demonstrating how to install PostgreSQL on a Windows operating system. We will follow the following steps:

  • Step 1: Download PostgreSQL
  • Step 2: Begin Installation
  • Step 3: Select Components
  • Step 4: Choose Installation Data Directory
  • Step 5: Set a Password
  • Step 6: Set the Port Number
  • Step 7: Choose the Locale
  • Step 8: Install

Step 1: Download PostgreSQL

From the official PostgreSQL website, first download the Windows installer. The webpage can be found on Community DL Page (enterprisedb.com) as of this writing. Make sure to choose the appropriate distribution and version for your Windows.

PostgreSQL Installation on Windows Download PostgreSQL
PostgreSQL Installation on Windows Download PostgreSQL

Step 2: Begin Installation

Run the installer after downloading the file. The installation process will be walked you through by a setup wizard. To proceed, select “Next”.

Then choose the desired installation directory.

PostgreSQL Installation on Windows Download PostgreSQL Installation Directory
PostgreSQL Installation on Windows Download PostgreSQL Installation Directory

Step 3: Select Components

You will then be prompted to choose the components you want to install. I advise adding the following components to a basic installation:

  • PostgreSQL Server: The database server itself is called PostgreSQL Server.
  • pgAdmin 4: A web-based PostgreSQL management tool is pgAdmin 4. It’s excellent for visually managing your databases.
  • Command Line Tools: If you intend to connect with the database using command-line-based tools, these are helpful.
  • Stack Builder: The PostgreSQL installation package includes the Stack Builder, which acts as a master installer for any extra packages you might want when using PostgreSQL.
PostgreSQL Installation on Windows Download PostgreSQL Select Components
PostgreSQL Installation on Windows Download PostgreSQL Select Components

Step 4: Choose Installation Data Directory

The data installation directory for PostgreSQL is then yours to choose. For most users, the default directory should be acceptable. Select what you want, then click “Next”.

PostgreSQL Installation on Windows Download PostgreSQL Choose Installation Data Directory
PostgreSQL Installation on Windows Download PostgreSQL Choose Installation Data Directory

Step 5: Set a Password

This action must be taken. The ‘postgres’ user, a superuser account in PostgreSQL, is having its password changed. Make a strong password choice and store it securely. To access the database, you must have this password. After entering your password, select “Next”.

PostgreSQL Installation on Windows Download PostgreSQL Set Password
PostgreSQL Installation on Windows Download PostgreSQL Set Password

Step 6: Set the Port Number

PostgreSQL’s standard port is 5432. Unless there is a problem with other applications or you have unique requirements, you’re usually fine leaving this at the default level. To proceed, click “Next”.

PostgreSQL Installation on Windows Download Set the Port Number
PostgreSQL Installation on Windows Download Set the Port Number

Step 7: Choose the Locale

You should generally leave the locale set to its default value. This will control your database’s language, sort order, and date format, among other things. Click “Next” once you have chosen your choice.

PostgreSQL Installation on Windows Download Choose the Locale
PostgreSQL Installation on Windows Download Choose the Locale

Step 8: Install

You can now begin installing PostgreSQL! The installation will start after pressing the “Next” button. Please feel free to get a cup of coffee because this could take a little while.

PostgreSQL Installation on Windows Download PostgreSQL Install
PostgreSQL Installation on Windows Download PostgreSQL Install

You see the Ready to Install wizard, then click on the “Next” button.

PostgreSQL Installation on Windows Download PostgreSQL Ready to Install
PostgreSQL Installation on Windows Download PostgreSQL Ready to Install

You will see the install progress wizard as shown in the below picture.

PostgreSQL Installation on Windows Download Installing
PostgreSQL Installation on Windows Download Installing

Step 9: Completing the Installation

The wizard will show a final screen after the installation is finished. Make sure the option to start Stack Builder when you quit is not selected (unless you want to add further drivers or tools). To end the wizard, click “Finish”.

Congratulations! PostgreSQL has been successfully installed on Windows.

PostgreSQL Installation on Windows Download Completing the Installation
PostgreSQL Installation on Windows Download Completing the Installation

You can launch the pgAdmin 4 utility from your list of installed programs to check the installation.

PostgreSQL Installation on Windows Download Opening pgAdmin
PostgreSQL Installation on Windows Download Opening pgAdmin

Your chosen “postgres” user password from the installation process will be required. If everything was installed properly, you ought to be able to connect to the PostgreSQL server and begin building databases.

PostgreSQL Installation on Windows Download Opening Checking pgAdmin
PostgreSQL Installation on Windows Download Opening Checking pgAdmin

Conclusion

In this PostgreSQL tutorial, we’ve walked you through the steps to install PostgreSQL on your Windows machine. Now, you’re ready to dive into the world of SQL and start managing your data.

You may like to read: