Installing a Postgres Service

Learn how to install thePostgres database.

Direct approach

The most straightforward approach is to go to Postgres’s official website. On the “Download” page, specify your operating system and find the steps to download and install Postgres.

Using Docker

Take a look at another approach using Docker. You won’t need to install or add extra packages to your computer for this approach. Instead, you’ll use Docker to start a Postgres service directly. This approach uses the official Postgres image that can be found on Docker Hub. To start the service, simply launch it using the Docker run command:

docker run --name deno-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

This command is pretty basic. You only need to pass the name and the environment variable POSTGRES_PASSWORD, which is mandatory. You can check the official documentation to see if you need to add other variables. Make sure to check that the service is running with docker ps command. If everything works as expected, you can skip to the last section, where you connect to the database.

Using ElephatSQL

Take a look at how you can install a Postgres service using ElephatSQL. For this approach, you won’t be using any local installation. Instead, you’ll use a cloud service to create your database. This approach uses ElephatSQL because it offers a free-tier solution.

Start by creating an account. Once you log in, you’ll be redirected to this view:

Get hands-on with 1400+ tech skills courses.