How to Install Postgres on Ubuntu 20.04

This post is a short note on how to install Postgres on Ubuntu 20.04.

I’m doing this in WSL, however this shouldn’t make any difference if you’re on the same Ubuntu version.

First, lets update our local packages by running the following apt command –

# update local packages
sudo apt update

This Postgres installation is very quick and simple.

The following command is also including the ‘-contrib‘ package which gives us extra functionalities.

# install postgres on ubuntu
sudo apt install postgresql postgresql-contrib

Once the installation completes, we can enter psql using the postgres user created automatically during the install.

# login to psql with the out of box postgres user
sudo -u postgres psql

\q (to quit back to terminal)

There may be a need to restart the services post install which can be done by running the following.

# restart postgres service ubuntu
sudo service postgresql restart


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts
Categories
Tags

Always On Availability Groups (AAG) (4) AWS (4) AWS Redshift (6) Database Admin (72) Database Backups & Recovery (14) Database Mirroring (2) Error Messages (5) Failover Cluster Instances (FCI) (1) Git Commands (6) Importing & Exporting Data (2) Linked Servers (3) Linux Administration (2) Logging & Monitoring (1) Microsoft Patching (2) MySQL (4) Postgres (6) PowerShell Scripts (2) SQL Certificates & Encryption (3) SQL Server Agent (5) SQL Server CDC (2) SQL Server Data Types (2) SQL Server Management Studio (SSMS) (16) SQL Server Networking (3) SQL Server on Linux (1) SQL Server Patching (2) SQL Server Performance Tuning (6) SQL Server Processes (SPIDs) (7) SQL Server Replication (2) SQL Server Scripts (13) SQL Server Security (4) SQL Server Storage (10) Windows Admin (21) Windows Authentication (2) Windows Automation (1) Windows Events (2) Windows Firewall (4) Windows Subsystem for Linux (WSL) (18)