# Install PostgreSQL

## Overview and generalities

* By default every Postgres installation comes with one database already created called "postgres"
* This is important because Postgres requires you to specify the name of the database to make a connection, so there needs to always be one database
* [Postgres Downloads URL](https://www.postgresql.org/download/)

## Linux Debian

* Install Packages

```bash
sudo apt update && sudo apt install postgresql postgresql-contrib
```

* Once the installation is complete, the PostgreSQL service will start. To verify the installation, use the <mark style="color:orange;">`psql`</mark> tool to print the server version

```bash
sudo -u postgres psql -c "SELECT version();"
```

{% hint style="info" %}
Output should look like:

```bash
PostgreSQL 11.5 (Debian 11.5-1+deb10u1) on x86_64-pc-linux-gnu, 
compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
```

{% endhint %}

## Windows

* Download installer from the [Postgres Downloads URL](https://www.postgresql.org/download/)
* Follow the Wizard like any other app
* Select path where you want installed (Usually left default)
* Select additional components to be installed

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2FJBhKTrjjwgmJKuemR8Wp%2Fimage.png?alt=media\&token=1a5d2d55-6cf3-43b5-9886-22a80f24f911)

* Pass in the password for the superuser

![](https://3885248957-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoE4wMO1dMVDOGDjh0En7%2Fuploads%2F9WTkBmjcFcp9V3plg5uq%2Fimage.png?alt=media\&token=f92624ea-55db-4a97-a63c-9bd3d4b2f8be)

* Pass in the Database Port (Default: 5432)&#x20;
* Click next on the rest and this will start the install
