Install the Postgres package, -contrib package and libpq-dev library by typing:

$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev -y

To check if PostgreSQL is installed type:

$ sudo -u postgres psql

The output should be something like this:

psql (10.12 (Ubuntu 10.12-0ubuntu0.18.04.1))
Type "help" for help.


To exit; simply type "\q" and press enter:

postgres=# \q

The next step is to create a new user by typing:

$ sudo -u postgres createuser -s [USERNAME]

Replace "[USERNAME]" with the user you are currently logged in as.