DEV Community

Anaya Manwa
Anaya Manwa

Posted on

INSTALLATION AND SET UP OF POSTGRESQL USING A LINUX SERVER


How To Get PostgreSQL Running On Your Linux Box (The Not-Boring Way)

Alright, so you wanna get PostgreSQL up and humming on your Debian or Ubuntu server? Cool. Let’s cut the fluff and just get this rolling.

  1. Refresh Those Packages

Pop open your terminal and toss this in:

   sudo apt update
Enter fullscreen mode Exit fullscreen mode

  1. Smash That Install

Next up, jam this in. It’s gonna pull down all the good stuff:

   sudo apt install postgresql postgresql-contrib
Enter fullscreen mode Exit fullscreen mode

  1. Did It Work? Let’s Check

Don’t trust the process. Check the process. Type:

   sudo systemctl status postgresql
Enter fullscreen mode Exit fullscreen mode
  1. Become The Database Boss

You gotta switch to the ‘postgres’ user to actually do stuff:

   sudo -i -u postgres
Enter fullscreen mode Exit fullscreen mode
  1. Hop Into The Database Console

Type:

   psql
Enter fullscreen mode Exit fullscreen mode
  1. Make Yourself A Database

Chuck this command in:

   CREATE DATABASE mydb;
Enter fullscreen mode Exit fullscreen mode

And that’s it. PostgreSQL is up. Go wild—spin up users, break stuff (within reason), and build whatever weird project’s been haunting your brain.

Top comments (0)