To install PostgreSQL in either Debian or Ubuntu according with the official docs:
Exists the PostgreSQL Apt Repository section where exists two approaches:
Automated repository configuration:
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
To manually configure the Apt repository, follow these steps
# Import the repository signing key:
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
# Create the repository configuration file:
. /etc/os-release
sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
# Update the package lists:
sudo apt update
If both approaches do theoretically the same configuration and obviously at a first glance the first approach is simpler than the latter due the amount of lines.
Question
- When would be mandatory use the manually configure the Apt repository approach?
I read the PostgreSQL Apt Repository wiki page page but there is no an explicit explanation about when the manual (long) approach would be mandatory over the former.