Install Qdrant on a Linux VPS and Build a RAG-Ready Vector Database
If you want a fast vector database for RAG and semantic search, this guide shows the fastest way to install Qdrant on a Linux VPS and make it ready for real app queries. Qdrant supports Docker-based deployment, REST and gRPC interfaces, collections, points, and vector search features that fit retrieval workloads well.
In this article, you will learn to install Qdrant on a Linux VPS, secure it, create the first collection, insert records, and test search with practical examples for RAG.
Table of Contents
Why Qdrant fits RAG
Qdrant is an open-source vector search engine built for storing embeddings and querying them by similarity, which makes it a strong fit for retrieval-augmented generation and semantic search applications. It supports collections, points, payload filters, and API access that can be used directly from backend apps and AI pipelines.
If you are still comparing options, read this guide on the best vector database for RAG.
Server Requirements to Install Qdrant on a Linux VPS
Before you install Qdrant on a Linux VPS, you must prepare a clean Ubuntu server with sudo access and Docker support. Qdrant officially supports installation with Docker, binary builds, and Kubernetes, but Docker is the easiest path for a VPS setup.
You should have:
- Ubuntu 22.04 or 24.04
- SSH access with sudo
- At least 2 vCPU and 2 GB RAM for small tests
- More RAM and storage for larger RAG workloads
A stable Linux VPS is a good option for self-hosted vector search. If you also run embedding models or AI workloads on the same stack, you can check AI Hosting for heavy deployments.
Step 1. Update Ubuntu, Install Docker, and Secure VPS
You must start by updating the system packages before you install Qdrant on a Linux VPS. This helps avoid package conflicts and makes the server ready for Docker-based service:
sudo apt update && sudo apt upgrade -y
Qdrant’s quickstart shows Docker as the simplest local and self-hosted deployment method. You must install Docker from the official repository, not from an old distro package, so you get the current engine and compose support:
sudo apt install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
sudo systemctl enable --now docker
Check that Docker works by checking the version:
docker --version
sudo docker compose version
Before exposing any service, add basic firewall rules. Qdrant commonly uses port 6333 for REST and 6334 for gRPC. It is safer to keep these bound to localhost and let your app or reverse proxy connect internally:
sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
sudo ufw status verbose
Now you are ready to install Qdrant on a Linux VPS with Docker.
Step 2. Create the Qdrant stack
First, create a project folder and generate a strong API key with the commands below:
mkdir -p ~/qdrant && cd ~/qdrant
openssl rand -hex 32
Qdrant supports environment variable configuration with the QDRANT__ prefix, and the service API key can be set with QDRANT__SERVICE__API_KEY. That makes Docker Compose a clean way to install Qdrant on a Linux VPS while keeping configuration simple.
Create the Docker compose YAML file with the command below:
nano docker-compose.yml
Add the following config to the file:
services:
qdrant:
image: qdrant/qdrant:latest
container_name: qdrant
restart: unless-stopped
ports:
- "127.0.0.1:6333:6333"
- "127.0.0.1:6334:6334"
volumes:
- qdrant_storage:/qdrant/storage
environment:
- QDRANT__SERVICE__API_KEY=REPLACE_WITH_YOUR_API_KEY
- QDRANT__LOG_LEVEL=INFO
volumes:
qdrant_storage:
Save and close the file.
qdrant/qdrant:latestpulls the official image.127.0.0.1keeps the API local to the server./qdrant/storageis the correct storage path used by Qdrant containers.- The named volume keeps your data after restarts.
Then, start the stack with the command below:
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs qdrant
At this point, you have successfully started to install Qdrant on a Linux VPS.
Verify the service
Once the container is up, test the health endpoint locally:
curl http://localhost:6333/healthz
You can list collections with the API key:
curl -X GET http://localhost:6333/collections \
-H "api-key: REPLACE_WITH_YOUR_API_KEY"
If you get a valid JSON response, the Qdrant installation process is working correctly.
Step 3. Create the First Qdrant Collection
A collection is where Qdrant stores vectors and related payload data. To create a collection, send a request with vector size and distance metric:
curl -X PUT http://localhost:6333/collections/rag_docs \
-H "Content-Type: application/json" \
-H "api-key: REPLACE_WITH_YOUR_API_KEY" \
-d '{
"vectors": {
"size": 384,
"distance": "Cosine"
}
}'
For text embeddings in RAG, Cosine is the normal default:
| Setting | Value |
|---|---|
| Collection name | rag_docs |
| Vector size | 384 |
| Distance | Cosine |
This is a good starter setup when you install Qdrant on a Linux VPS for semantic search.
Step 4. Insert your First Records
Qdrant stores data as points, and each point can include an ID, a vector, and payload fields. This payload is what your app can return later as context for a language model:
curl -X PUT http://localhost:6333/collections/rag_docs/points \
-H "Content-Type: application/json" \
-H "api-key: REPLACE_WITH_YOUR_API_KEY" \
-d '{
"points": [
{
"id": 1,
"vector": [0.12, 0.21, 0.31, 0.44],
"payload": {
"text": "Qdrant stores embeddings for semantic search.",
"source": "kb/qdrant.txt",
"topic": "vector-db"
}
},
{
"id": 2,
"vector": [0.15, 0.25, 0.35, 0.40],
"payload": {
"text": "RAG retrieves relevant chunks before generation.",
"source": "kb/rag.txt",
"topic": "rag"
}
}
]
}'
Notes: The upsert API inserts new points and overwrites points with the same ID if they already exist. In a real setup, after you install Qdrant on a Linux VPS, these vectors should come from your embedding model, and they must match the exact collection size.
Step 5. Test Semantic Search
After inserting data, you can run a similarity search query. Qdrant supports REST and SDK-based search for matching vectors:
curl -X POST http://localhost:6333/collections/rag_docs/points/query \
-H "Content-Type: application/json" \
-H "api-key: REPLACE_WITH_YOUR_API_KEY" \
-d '{
"query": [0.12, 0.22, 0.30, 0.41],
"limit": 2,
"with_payload": true
}'
If your query vector is close to the inserted records, Qdrant returns the closest matches with payload data. That is the core retrieval step used when you install Qdrant on a Linux VPS for a RAG app.
You can also filter by payload fields to narrow the search to one topic or source, which is useful in multi-document knowledge bases.
Python Client Example: Connect to Qdrant with Python
The Python client is available through qdrant-client. You can install it with:
pip install qdrant-client
Example:
from qdrant_client import QdrantClient, models
client = QdrantClient(
url="http://localhost:6333",
api_key="REPLACE_WITH_YOUR_API_KEY"
)
client.create_collection(
collection_name="rag_docs_py",
vectors_config=models.VectorParams(size=4, distance=models.Distance.COSINE)
)
client.upsert(
collection_name="rag_docs_py",
points=[
models.PointStruct(
id=1,
vector=[0.1, 0.2, 0.3, 0.4],
payload={"text": "Install Qdrant on a Linux VPS for RAG apps.", "source": "guide"}
)
]
)
result = client.query_points(
collection_name="rag_docs_py",
query=[0.1, 0.2, 0.3, 0.39],
limit=1,
with_payload=True
)
print(result)
This gives your app the normal flow, creates embeddings, queries Qdrant, and passes the returned context to the LLM. For larger AI stacks, this guide on RAG pipelines using GPU servers is a useful next read.
Safe Ways to Access Qdrant
If you install Qdrant on a Linux VPS and want remote access, do not expose port 6333 directly unless you fully understand the risk. Safer options are:
- Keep Qdrant on localhost only.
- Connect from your app on the same VPS.
- Use an SSH tunnel for temporary remote access.
- Put Nginx or Caddy in front with HTTPS and access control.
For example, an SSH tunnel looks like this:
ssh -L 6333:localhost:6333 user@your-server-ip
Then open http://localhost:6333/dashboard in your browser.
For more details on securing your instance in production, see the official Qdrant Security guide.
Conclusion
To install Qdrant on a Linux VPS the right way, use Docker, keep ports local, enable an API key, mount persistent storage, and test the collection and query flow before connecting your app. This gives you a clean setup for semantic search and RAG without adding extra complexity.
FAQs
Can I install Qdrant on a Linux VPS without Kubernetes?
Yes. Docker is the easiest and most practical option for a VPS setup.
Which port does Qdrant use?
Qdrant commonly uses port 6333 for REST and 6334 for gRPC.
What should the vector size be for Qdrant?
It must match your embedding model output exactly.