Connecting Obsidian to a Local LLM: A Practical Setup Guide

    This guide shows how to run Qwen2.5 locally with Ollama so that your notes and model inference stay on your own machine. It covers hardware and cost considerations, installing Ollama and pulling a model, verifying the local API, and preparing an Obsidian vault.

    1. Goals and Costs

    The goal of this setup is simple: your note content stays on your machine, and the AI model also runs locally.

    The software is free. Obsidian is free for personal use, Ollama is open-source, and Qwen2.5 models are free to download. The cost is in hardware and electricity. For a 7B-parameter model, the default 4-bit quantized version is about 4.7 GB to download and needs roughly 6 GB of memory or VRAM at runtime. With a dedicated GPU that has 8 GB of VRAM, generation speed is acceptable. On CPU only, 16 GB of RAM is enough to run the model, but generation is noticeably slower. If your machine is less powerful, you can switch to a 3B-parameter model. It runs faster, but summary quality drops.

    All steps in this guide are performed on Linux or WSL (Windows Subsystem for Linux). Windows users can run wsl --install to install WSL. After restarting, open the Ubuntu terminal.

    2. Installing Ollama and Pulling a Model

    Ollama loads models on your machine and serves them through http://localhost:11434. Windows users can download the installer from the official Ollama website. Linux and WSL users can install Ollama with the steps below. Rather than piping the script directly into sh, download it first, review it, and then run it:

    1. curl -fsSL https://ollama.com/install.sh -o install.sh
    2. less install.sh # Read the script and confirm it is safe, then press q to exit
    3. sh install.sh

    After installation, pull a model and run a quick test:

    1. ollama pull qwen2.5:7b
    2. ollama run qwen2.5:7b "用一句话介绍你自己"

    Run ollama list to see the models installed on your machine. The model name must match the name in this list exactly, because the scripts later in this guide use it.

    3. Verifying the Local API

    Next, confirm that the API returns responses. First, install jq, a command-line JSON processor. On Debian or Ubuntu, run:

    1. sudo apt update && sudo apt install -y jq

    Then send a test request to the local API:

    1. curl -s http://localhost:11434/api/generate \
    2. -d '{"model":"qwen2.5:7b","prompt":"你好","stream":false}'

    The response is JSON. The response field contains the model’s reply. If you see an error such as Failed to connect, the Ollama service is not running. Start it by running ollama serve in another terminal, then run the test again.

    4. Preparing an Obsidian Vault

    Download and install Obsidian from the official Obsidian website. After launching the app, choose the option to open a local folder as a vault, then select an empty folder. The path must point to the folder that will contain the .obsidian configuration directory. Once you confirm, Obsidian creates this folder automatically.