How to Install n8n and Qdrant on a VPS (2026 Guide)
Learn how to deploy your own n8n server with Qdrant and PostgreSQL using Docker Compose. The definitive guide to self-hosting.
If you’re looking to save on automation costs and have full control over your data, self-hosting n8n is the way to go. In this guide, I’ll explain how to set up a Virtual Private Server (VPS) with the ultimate AI agent stack: n8n + Qdrant + PostgreSQL.
Why This Stack?
- n8n: The best low-code workflow orchestrator.
- Qdrant: Efficient vector database for your agents’ memory (RAG).
- PostgreSQL: Robust backend for n8n executions (much better than the default SQLite).
Prerequisites
- A VPS (Recommended: 2 vCPU, 4GB RAM).
- Domain pointing to your server’s IP.
- Basic terminal knowledge.
Step 1: Install Docker and Docker Compose
Connect to your server via SSH and run:
sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y
Step 2: Configure Docker Compose
Create a docker-compose.yml file in your home directory:
version: '3.8'
services:
n8n:
image: n8nio/n8n
ports:
- "5678:5678"
environment:
- N8N_HOST=${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${DOMAIN_NAME}/
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=${POSTGRES_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- postgres
- qdrant
postgres:
image: postgres:16
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
qdrant:
image: qdrant/qdrant
ports:
- "6333:6333"
volumes:
- qdrant_data:/qdrant/storage
volumes:
n8n_data:
postgres_data:
qdrant_data:
Step 3: Environment Variables
Create a .env file with your credentials:
DOMAIN_NAME=your-domain.com
POSTGRES_USER=n8n
POSTGRES_PASSWORD=your_secure_password
Step 4: Deployment
Run the stack:
sudo docker-compose up -d
You should now have access to n8n on your domain (if you configured a Reverse Proxy like Traefik or Nginx, which is highly recommended for SSL).
The Hard Part: Maintenance and Security
Setting up the server is just the beginning. Then you have to worry about:
- Configuring SSL certificates (Let’s Encrypt).
- Setting up automatic backups of the database.
- Keeping the OS and Docker updated.
- Monitoring for uptime.
There Is a Better Way
If you want all the benefits of self-hosting (privacy, no execution limits) but without the headaches of being a SysAdmin, at AIBuildr we’ve automated it all.
We offer managed private servers with this exact stack (n8n + Qdrant + Postgres) ready in 1 click.