'Installing postgres on Ubuntu 18.04 prompts for "Password:". Which Password should be supplied?

I am trying to create a scripted installation of Postgres on Ubuntu 18.04.06, using bash. In order to do this, I am using the following post from Digital Ocean as a starting point, and adapting it to my needs:

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04

The account that I am using is a sudoer on the machine. I am running the following two lines - the problem occurs on the second line:

sudo apt-get -y update
sudo apt-get -y install postgresql

The apt update completes successfully, then the postgresql install chugs along until it reaches this point:

Selecting previously unselected package postgresql.
Preparing to unpack .../postgresql_14+238.pgdg18.04+1_all.deb ...
Unpacking postgresql (14+238.pgdg18.04+1) ...
Setting up postgresql-client-common (238.pgdg18.04+1) ...
Setting up postgresql-common (238.pgdg18.04+1) ...
Password: 

I have tried entering the password to my sudoer account - all it does is hang. I have also tried just hitting ENTER - no dice.

I can see from the docs and the /etc/passwd file that the Postgres install process creates a postgres unix account automatically. If the Password: prompt is asking for the password to this postgres account, I don't know where to find this password either.

To summarize:

  • Can this Password: prompt be avoided entirely?
  • If the prompt can't be avoided, where do I find the correct password?

Thanks !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source