Ollama Installation

1. Install backend:

curl -fsSL https://ollama.com/install.sh | sh
sudo systemctl start ollama

2. Install frontend:

docker run -d -p [yourPort]:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

reference:

Download Ollama

Install Open WebUI

option:

download model: eg:

ollama pull michaelneale/deepseek-r1-goose

check downloaded model: eg:

ollama list

delete downloaded model: eg:

ollama rm mistral

run model: eg:

ollama run michaelneale/deepseek-r1-goose

Set to be externally monitored:

sudo vi /etc/systemd/system/ollama.service

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/home/krugle/.local/bin:/home/krugle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/krugle/.cache/lm-studio/bin:/home/krugle/.cache/lm-studio/bin"
Environment="OLLAMA_HOST=0.0.0.0:11434" #you will add this line
Environment="OLLAMA_MODELS=/your/desired/path" #you will add this line

[Install]
WantedBy=default.target

You need to launch Ollama before you can pull or run models:

ollama serve

what models are currently loaded into memory:

ollama ps

3. WSL Port Forwarding (example)

This step allows external devices in your LAN (other PCs, phones, etc.) to access the services running inside WSL2. Without it, only the host machine can access Ollama or WebUI.

1) Check WSL internal IP

# Inside WSL terminal:
ip addr show eth0
hostname -I

Note the IP address like 172.22.xxx.xxx. Call it WSL_IP.

2) Add port forwarding

Run the following in Windows PowerShell (replace WSL_IP with the value you found above):

netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=WSL_IP connectport=3000

3) Allow firewall

Make sure Windows Firewall allows inbound connections for ports 3000.

Notes

  • Without this step, the services are only accessible from the host machine.
  • With this step, other LAN devices can access:
    • WebUI: http://Windows_IP:3000

Check the current state:

netsh interface portproxy show all

delete the config:

netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=0.0.0.0

留下评论

通过 WordPress.com 设计一个这样的站点
从这里开始