Where can you host PostgreSQL in India?
You can self-host PostgreSQL on a KVM VPS in India or use a managed database service. On RapidServer, a Linux VPS with full root starts at ₹581/mo plus 18% GST in Mumbai (BOM1) or Delhi NCR (DEL1), and your data and daily backups stay in India. Install Postgres from Ubuntu or the official apt repository, keep it on localhost or a private network and back it up nightly.
Self-hosted PostgreSQL vs a managed database
A managed database is PostgreSQL run as a service: you pick a size and region, get a connection string, and the provider runs the server.
| Self-hosted on a VPS | Managed database | |
|---|---|---|
| Who runs the server | You, with full root | The provider |
| Setup | Install, secure and back up yourself | Pick a size and region, then connect |
| Versions, extensions, settings | Anything you can install or set | What the service supports |
| Backups | Your own, plus daily VPS backups kept 7 days | Automated; check retention and restores |
| Updates | You apply them | The provider, often in a maintenance window |
| Data location | Mumbai (BOM1) or Delhi NCR (DEL1) | The regions the service offers |
| Cost | The VPS price, monthly | Usually by instance size, storage and backups |
Choose managed if nobody on your team wants to run a database server. Self-host if you know Linux, need a particular version or extension, or want the database beside your app. In between, self-host and add our managed support at ₹1,499/mo for security patching, hardening and database stack tuning; your own copy of your data stays your job (see managed vs unmanaged VPS).
Install PostgreSQL on Ubuntu
SSH in as root (see SSH kya hai). PostgreSQL's Ubuntu download page offers two routes: Ubuntu's own apt install postgresql, which gives PostgreSQL 16 on Ubuntu 24.04 for the life of the release, or the official PostgreSQL apt repository for the newest major version, 19, released on 19 November 2026:
sudo apt install -y postgresql-common sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh sudo apt update sudo apt install postgresql-19
The server starts by itself, with its configuration in /etc/postgresql/19/main/. Create a login role, which prompts for a password, and a database for your app:
sudo -u postgres createuser --pwprompt shopapp sudo -u postgres createdb -O shopapp shop
Listen only on localhost or a private network
listen_addresses sets which network interfaces accept connections. The default, localhost, allows only connections from the server itself: right when the app runs on the same VPS. If the app runs on another RapidServer VPS in the same region, use the free private networking and add only the database server's private IP, shown here as 10.0.0.10:
listen_addresses = 'localhost,10.0.0.10'
Avoid '*', which includes the public interface. This setting needs a restart: sudo systemctl restart postgresql.
pg_hba.conf basics
pg_hba.conf decides who may connect, from where, to which database and how they authenticate. PostgreSQL uses the first line that matches; if that login fails, later lines aren't tried. Ubuntu's default allows local system users by name (peer) and password logins from localhost. Add one line per app server, here 10.0.0.5, with the scram-sha-256 password method:
# TYPE DATABASE USER ADDRESS METHOD host shop shopapp 10.0.0.5/32 scram-sha-256
/32 means that one address. Reload to apply: sudo -u postgres psql -c 'SELECT pg_reload_conf();'.
Firewall: allow only your app servers
Port 5432 shouldn't be reachable from the internet at all. With ufw, keep SSH open and allow 5432 only from your app servers:
ufw allow OpenSSH ufw allow from 10.0.0.5 to any port 5432 proto tcp ufw enable
The client area's network firewall can hold the same rule. In Docker, published ports skip ufw, so bind Postgres to 127.0.0.1:5432:5432 or don't publish it. See our firewall guide.
Backups: pg_dump, pg_basebackup and daily VPS backups
PostgreSQL's backup chapter covers SQL dumps, file system backups and continuous archiving. pg_dump exports one database consistently without blocking readers or writers, and pg_dumpall --globals-only saves the roles:
mkdir -p /root/db-dumps sudo -u postgres pg_dump -Fc shop > /root/db-dumps/shop-$(date +%F).dump sudo -u postgres pg_dumpall --globals-only > /root/db-dumps/globals.sql
Its documentation adds that, except in simple cases, pg_dump isn't the right tool for regular production backups. There, pg_basebackup copies the whole running cluster without affecting other clients, and is the base for point-in-time recovery with WAL archiving:
install -d -o postgres -g postgres /var/backups/pg sudo -u postgres pg_basebackup -D /var/backups/pg/base-$(date +%F) -Ft -z -P
Copy backups off the server and test a restore with pg_restore. Every RapidServer VPS also gets daily full-server backups kept 7 days and snapshots on demand: a safety net, not a replacement (see our VPS backup guide).
Keeping PostgreSQL updated
PostgreSQL releases a minor version at least every three months, and its versioning policy recommends always running the latest one. Minor upgrades need no dump and restore: take a snapshot, read the release notes, then run:
sudo apt update sudo apt upgrade
Each major version is supported for 5 years. A major upgrade, such as 18 to 19, needs a dump and restore or pg_upgrade; on Ubuntu, pg_upgradecluster handles either. Rehearse it on a copy first.
Keeping PostgreSQL data in India
On a RapidServer VPS, your database runs in Mumbai (BOM1) or Delhi NCR (DEL1), and primary data and backups are stored in India, which simplifies DPDP Act and sector-specific residency requirements. Noida and Gurugram are served from DEL1; see latency by city. With a managed database, check its region and where backups and replicas live.
How much RAM does PostgreSQL need?
RAM matters most. PostgreSQL keeps frequently read data in shared_buffers and the operating system's file cache, so when your busy data fits in memory, far fewer reads hit the disk. Its resource settings suggest 25% of RAM for shared_buffers as a starting value on a dedicated database server. There is no fixed minimum: size by data, connections and queries, then watch the memory graphs in the client area.
| Use | Plan | Per month |
|---|---|---|
| Development, staging or a small app with its database | Stardust: 2 vCPU, 4 GB RAM, 20 GB NVMe | ₹581 |
| Production app and PostgreSQL on one server | Full Moon: 4 vCPU, 8 GB RAM, 160 GB NVMe | ₹1,723 |
| A separate database server with more data in memory | Eclipse: 8 vCPU, 16 GB RAM, 320 GB NVMe | ₹3,445 |
For steady, heavy load, Dedicated CPU plans reserve whole cores from ₹1,302/mo (see VPS vs VDS). Every plan has full root, costs the same in both cities, is billed monthly plus 18% GST, and moves up from the client area with the difference prorated.
Dedicated vCPU, NVMe, full root and daily backups kept 7 days in Mumbai or Delhi NCR, ready a few minutes after payment, from ₹581/mo.
See VPS plansQuestions
What is the PostgreSQL hosting price in India?+
Can I get VPS hosting with PostgreSQL?+
Is a managed database better than PostgreSQL on a VPS?+
Should PostgreSQL run on the same VPS as my app?+
listen_addresses on localhost. Give the database its own VPS when it needs more RAM, and connect the two over free private networking in the same region.Is my PostgreSQL data stored in India?+
VPS par PostgreSQL kaise install karein?+
apt install postgresql chalaiye, ya naye version ke liye PostgreSQL ki official apt repository add kijiye. listen_addresses localhost par rakhiye, pg_hba.conf aur firewall me sirf app server ka IP allow kijiye aur roz backup lijiye. RapidServer par VPS ₹581/mo plus 18% GST se shuru hota hai aur payment ke kuch minute baad ready ho jata hai.