LIVE NOW
DartDay - 24 Hours of Blow Out Deals!
00d : 00h : 00m : 00s
Go To the Event

Knowledge Base

Find detailed guides, step-by-step tutorials, and FAQs to help you get the most from your DartNode services.

home databases server-setup

How to Set Up PostgreSQL

How to Set Up PostgreSQL

Installation

# Ubuntu/Debian
apt update
apt install postgresql postgresql-contrib -y
systemctl start postgresql
systemctl enable postgresql

# CentOS/AlmaLinux
dnf install postgresql-server postgresql-contrib -y
postgresql-setup --initdb
systemctl start postgresql
systemctl enable postgresql

Creating a Database and User

sudo -u postgres psql

CREATE USER myapp_user WITH PASSWORD 'StrongPassword123!';
CREATE DATABASE myapp_db OWNER myapp_user;
GRANT ALL PRIVILEGES ON DATABASE myapp_db TO myapp_user;
q

Allowing Remote Access (if needed)

  1. Edit postgresql.conf and set listen_addresses = '*'.
  2. Edit pg_hba.conf to allow remote connections.
  3. Restart PostgreSQL and open firewall port 5432.