Installing PostgreSQL on Windows and Linux Step-by-Step Guide

Installing PostgreSQL 17.4 on Windows & Linux – Step-by-Step Guide
PostgreSQL is one of the most powerful and widely used open-source relational databases.
Here’s how you can install PostgreSQL 17.4 on Windows and Linux.

🔹 Installation on Windows
1️⃣ Download the installer from the official PostgreSQL website.
2️⃣ Run the installer (.exe) and follow the wizard instructions.
3️⃣ Choose components (PostgreSQL Server, pgAdmin, Stack Builder).
4️⃣ Set the installation directory and data directory.
5️⃣ Create a password for the postgres user.
6️⃣ Select the port (default: 5432) and configure locale settings.
7️⃣ Complete the installation and restart your system (if required).

📌 Verify Installation: Open pgAdmin or run psql -V in Command Prompt.

🔹 Installation on Linux (Ubuntu/RHEL)
✅ For Ubuntu:

sudo apt update
sudo apt install postgresql postgresql-contrib

✅ For RHEL/CentOS:

sudo dnf install -y postgresql-server postgresql-contrib

sudo postgresql-setup –initdb

sudo systemctl enable PostgreSQL

sudo systemctl start PostgreSQL

✅ For All Linux Systems:

Switch to the postgres user:

sudo -i -u postgres

Access PostgreSQL prompt:

psql

Check installed version:

SELECT version();

Leave a Reply

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