Ollama + Gemma 3: VPS setup and streaming chat tutorial
Learn to deploy Gemma 3 4B with Ollama on an 8 GB VPS and build a Node.js and Express chat app that streams responses to an HTML frontend.
Player not loading? Watch on YouTube
This tutorial builds a self-hosted chat app with Ollama and Gemma 3 4B on an Ubuntu VPS. It explains the distinction between Ollama, the runtime that loads models and handles requests, and the model weights it runs. The sponsored walkthrough uses Hostinger's Ollama template, then downloads Gemma rather than using the bundled Llama 3 model.
The demonstrated server has two vCPUs, 8 GB RAM and 100 GB NVMe storage. The speaker reports roughly 3.3 GB on disk for Gemma 3 4B and about 4 to 5 GB of RAM in use with the model loaded. Viewers follow installation checks, a terminal conversation and a REST request. The tutorial also describes Ollama's OpenAI-compatible chat completions endpoint, while noting that it does not mirror every OpenAI endpoint.
The app uses Node.js and Express to forward prompts to Ollama over localhost. Its HTML frontend displays streamed text. The backend buffers newline-delimited JSON before parsing because a network chunk can split a JSON line. Ollama stays off the public interface in this example; the speaker recommends authentication and restricted access if exposing it.
For readers considering a local LLM, the closing discussion weighs server costs and maintenance against privacy and model version control. The speaker favors hosted APIs for frontier capability and high-throughput production. Chat history, system prompts and document retrieval are suggested extensions, rather than features built here.