Ollama makes running large language models on Linux as simple as running a Docker container. One command installs everything — no CUDA setup, no Python dependencies.
Step 1 — Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
Step 2 — Pull and Run a Model
# Pull Llama 3 (latest Meta model)
ollama pull llama3
# Run interactively
ollama run llama3
# Pull Mistral (faster, lighter)
ollama pull mistral
ollama run mistral
Step 3 — List Available Models
ollama list
# Shows: NAME, ID, SIZE, MODIFIED
# See all available models
# https://ollama.com/library
Step 4 — Use the REST API
# Ollama runs API on port 11434 by default
curl http://localhost:11434/api/generate -d '{"model":"llama3","prompt":"What is nginx?","stream":false}'
# Chat API (OpenAI compatible)
curl http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"llama3","messages":[{"role":"user","content":"Explain Docker in one paragraph"}]}'
Step 5 — Configure Ollama Service
# Ollama installs as systemd service automatically
sudo systemctl status ollama
sudo systemctl restart ollama
# Change listen address (default: localhost only)
sudo nano /etc/systemd/system/ollama.service
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_NUM_PARALLEL=2"
Environment="OLLAMA_MAX_LOADED_MODELS=2"
sudo systemctl daemon-reload
sudo systemctl restart ollama
Step 6 — Secure with Nginx
server {
listen 443 ssl;
server_name ai.yourdomain.com;
auth_basic "AI Server";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
proxy_pass http://127.0.0.1:11434;
proxy_set_header Host $host;
proxy_read_timeout 300s;
}
}
Step 7 — Manage Models
# Delete a model
ollama rm llama2
# Copy/rename
ollama cp llama3 my-custom-llama
# Show model info
ollama show llama3
Conclusion
Ollama is the fastest way to get AI running on a Linux server. Our team installs and configures Ollama and AI server environments for production use.
Comments