project: PostgreSQL Installation

Tags kubernetes postgresql
Hard Prerequisites
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content.
  • K8S: Manual App Deployment – Project Overview
  • Soft Prerequisites
  • K8S: Nginx Installation
  • Let’s install PostgreSQL.

    # updates the package manager
    sudo apt update
    
    # installs PostgreSQL
    sudo apt install postgresql postgresql-contrib -y
    

    The following commands will prepare PostgreSQL to be used by the Flask app.

    To avoid any issues with PostgreSQL shell, please type the commands below one by one.

    # logs in as the `postgres` user
    sudo -i -u postgres
    
    # opens the PostgreSQL shell
    psql
    
    # creates the databse
    CREATE DATABASE yourdb;
    
    # creates the user/password
    CREATE USER youruser WITH PASSWORD 'yourpassword';
    
    # allows the user access to the databse
    GRANT ALL PRIVILEGES ON DATABASE yourdb TO youruser;
    
    # exits the PostgreSQL shell
    exit
    
    # logs back to your instance user
    logout
    

    RAW CONTENT URL