PostgreSQL Tutorial

  • Home
  • Administration
  • Views
  • Triggers
  • Stored Procedures
  • Interfaces
    • PostgreSQL PHP
    • PostgreSQL Python
    • PostgreSQL JDBC
Home / PostgreSQL Tutorial / Install PostgreSQL

Install PostgreSQL

Summary: in this tutorial, we will show you how to install PostgreSQL in your local system for learning and practicing PostgreSQL.

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 Mac OS X, Solaris, and Windows.

Since version 8.0, PostgreSQL offers an installer for Windows systems that makes the installation process easier and faster. For development purpose, we will install PostgreSQL version 9.5  on Windows 10.

NOTE: If you are running the Windows 8 and 10, you need to create a Windows users with administrator role e.g., postgres and use this user to run the installation file. See the troubleshooting section below for the detailed information.

There are three steps to complete the PostgreSQL installation:

  1. Download PostgreSQL installer for Windows
  2. Install PostgreSQL
  3. Verify the installation

Download PostgreSQL Installer for Windows

You need to download the installer from PostgreSQL Official website.

  • Go to the PostgreSQL official website, download section for Windows http://www.postgresql.org/download/windows/
  • Click on the download installer from EnterpriseDB
  • Choose the latest version to download. It takes few minutes to complete the download.

Install PostgreSQL step by step

Double click on the installer file, an installation wizard will appear and guide you through multiple steps where you can choose different options that you would like to have in PostgreSQL.

Install PostgreSQL Step 1

The following illustrates each step and its options for installation. If you install a different version, you may get additional steps.

Start Installing PostgreSQL

Install PostgreSQL Step 2

Specify installation folder, choose your own or keep the default folder suggested by PostgreSQL installer.

Enter the password for the database superuser and service account.

Install PostgreSQL Step 3

Enter the port for PostgreSQL. Make sure that no other applications are using this port. Leave it as default if you are unsure.

Install PostgreSQL Step 4

Choose the default locale used by the database.

Install PostgreSQL Step 5

You’ve completed providing information for the PostgreSQL installer. Click the Next button to install PostgreSQL

Install PostgreSQL Step 7

The installation may take few minutes to complete.

Install PostgreSQL Step 8

Click the Finish button to complete the PostgreSQL installation.

Verify the Installation

There are several ways to verify the installation. You can try to connect to the PostgreSQL database server from any client application e.g.,  psql, pgAdmin, etc.

The quick way to verify the installation is through the pgAdmin application.

First, click on pgAdmin III to launch it. The pgAdmin III GUI will display.

PostgreSQL 95 launch

pgAdmin III

Second, double click on PostgreSQL 9.5 on the object browser. It will ask you for the admin password. Just enter the password you’ve used in the installation step.

Connect to PostgreSQL Server

Third, if everything is fine, the pgAdmin will display all the objects that belong to the server.

PostgreSQL Objects

Congratulation! you’ve successfully installed PostgreSQL database server in your local system. Let’s learn various ways to connect to PostgreSQL database server.

Troubleshooting

In case you receive the following error message while installing PostgreSQL in Windows OS (Windows 8 or Windows 10):

Failed to load sql modules into the database cluster

and the following error message displays:

Error running post install step. Installation may not complete correctly. Error reading C:/Program Files/PostgreSQL/9.5/postgresql.conf

You need to do the following steps:

  1. Uninstall the PostgreSQL and delete the data directory in the installation folder.
  2. Create a new Windows user named postgres and add it to the Administrators group.
  3. Restart your computer.
  4. Open cmd (command prompt) as the postgres command using the following command: runas /user:postgres cmd.exe
  5. A new window appears, you need to run the installer file from this window.
Previous Tutorial: What is PostgreSQL?
Next Tutorial: PostgreSQL Sample Database

PostgreSQL Quick Start

  • What is PostgreSQL?
  • Install PostgreSQL
  • Connect to Database
  • Download PostgreSQL Sample Database
  • Load Sample Database
  • Explore Server and Database Objects

PostgreSQL Fundamentals

  • PostgreSQL Select
  • PostgreSQL Order By
  • PostgreSQL Select Distinct
  • PostgreSQL Where
  • PostgreSQL LIMIT
  • PostgreSQL IN
  • PostgreSQL Between
  • PostgreSQL Like
  • PostgreSQL Inner Join
  • PostgreSQL Left Join
  • PostgreSQL Full Outer Join
  • PostgreSQL Cross Join
  • PostgreSQL Natural Join
  • PostgreSQL Group By
  • PostgreSQL Having
  • PostgreSQL Union
  • PostgreSQL Intersect
  • PostgreSQL Except
  • PostgreSQL Subquery
  • PostgreSQL Insert
  • PostgreSQL Update
  • PostgreSQL Delete
  • PostgreSQL Data Types
  • PostgreSQL Create Table
  • PostgreSQL Alter Table
  • PostgreSQL Drop Table
  • PostgreSQL Truncate Table
  • PostgreSQL CHECK Constraint
  • PostgreSQL Not-Null Constraint
  • PostgreSQL Foreign Key
  • PostgreSQL Primary Key
  • PostgreSQL UNIQUE Constraint

About PostgreSQL Tutorial

PostgreSQLTutorial.com is a website dedicated to developers and database administrators who are working on PostgreSQL database management system.

We constantly publish useful PostgreSQL tutorials to keep you up-to-date with the latest PostgreSQL features and technologies. All PostgreSQL tutorials are simple, easy-to-follow and practical.

Recent PostgreSQL Tutorials

  • PostgreSQL Recursive View
  • Learn PostgreSQL Recursive Query By Example
  • Creating Updatable Views Using the WITH CHECK OPTION Clause
  • PostgreSQL Upsert Using INSERT ON CONFLICT statement
  • How to Generate a Random Number in A Range
  • Using PostgreSQL ADD COLUMN to Add One or More Columns To a Table
  • PostgreSQL Character Types: CHAR, VARCHAR, and TEXT
  • Using PostgreSQL SERIAL To Create Auto-increment Column
  • PostgreSQL Boolean Data Type with Practical Examples
  • Understanding PostgreSQL Timestamp Data Types

More Tutorials

  • PostgreSQL PHP
  • PostgreSQL Python
  • PostgreSQL JDBC
  • PostgreSQL Functions
  • PostgreSQL Resources

Site Info

  • Home
  • About Us
  • Contact Us
  • Privacy Policy

Copyright © 2016 by PostgreSQL Tutorial Website. All Rights Reserved.