Data
Self-host MongoDB on a VPS
The leading document database.
A flexible JSON-document store used by many modern apps, with rich querying and horizontal scaling.
Why self-host MongoDB?
Self-hosting MongoDB avoids managed-tier costs and keeps your documents on your own disk.
How to install MongoDB
- 1
Provision a VPS
Choose a plan with room for your data as well as the app.
- 2
Install the stack
Install Native packages or Docker.
- 3
Deploy the application
Follow the project’s official install guide for your distribution.
- 4
Enable HTTPS
Serve it on your own domain behind a reverse proxy with a certificate.
- 5
Back it up
Schedule a database dump plus a copy of any uploaded files to an off-box location.
Practical tips
- Give MongoDB its own database user with rights only on its own schema.
- Reverse-proxy MongoDB and terminate TLS at the proxy so certificates are managed in one place.
- Take a VPS snapshot before major upgrades so you can roll back cleanly.
- Keep MongoDB patched — most self-hosting incidents are unpatched software.
Frequently asked questions
- How much RAM does MongoDB need?
- Plan on 4 GB+ for typical use; add headroom if you expect many concurrent users.
- What stack does MongoDB run on?
- Native packages or Docker.
- Can I run other things on the same VPS?
- Yes — size the plan so MongoDB plus your other workloads fit in RAM with room to spare.
Looking for something else? Popular alternatives include FerretDB, PostgreSQL (JSONB), CouchDB — browse all app guides.