Owen Phillips
Owen Phillips in Tutorials
Sun Jul 21 2019 · 5 min read

How to Install PostgreSQL on Windows

Installing PostgreSQL on Windows for the first time can be a little intimidating and you might be left wondering if you even did it right. Follow this guide and rest assured you will have a properly installed PostgreSQL database on Windows.
How to Install PostgreSQL on Windows

Step 1 - Download PostgreSQL

Head on over to EntrepriseDB.com and download the latest version of Postgres for your version of windows.

Download PostgreSQLDownload PostgreSQL

Note: If you were to go to postgresql.org and follow the download links, the EntrepriseDB.com installation would be one of them and we feel it is the best (mainly because it comes with pgAdmin).

Step 2 - Install PostgreSQL

Now that Postgres is downloaded, run the file to start the installation process.

Allow changes

Just like any other executable file you download, you will be asked if you want to "allow this app to make changes to your pc".

Install PostgreSQL allow changesInstall PostgreSQL allow changes

Click Yes.

Welcome

Install PostgreSQL welcomeInstall PostgreSQL welcome

Nothing to see here, just click Next.

Choose Installation Directory

Choose where you want to install PostgreSQL.

Install PostgreSQL directoryInstall PostgreSQL directory

click Next.

Select Components to Install

Select what components to install (If you're not sure, it's fine to install everything).

Install PostgreSQL componentsInstall PostgreSQL components

Click Next.

Choose a Data Directory

Choose where to store your database.

Install PostgreSQL data directoryInstall PostgreSQL data directory

Tip: If this PostgreSQL install is just for developing and testing on your local machine, you can leave this as it is. But when using PostgreSQL in production, having the ability to keep your databases separate from your PostgreSQL server is very useful. Databases grow over time and using another storage medium (such as block storage on digital ocean) gives you more flexibility as they grow.

Set a Password for the Default User

PostgreSQL comes with a default user and database called postgres. Set the password for that user here.

Install PostgreSQL set passwordInstall PostgreSQL set password

Note: You can change this password later through the psql shell using the SQL language.

Select a Port

Choose the port that your projects will connect to the PostgreSQL server on. This can be almost any port you'd like but you will see most people using the default 5432.

Install PostgreSQL select portInstall PostgreSQL select port

Select a locale

You will probably want this to be the language you speak in your home country.

Install PostgreSQL select localeInstall PostgreSQL select locale

Pre Install Summary

Before clicking Next, just make sure all the settings are how you want them.

Install PostgreSQL summaryInstall PostgreSQL summary

Install PostgreSQL

Click Next to start installing. This will take a few minutes while the PostgreSQL server and tools are installed and the PostgreSQL server is started.

Install PostgreSQL nowInstall PostgreSQL now

Install PostgreSQL installingInstall PostgreSQL installing

Complete the PostgreSQL Setup

When the installation finishes, if you had chosen to install the stack builder component earlier in this tutorial you will be shown the following screen. Most developers new to PostgreSQL won't need the tools that come with stack builder until they get more comfortable with it. Uncheck the box and click Finish.

Install Postgres stack builderInstall Postgres stack builder

Conclusion

That's it! That is all there is to installing a real working PostgreSQL database server on your windows machine. You are now ready to connect to it and store your projects data! Don't know where to start next? Check out our basic windows setup tutorial for PostgreSQL to get you going.