Knowledge Base
KamlatechToolBlogContact Us
  • Kamlatech Documentation
  • Magento
    • Installation
    • Email Configuration
  • Blogger
    • Adding Code Block
  • Linux
    • Managing Logs
    • Prevent Package Update
  • Node
    • Installation
    • Http-Server
  • Github
    • .gitignore
    • Branch to New Repo
  • HTML
    • Common Header & Footer in HTML
  • Linkedin Infographics
    • Flame Retardant Standards
    • Flame Retardant Terms
  • Music
    • Pandit Niladri Kumar - Sitar
  • Applications
    • Konvect Connect
    • Konvect Fetcher
    • Konvect Fetcher WebApp
  • HTTPS SSL Certificate
    • Lets's Encrypt
  • Oracle Cloud Instance
    • Firewall
    • CPU Stressing
    • CPU Stressing Docker
  • SFTP
    • WinSCP SFTP
  • NextCloud
    • Installation
    • Post Install Tweak
    • PHP Version
  • Wordpress
    • NGINX Configuration
    • Image upload / Crop issue
    • Required PHP Modules
    • PHP Configuration
  • Healthcare Wearables (Cardiac)
    • Wearable ECG
    • Arrhythmia
    • Ambulatory ECG Usecase
    • Understanding EKG Leads
  • Flutter
    • Direct URL Access
    • Change Android PackageName
  • Math
    • Online Equation Writing
  • Backend Web Service
    • Flask App Deployment
  • 3D Modeling
    • DWG in Solid Edge
  • MariaDB
    • MariaDB Commands
  • Excel
    • HTML as String in Excel
  • Tools
    • Online Tools
  • PostgreSQL
    • PostgreSQL Installation
  • MEDUSA
    • Medusa Installation
    • Backend Server/Worker Mode
    • Frontend Deployment
  • Jupyter Lab
    • Jupyter Web App
  • WooCommerce
    • Product Filename Renaming
  • Embedded
    • Flash Xiao Sense Bootloader
Powered by GitBook
On this page
  • PostgreSQL
  • Access PostgreSQL
  • Configure PosrgreSQL for Medusa
  • Other Actions in PostgreSQL
Edit on GitHub
  1. PostgreSQL

PostgreSQL Installation

PostgreSQL

When working with MEDUSA for ecommerse, you will need to use postgresql. Here will will look into how to install and confugure postgresql before installing MEDUSA bbackend, so that the MEDUSA installation goes smoothly.

For installing postgresql in ubuntu first add the postgresql repository

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Retrieve and adds the PostgreSQL repository's GPG (GNU Privacy Guard) key to your system

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Install Postgresql

sudo apt-get update
sudo apt-get -y install postgresql

Check installation using version command

psql -V

Access PostgreSQL

To access postgresql type "psql" but this will generate error

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "username" does not exist

As the default configuration of Postgres is, a user called postgres is made on and the user postgres has full superadmin access to entire PostgreSQL instance running on your OS.

The DB console cn be accesed using the below command, by passing the username along with 'psql'

sudo -u postgres psql

Incase the above steps doesnot work Create as password for postgres user

sudo passwd postgres

Enter the new password and switch to this user acount, by using this newly created password

su postgres

Now you can use the command 'psql' to enter into DB consile. To list all the database and owners use the '\l' command on the DB console. Command '\q' is used to exit the terminal

Configure PosrgreSQL for Medusa

When installing MEDUSA backend, it asks for creating psotgresql DB. if the default user is not regitered with postgres DB then the process of DB creation will fail.

To prevent this we create a new user (medusa_adim) in postgresql DB with a known password and will provide these credentials while instaling MEDUSA backen. This will ensure that necesary DB is created and linked to MEDUSA.

In the DB console type

CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';

Now provide the newly created user with Database creation rights

ALTER USER youruser WITH CREATEDB;

This should be enough for MEDUSA installation to go through one you provide youruser and yourpass

Other Actions in PostgreSQL

All the commands are self explanator

CREATE DATABASE yourdbname;
ALTER USER username WITH CREATEDB;
AGRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
DROP USER youruser;
DROP DATABASE yourdbname WITH (FORCE);
PreviousOnline ToolsNextMedusa Installation

Last updated 6 months ago