Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stiwardjherikofcr/7bbe9f786ebe472b2617c980a1719bf0 to your computer and use it in GitHub Desktop.
Save stiwardjherikofcr/7bbe9f786ebe472b2617c980a1719bf0 to your computer and use it in GitHub Desktop.
Install PostgreSQL 13 on Ubuntu 22.04|20.04|18.04 LTS
# Step 1 — Update Base Systems
sudo apt update && sudo apt -y upgrade
# Step 2 — Import Repository Signing Key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Step 3 — Add PostgreSQL repository
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Step 4 — Update again
sudo apt update
# Step 5 — Install PostgreSQL 13
sudo apt install -y postgresql-13
# Step 6 - Verify PostgreSQL 13 Installation on Ubuntu 22.04|20.04|18.04
sudo psql --version
# Step 7 - Manage PostgreSQL 13 service on Ubuntu 22.04|20.04|18.04
sudo service postgresql status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment