Qumulus
  • Welcome
  • Getting Started
    • Introduction to QUM
      • What can 1 QUM do?
      • QUM Performance
    • Dashboard
  • Your Account
    • Your Projects
      • Project Architecture
  • Resources
    • Compute
      • Instances
        • Creating an Instance
        • Instance Configuration
          • OS & Images
          • Instance Types
        • Using User Data
        • Connecting to an Instance
        • Instance Details
        • Instance Actions
        • Instance Monitoring
      • Instance Snapshot
        • Create & Restore
        • Snapshots Manage
  • Storage
    • Volumes
      • Create & Attach
      • Resize & Delete
    • Volume Snapshots
  • Networking
    • Public IPs
      • IP Allocation/Management
      • Associating/Disassociating IPs
    • Load Balancer
  • Security
    • Key Pairs
      • Creating Key Pairs
      • Managing Key Pairs
    • Security Groups
      • Managing Security Groups
    • SSL Certificates
  • How-To & Tutorials
    • Fixed cost Development Playground
    • Installing Redis Community
    • Installing Mongo Community
    • Installing PostgreSQL
    • VPN Server
      • VPN Server with OpenVPN
      • VPN Server with Netbird
  • RELEASES
    • Q1, 2025
  • Blogs
    • Release Beta v1.0
  • Release v2.0
Powered by GitBook
On this page
  1. How-To & Tutorials

Installing PostgreSQL

Get High Performance PostgreSQL up and running in under 3 minutes.

PreviousInstalling Mongo CommunityNextVPN Server

Last updated 2 months ago

Getting up to speed with PostgreSQL for your development is super easy with Qumulus.

Create a new instance, select Ubuntu 24.04, Instance type as t1.small (or the size which suits you) and add script to the user data section, click launch!

Here is the 'user data' script you can use

#!/bin/bash

#This is a basic setup that is intended to be used for development purposes.
# Update package list and install Postgres and UFW
apt update > /dev/null 2>&1
apt install postgresql postgresql-contrib ufw -y > /dev/null 2>&1

# Replace 'PleaseChangeYourPassword' with your actual secure password once the installation is completed.
POSTGRES_PASSWORD="PleaseChangeYourPassword"

# Update Postgres configuration:
# 1. Enable remote access by binding Postgres to all interfaces.
POSTGRES_CONF=`find /etc/postgresql -name postgresql.conf`
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" $POSTGRES_CONF

# 2. Update pg_hba.conf to allow remote connections.
PGHBA_CONF=`find /etc/postgresql -name pg_hba.conf`
sudo echo -e "host\tall\tall\t0.0.0.0/0\tmd5" >> $PGHBA_CONF
sudo -u postgres psql template1 -c "ALTER USER postgres with encrypted password '$POSTGRES_PASSWORD';"

systemctl enable postgresql
systemctl restart postgresql

# Enable UFW if it's inactive.
if ufw status | grep -iq "inactive"; then
    echo "y" | ufw enable
fi

# Allow incoming TCP connections on port 5432 (Postgres).
ufw allow 5432/tcp

# Allow incoming TCP connections for SSH.
ufw allow 22/tcp
ufw reload

Once your instance is up and running, You can assign a public IP to it and to it .Make sure you have inbound rules defined to allow for the instance and open port for PostgreSQL in the assigned to your VM.

SSH
SSH
Security Group
Assign Public IP
Allow Inbound Rule