Install Ollama on Linux and Expose It Safely

Install Ollama on Linux, run a first model, verify the local API and understand why port 11434 should not be exposed to the public internet without authentication.

Choose the model before the server

Ollama simplifies local model execution, but it does not remove model resource requirements. Estimate memory, disk and accelerator needs from the exact model and quantization you plan to run. A small CPU-only test and a production inference service are different workloads.

Safe network design

Ollama listens locally by default. Keep that boundary unless you have added an authenticated application or a protected reverse proxy. Do not publish port 11434 directly to the internet.

Operational checklist

  • Pin and document the model names used by your application.
  • Reserve enough disk space for model files and updates.
  • Monitor memory pressure, response latency and service restarts.
  • Restrict firewall rules to the application hosts that need the API.
  • Test backup and rebuild procedures; model files can usually be downloaded again, but configuration and application data must be protected.

Sources and next steps

Use the official Ollama Linux documentation and quickstart as the source of truth. If you need a browser interface, continue with the Open WebUI deployment guide.

Environment and requirements

  • Operating system: 64-bit Linux with systemd
  • CPU: Depends on model; 4 cores is a practical starting point
  • Memory: Must exceed the selected model footprint
  • Storage: Model files plus at least 20 GiB free space
  • Network: Keep port 11434 private; use an authenticated gateway

Step 1: Confirm the host architecture and capacity

Confirm the Linux architecture, free disk and available memory. Select a model that fits the machine rather than assuming every model will run well.

bash
uname -m
free -h
df -h

Expected result: The command completes without an error and the described service or file is available.

Step 2: Install Ollama

Use the current installation command from the official Linux documentation, then inspect the installed version.

bash
curl -fsSL https://ollama.com/install.sh | sh
ollama --version

Expected result: The command completes without an error and the described service or file is available.

Warning: Review remote installation scripts before execution and use only the current official source.

Step 3: Check the service

On systemd-based distributions, confirm the service is active and inspect its recent logs if startup fails.

bash
systemctl status ollama --no-pager
journalctl -u ollama --no-pager -n 100

Expected result: The command completes without an error and the described service or file is available.

Step 4: Run a first model

Run a model listed in the official library. The first launch downloads model files, so time and disk usage vary.

bash
ollama run gemma3

Expected result: The command completes without an error and the described service or file is available.

Step 5: Verify the local API

Verify the API from the same host. Keep the port private and connect remote applications through an authenticated layer.

bash
curl http://127.0.0.1:11434/api/generate -d '{"model":"gemma3","prompt":"Hello","stream":false}'

Expected result: The command completes without an error and the described service or file is available.

RELATED SERVER OPTIONS

Only if you need hosting

These options match the scenario in this guide. Verify current price and specifications before buying; AIOOS may earn a commission at no extra cost to you.

RainYun

RainYun Los Angeles 8 vCPU / 16 GB

Contextual hosting option; verify current price and workload fit before purchase.

8 vCPU · 16 GB · 30 GB system disk
Check current offer
RESOURCES I USE · REFERRAL

Two services to compare when you are ready to launch

This is not an automated ranking, and neither service is necessary for everyone. These are services I use, with the use case and limitations kept visible.

Cloud server · Used for early projects

RainYun

A practical candidate for a website or small service. Choose by user region, configuration and measured workload rather than the lowest headline price.

Referral disclosure: these links contain my referral information. I may receive a platform benefit if you sign up or order, at no additional charge from AIOOS. Check the order page for current pricing, availability, regions and terms. Read the full affiliate disclosure