Movatterモバイル変換


[0]ホーム

URL:


You don’t need a vector database - just use Postgres for everything. Read the case study on switching from Pinecone to Neon
PostgreSQL Tutorial
PostgreSQL Tutorial

Install PostgreSQL on Windows

Summary: in this tutorial, you will step by step learn how toinstall PostgreSQL on your local system.

Run PostgreSQL in the Cloud, Free

As an alternative to installing Postgres locally, you can get cloud Postgres in seconds on Neon with a generous free plan. No credit card required.

Get Cloud Postgres

PostgreSQL was developed for UNIX-like platforms, however, it was designed to be portable. It means that PostgreSQL can also run on other platforms such as macOS, Solaris, and Windows.

To install PostgreSQL on Windows, you follow these steps:

  • First, download the PostgreSQL installer for Windows.
  • Second, install PostgreSQL using the installer.
  • Third, add the path to the PostgreSQL’s bin directory to the PATH environment variable.

1) Download PostgreSQL Installer for Windows

First, go to the download page ofPostgreSQL installers on the EnterpriseDB.

Second, download the PostgreSQL for Windows x86-64 version 16.1 (or the latest version). It’ll take a few minutes to complete.

2) Install PostgreSQL on Windows step-by-step

To install PostgreSQL on Windows, you need to have administrator privileges.

Step 1. Double-click on the installer file and an installation wizard will appear and guide you through multiple steps. Hence, you can choose various options based on your preferences for PostgreSQL.

Step 2. Click the Next button

in this tutorial, you will step by step learn how to install PostgreSQL on your local system.Step 3. Specify the installation directory by either choosing your preferred location or using the default folder suggested by the PostgreSQL installer and click the Next button

Step 4. Select software components to install:

  • PostgreSQL Server option allows you to install the PostgreSQL database server
  • pgAdmin 4 option allows you to install the PostgreSQL database GUI management tool.
  • Stack Builder provides a GUI that allows you to download and install drivers that work with PostgreSQL.
  • Command Line Tools option allows you to install command-line tools such aspsql,pg_restore, and so on. These tools allow you to interact with the PostgreSQL database server using the command-line interface.

For tutorials on this website, you can skip installing Stack Builder. Feel free to uncheck it and click the Next button to proceed to the data directory selection:

Step 5. Choose the database directory to store the data, or accept the default directory. Click the Next button to proceed to the next step:

Step 6. Enter the password for the database superuser (postgres).

After entering the password, retype for confirmation, and then click the Next button:

Step 7. Specify a port number on which the PostgreSQL database server will listen. The default port of PostgreSQL is 5432. Ensure that no other applications are using this port.

Step 8. Select the default locale for the PostgreSQL server. If you leave it as the default, PostgreSQL will use the operating system locale. Afterward, click the Next button.

Step 9. The setup wizard will show the summary PostgreSQL information. Review the details, and if everything is correct, click the Next button. Otherwise, click the Back button to adjust the configuration accordingly.

Now, you are ready to install PostgreSQL on your computer. Click theNext button to initiate PostgreSQL installation.

The installation may take a few minutes to complete.

Step 10. Click theFinish button to complete the PostgreSQL installation.

3) Adding bin directory to the PATH environment variable

By adding the bin directory of the PostgreSQL to thePATH environment variable, you enable the execution of common PostgreSQL tools, such asplsql andpg_restore, from any directory without the need to navigate the bin directory first.

First, find the path of thebin directory of the PostgreSQL installation directory. Typically, it is set to the following:

C:\Program Files\PostgreSQL\<version>\bin

The<version> is PostgreSQL’s specific version. For example, if you install PostgreSQL 16, the path to thebin directory will look like this:

C:\Program Files\PostgreSQL\16\bin

Second, open the environment variables:

  • PressWin + R to open the Run dialog
  • Typesysdm.cpl an press Enter. The System Properties dialog will display.
  • Select the Advanced tab and click theEnvironment Variables... button.

You’ll see two sections in theEnvironment Variables window:

  • User variables for [YourUsername]
  • System variables.

Usually, you can edit thePATH variable under theSystem variables section, but if you want to add the path only for your user account, you can edit theUser variables section.

Third, select thePath variable under theUser variables and click theEdit button.

Fourth, in theEdit Environment Variable window, click the New button.

Fifth, enterC:\Program Files\PostgreSQL\16\bin and clickOK to add it to the list of paths.

Finally, click the OK button to close the Environment Variables window and click the OK button to close the System Properties window.

Congratulations! You’ve successfully installed the PostgreSQL database server on your local system. Let’s learn various ways toconnect to the PostgreSQL database server.

Last updated on

Was this page helpful?
Thank you for your feedback!

[8]ページ先頭

©2009-2025 Movatter.jp