To install PostgreSQL on your computer, go to the official EDB website, download the latest version that matches your operating system, and run the installer.
Once the installer is downloaded, double-click it and follow the on-screen instructions to complete the installation.
Verifying the Installation of PostgreSQL
Once PostgreSQL is installed, it’s important to verify that it is working correctly. There are multiple ways to do this:
- Using Client Applications: You can connect to the database using tools like pgAdmin (a graphical interface) or psql (a command-line shell).
- Quickest Way (Recommended): Use the psql shell, which is installed along with PostgreSQL.
- Steps to Verify via psql Shell:
- Open the psql Shell
- On Windows, search for “psql” in the Start menu or search bar.
- Click and launch the application.
- Enter the Connection Details
- Server → localhost (default)
- Database → postgres (default database created during installation)
- Port → 5432 (default port)
- Username → postgres (or the username you set)
- Password → Enter the password you created during installation
- Run a Test Query
- Once inside the shell, type:
- SELECT version();
- If PostgreSQL is installed correctly, you will see version details displayed (e.g., PostgreSQL 17.6 on x86_64-windows).
- Using pgAdmin4
PostgreSQL also comes with an additional tool called pgAdmin 4. It provides a graphical, user-friendly interface to interact with the database, making it easier to manage and explore compared to using only the command line.Let’s take a closer look at pgAdmin 4 and understand how it works.
-
Select or search pgAdmin4 in window
- Click on Server to open it, Now you need to enter the password that you created when you installed PostgreSQL.
- You should find a database named postgres, right-click it choose the "Query Tool":
- It will open a query tool, we can start executing SQL statements here.
-
We can check the version with this SQL statement:
SELECT version();
- Execute this query:
-