DEV Community

Cover image for PostgreSQL Installation Guide for Linux Servers
Brenda Mutai
Brenda Mutai

Posted on

PostgreSQL Installation Guide for Linux Servers

Introduction
PostgreSQL is an advanced, opensource relational database system known for its performance, extensibility and standards compliance.
Its a go-to choice for developers and database administrators across the globe.

Prerequisites

  • Operating system (Ubuntu, CentOS, Debian)

  • Stable internet connection

  • Terminal

  • User access with sudo privileges

Installation guide on ubuntu

  1. Update your system

Ensuring system package list is up to date before installing new software.

For Ubuntu

sudo apt update && sudo apt upgrade

2.Install PostgreSQL

  • PostgreSQL :Main database

  • PostgreSQL-contrib: Add useful extensions

3.Verify Installation

psql --version
sudo systemctl status postgresql

PostgreSQL User Setup
Switch to the postgress user

sudo su - postgres

Access the PostgreSQL prompt.
psql

Set a password for the postgres user
ALTER USER postgres WITH PASSWORD 'your_secure_password';

Exit the postgres user.
exit

Post-Installation Tips

  • Database users should use strong passwords.

  • Restrict remote access using a firewall.

  • Back up your database regularly.

Top comments (0)