Local applications rely on the Ollama server to load models and answer inference requests. A foreground server exposes that API for the lifetime of a terminal session, with startup messages and request logs visible in the terminal.
Foreground ollama serve is convenient for testing environment variables. It does not provide automatic startup after a reboot; persistent Linux operation normally uses the ollama systemd service instead.
The local API does not require authentication, so the default loopback listener keeps access on the same machine. Ollama and curl must already be installed, with a downloaded model available for an inference request.
Steps to start the Ollama server:
- Check whether the default Ollama endpoint already answers.
$ curl -fsS http://127.0.0.1:11434/api/version curl: (7) Failed to connect to 127.0.0.1 port 11434 after 0 ms: Couldn't connect to server
A version response means a server already owns the endpoint, often through the desktop app or Linux service. A foreground launch needs that port to be free; connection refusal is the expected starting state when no server is running.
- Start one foreground Ollama server.
$ ollama serve ##### snipped ##### time=2026-10-28T01:38:35.304Z level=INFO source=routes.go:2533 msg="Listening on 127.0.0.1:11434 (version 0.40.12)" ##### snipped #####
The default listener is 127.0.0.1:11434 unless OLLAMA_HOST overrides it. The terminal stays occupied until the server exits; Ctrl+C or closing the terminal stops it. An address-in-use error means another process owns the port.
Related: How to set the Ollama host address
Related: How to view Ollama logs - Request the server version from a second terminal on the same machine.
$ curl -fsS http://127.0.0.1:11434/api/version {"version":"0.40.12"}
The first terminal must remain open with ollama serve running. The version value follows the installed release.
- Send a short model request to the same Ollama listener.
$ curl -fsS http://127.0.0.1:11434/api/chat -d '{ "model": "qwen2.5:0.5b", "messages": [{"role": "user", "content": "What is 17 plus 25? Answer in one short sentence."}], "stream": false }'
The model name must match one already downloaded in the foreground server's model store. A completed response contains the answer in message.content, done set to true, and done_reason set to stop. The server remains available for further requests while its first terminal stays open.
Related: How to list Ollama models
Related: How to pull an Ollama model