Skip to content

How to self-host Khoj

Run Khoj — the open-source AI second brain — on your own hardware. Docker Compose, or as a baked appliance profile.

~15 minutes

Khoj indexes your notes, PDFs, photos and email and answers questions over them locally. It is the strongest option if personal knowledge is what you actually want, rather than a general chat agent.

Option 1: Docker Compose

The documented path:

mkdir ~/.khoj && cd ~/.khoj
wget https://raw.githubusercontent.com/khoj-ai/khoj/master/docker-compose.yml
# set KHOJ_ADMIN_PASSWORD and KHOJ_DJANGO_SECRET_KEY to something secure
docker compose up -d

Then open http://localhost:42110/.

Resource requirements are real

Khoj is heavier than most assistants. Budget 11 GB+ of disk after installation and 3.2 GB RAM minimum — more once indexing is under way, because embedding generation is memory-hungry.

That rules out a Raspberry Pi 4 and makes a Pi 5 tight unless you have the 16 GB board. A mini-PC with 16 GB is the comfortable floor. See deputyOS on a mini-PC.

Option 2: as an appliance profile

deputyOS ships khoj as a baked profile with Postgres, the embedding stack and the indexers already present:

  1. Choose khoj and a hardware target in the picker. Pick the rich tier — Khoj on lean will disappoint.
  2. Flash, boot, and finish the wizard.
  3. Mount the folders you want indexed. Every mount is reviewable and revocable from the console, which matters when the thing being mounted is your entire document history.

Switch to it from another profile with deputyctl profile switch khoj.

Indexing your files

Khoj indexes what it can reach. On an appliance that means mounting host folders, plugging in a USB drive, or attaching an SMB or NFS share — see mount drives.

First index over a large corpus takes a while and is CPU-bound. Let it finish before judging performance.

Local versus cloud models

Khoj works with local models through Ollama or with a cloud provider. For a second brain the argument for local is stronger than usual: the whole point is that it has read everything you own, and the queries themselves reveal what you are working on.

On 16 GB you can run a useful local model alongside the index. Below that, a cloud provider with a local embedding model is the practical compromise.

khojself-hostedguide

← All guides

Search

Search index isn't built yet. Run npm run build to generate it (Pagefind writes to dist/pagefind/).