In this tutorial you will configure Ubuntu Linux to use the apt.postgresql.org package repository and install, configure and test PostgreSQL.
Commands to run are shown in grey boxes throughout the tutorial. Click on the boxes or copy and paste the commands into the terminal to execute each command.
PostgreSQL Installation on Ubuntu Linux
Step 1 - Configure the Package Repository
Before PostgreSQL can be installed, the apt.postgresql.org package repository must be setup on the machine. This tutorial is based on Ubuntu 18.04; for the appropriate commands for other Ubuntu versions, please visit the PostgreSQL download page for Ubuntu. Instructions for Debian Linux can be found on the PostgreSQL download page for Debian
The first step is to create a repository configuration file:
echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > \