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.
When to Use This Guide
Section titled “When to Use This Guide”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
Downloading the PostgreSQL Installer
Section titled “Downloading the PostgreSQL Installer”- Visit the EnterpriseDB PostgreSQL Download Page
- Select the PostgreSQL version you need (recommended to use the latest stable version)
- Select the operating system as “Windows”
- Download the installer suitable for your system:
- x86-64 (Recommended): For 64-bit Windows systems
- x86-32: For 32-bit Windows systems
- Run the downloaded
.exeinstaller
Installation Steps
Section titled “Installation Steps”Step 1: Launch the Setup Wizard
Section titled “Step 1: Launch the Setup Wizard”After double-clicking the installer, you will see the PostgreSQL installation wizard interface.

Click “Next” to continue the installation process.
Step 2: Choose Install Location
Section titled “Step 2: Choose Install Location”Choose the PostgreSQL installation directory. The default installation path is C:\Program Files\PostgreSQL\16.

Click “Next” to continue.
Step 3: Select Components
Section titled “Step 3: Select Components”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

It is recommended to keep the default selections and click “Next” to continue.
Step 4: Choose Data Directory
Section titled “Step 4: Choose Data Directory”Specify the database data storage directory. The default path is C:\Program Files\PostgreSQL\16\data.

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.

:::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.
Step 6: Set Database Port
Section titled “Step 6: Set Database Port”Set the port that the PostgreSQL service will listen on. The default port is 5432.

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.

Click “Next” to continue.
Step 8: Review Pre-Installation Summary
Section titled “Step 8: Review Pre-Installation Summary”The installer will display a summary of all configuration information. Please carefully review:
- Installation path
- Data directory
- Port number
- Locale settings

After confirming the information is correct, click “Next” to start installation.
Step 9: Ready to Install
Section titled “Step 9: Ready to Install”The installer is now ready to begin copying files and configuring the system.

Click “Next” to start the installation process.
Step 10: Installation Progress
Section titled “Step 10: Installation Progress”The installer will display an installation progress bar. This process may take a few minutes.

Please wait patiently for the installation to complete.
Step 11: Installation Complete
Section titled “Step 11: Installation Complete”After installation completes, you will see the success prompt interface.

Uncheck “Launch Stack Builder at exit?” (unless you need additional extensions) and click “Finish” to exit the installation wizard.
Next Steps
Section titled “Next Steps”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.