Skip to content

Installing PostgreSQL on Windows

This guide covers PostgreSQL installation on Windows. Continue only when you need a standalone database for advanced deployment, external database management, or troubleshooting.

Before starting the installation, make sure your situation matches one of these cases:

  • You plan to connect HagiCode to an external PostgreSQL database
  • You are following an advanced deployment path outside the default local setup
  • You need to install and maintain a standalone PostgreSQL instance manually

Also ensure:

  • You are using Windows 10 or higher
  • You have administrator privileges to install software
  • Your hard drive has at least 500MB of available space
  1. Visit the EnterpriseDB PostgreSQL Download Page
  2. Select the PostgreSQL version you need (recommended to use the latest stable version)
  3. Select the operating system as “Windows”
  4. Download the installer suitable for your system:
    • x86-64 (Recommended): For 64-bit Windows systems
    • x86-32: For 32-bit Windows systems
  5. Run the downloaded .exe installer

After double-clicking the installer, you will see the PostgreSQL installation wizard interface.

Launch Setup Wizard

Click “Next” to continue the installation process.

Choose the PostgreSQL installation directory. The default installation path is C:\Program Files\PostgreSQL\16.

Choose Install Location

Click “Next” to continue.

Select the components to install. By default, the following components are selected:

  • PostgreSQL Server - Database server
  • pgAdmin 4 - Graphical management tool
  • Stack Builder - Package manager
  • Command Line Tools - Command line tools

Select Components

It is recommended to keep the default selections and click “Next” to continue.

Specify the database data storage directory. The default path is C:\Program Files\PostgreSQL\16\data.

Choose Data Directory

Click “Next” to continue.

Step 5: Set Password for Initial Database User

Section titled “Step 5: Set Password for Initial Database User”

Set the password for the PostgreSQL superuser (postgres). This is the database administrator password, please keep it safe.

Set Password

:::warning Security Recommendations

  • Use a strong password (at least 8 characters, containing uppercase, lowercase, numbers, and special characters)
  • Do not forget this password, as you will need it when connecting to the database
  • Do not use simple passwords in production environments :::

Click “Next” to continue.

Set the port that the PostgreSQL service will listen on. The default port is 5432.

Set Port

Click “Next” to continue.

Step 7: Set Database Locale and Character Set

Section titled “Step 7: Set Database Locale and Character Set”

Set the database locale and character set.

Set Character Set

Click “Next” to continue.

The installer will display a summary of all configuration information. Please carefully review:

  • Installation path
  • Data directory
  • Port number
  • Locale settings

Review Summary

After confirming the information is correct, click “Next” to start installation.

The installer is now ready to begin copying files and configuring the system.

Ready to Install

Click “Next” to start the installation process.

The installer will display an installation progress bar. This process may take a few minutes.

Installation Progress

Please wait patiently for the installation to complete.

After installation completes, you will see the success prompt interface.

Installation Complete

Uncheck “Launch Stack Builder at exit?” (unless you need additional extensions) and click “Finish” to exit the installation wizard.

If you are setting up HagiCode with an external database, continue with the main installation flow after PostgreSQL is ready:

If you only want the latest default HagiCode local setup, you typically do not need to continue with PostgreSQL installation at all.