PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.

It supports a large part of the SQL standard and offers many modern features:

  • complex queries
  • foreign keys
  • triggers
  • updatable views
  • transactional integrity
  • multiversion concurrency control

Before you can use PostgreSQL database engine, you need to install it. Depending on your operating system and the distribution you are using PostgreSQL may be already installed. However, for windows users, you will need to install it manually.

Although the installation of PostgreSQL is quite easy, if configured incorrectly, it can cause major problems. In this tutorial, we are going to cover how to install, configure and secure PostgreSQL database.

Navigate to the official PostgreSQL page and download the installer provided by EDB. https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

image-20220624084002958
download-postgresql

We recommend you download the stable version of PostgreSQL. Version 14.4 as of publishing.

Next, launch the installer to start the installation process.

Choose the Installation directory - Ensure you have read/write permissions to the target directory

In the next step, select the component you wish to install. WE recommend to unselect "pgAdmin 4" and "Stack Builder" - As we will install these tools later.

postgresql-select-components

In the next step, select the data directory - Accept the default and proceed.

Now, we need to setup the password for the database superuser postgres. Do not skip the section to secure your database.

postgresql-password

Choose the port which the server should listen on. Choose a port that is not being used by a different process.

postgresql-port

Proceed accepting the defaults and finish the installation process.

Installing pgAdmin 4

PgAdmin is a free, open-source PostgreSQL database administration GUI for Microsoft Windows, Mac OS X, and Linux systems. It offers database server information retrieval, development, testing, and ongoing maintenance. This guide will help you install pgAdmin on Windows. It is assumed that you have already installed PostgreSQL on your computer.

Visit the pgAdmin download page to obtain the most recent version.

pgadmin4-windows-download

Save the installer to your computer and launch it. You'll be greeted with the following screen; click "Next" to continue.

pgadmin4-welcome

Read the license agreement and check the box below it to accept the terms. Click "Next" to continue.

Next, select the installation location. Leave it as default or select a custom location you have Read/Write permissions

Next, follow the installer prompts and finish the installation. You may require to restart the computer before you can use pgAdmin

Using pgAdmin

Before continuing, ensure that you PostgreSQL server is running an listening on the specified port in previous section.

Launch pgAdmin and you'll be directed to the browser window and prompt you to provide the password to secure the pgAdmin interface.

pgadmin4-set-password

Next, on the top-Left side. Select servers and click on PostgreSQL. This will prompt you to provide the password for the postgres user. Enter the password we set during the PostgreSQL installation.

pgadmin4-server-password

Once connected to the PostgreSQL server, you will get to the dashboard with all the databases that the postgres user has access to.

Congratulations, you have successfully installed PostgreSQL server and the access it via pgAdmin4

pgadmin4-dashboard

Next steps

If you wish to learn more about PostgreSQL or SQL in general, search SQL on the website and explore more.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.