Sub topic 3
Installing Ollama and checking that the server is running
This chapter assumes you are comfortable in a terminal and know basic HTTP and JSON. You will install Ollama, confirm that its server is running, and run the first commands that use it.
What gets installed
Ollama installs two things that work together:
- A background server that loads models and answers requests on port 11434.
- A command-line client,
ollama, that sends commands to that server.
The CLI is a thin client. If the server is not running, most CLI commands fail even though the ollama binary exists. Keep this in mind when you troubleshoot.
Install on your platform
- macOS and Windows: download the installer from ollama.com and run it. The app starts the server for you and keeps it running in the background.
- Linux: run the official install script. On most distributions it sets up a
systemdservice namedollama.
curl -fsSL https://ollama.com/install.sh | shPiping a script into your shell runs code you have not read. If that concerns you, download install.sh first and read it, or use the manual install steps in the Ollama documentation.
Check the CLI
Confirm that the binary is on your PATH:
ollama --versionIf you see a version number, the CLI is installed. You may also see a warning that it could not connect to a running instance. That means the server is not up yet.
Check the server
The server answers a plain GET request on its root path:
curl http://localhost:11434A healthy server replies with Ollama is running. You can also ask for the installed version through the API:
curl http://localhost:11434/api/versionThis returns a small JSON object such as {"version":"0.x.y"}. The value on your machine will differ.
Start the server manually
If the check fails, start the server yourself. On Linux, check the service first:
systemctl status ollamaIf you installed without a service, or want to see logs in your terminal, run the server in the foreground:
ollama serveLeave that terminal open and use a second terminal for other commands. If you see an error that the address is already in use, a server is already running on port 11434. Do not start a second one.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| `connection refused` on port 11434 | Server is not running | Start the app, the service, or `ollama serve` |
| `command not found: ollama` | Binary is not on `PATH` | Reopen the terminal or reinstall |
| `address already in use` | Another server already holds the port | Use the existing server |
Exercise
ollama --version works, but ollama list reports that it cannot connect to the server. What does this tell you, and what are two ways to fix it?
Show answer
The CLI is installed, but the server is not running, because the CLI needs the server to answer most commands. Start the server through the desktop app or the systemd service (systemctl start ollama), or run ollama serve in a separate terminal. Then confirm with curl http://localhost:11434, which should reply Ollama is running.