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.
- 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.
- 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.- Choose the port which the server should listen on. Choose a port that is not being used by a different process.
- Proceed accepting the defaults and finish the installation process.
Navigate to the official PostgreSQL page and download the installer provided by EDB. https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
We recommend you download the stable version of PostgreSQL. Version 14.4 as of publishing.
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.
Save the installer to your computer and launch it. You’ll be greeted with the following screen; click “Next” to continue.
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.
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.
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
Next steps
If you wish to learn more about PostgreSQL
or SQL
in general, search SQL
on the website and explore more.