Database Engineering
  • Need of Database
  • Database and Database Management System
  • What is Relational Database Model ?
  • Installing Postgresql
    • Installing PostgreSQL on Linux
    • Installing PostgreSQL on Windows
    • Installing PostgreSQL on Mac
    • Postgres in Docker
  • What happens during the initial installation ?
    • Roles, Users & Groups
    • More examples on Roles
  • Sample Databases
    • DVD Rental Database
  • Querying Data
    • SELECT Query
    • Column Aliases
    • Order By
    • SELECT DISTINCT
    • DB-TASK-001
  • Filtering Data
    • WHERE ?
    • AND Operator
    • OR Operator
    • LIMIT
    • FETCH
    • IN
    • BETWEEN
    • LIKE
    • SIMILAR TO
    • IS NULL
    • ESCAPE
    • DB-TASK-002
  • Entity Relationship Diagram
    • What is an ER Diagram ?
    • Entity
    • Identifiers
    • Relationship
    • Attributes
    • Cardinality
    • Entity Relationship Diagram Tutorial
    • DB-TASK-003
  • Joins
    • Joins
    • Joins With Employee and Departments
  • Joins on E-Commerce
Powered by GitBook
On this page
  • Step 1: Update your Package Manager
  • Step 2: Install PostgreSQL
  • Step 3: Verify Installation
  • Step 4: Access PostgreSQL
  1. Installing Postgresql

Installing PostgreSQL on Linux

Step 1: Update your Package Manager

Before installing anything, ensure your system's package manager is up-to-date.

sudo apt update

Explanation: This tells the system to refresh the list of available software so you can install the latest versions.

Step 2: Install PostgreSQL

Use the package manager to download and install PostgreSQL.

sudo apt install postgresql postgresql-contrib

Explanation:

  • postgresql: The main PostgreSQL software.

  • postgresql-contrib: Additional helpful tools and extensions.

Step 3: Verify Installation

Check if PostgreSQL is running by checking its status.

sudo systemctl status postgresql

Explanation: This displays whether the PostgreSQL service is active. If it says active (running), you're good to go!

Step 4: Access PostgreSQL

Switch to the default PostgreSQL user and access the database.

sudo -i -u postgres
psql

Explanation:

  • sudo -i -u postgres: Switches to the PostgreSQL user.

  • psql: Opens the PostgreSQL command-line interface.

PreviousInstalling PostgresqlNextInstalling PostgreSQL on Windows

Last updated 6 months ago