Skip to content

ElNandes/OllamaRemoteServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Ollama on Mac Mini with Remote Access via SSH

This guide explains how to set up and run Ollama (a local LLM framework) on a Mac Mini, and access it from another laptop via SSH.

📌 Prerequisites

  • A Mac Mini running macOS
  • A laptop (Linux/macOS) to access it remotely
  • SSH access to the Mac Mini

🚀 Step 1: Install Ollama on Mac Mini

  1. Open Terminal on your Mac Mini.

  2. Download and install Ollama:

    curl -fsSL https://ollama.com/install.sh | sh
  3. Verify installation:

    ollama --version
  4. Download LLM (mistral)

    ollama pull mistral

🔑 Step 2: Set Up SSH Key Authentication (Optional, Recommended)

To avoid entering passwords every time you connect via SSH, set up key-based authentication.

On Your Laptop (Client)

  1. Generate an SSH key (if not already created):
    ssh-keygen -t ed25519 -f ~/.ssh/ssh_key_mac_mini -C "Mac Mini Access"
  2. Copy the public key to your Mac Mini:
    ssh-copy-id -i ~/.ssh/ssh_key_mac_mini.pub user@MAC_IP_ADDRESS
    (Replace user with your Mac Mini username and MAC_IP_ADDRESS with its IP.)

On Your Mac Mini

Ensure SSH key authentication is enabled:

sudo nano /etc/ssh/sshd_config

Check for these lines:

PubkeyAuthentication yes
PasswordAuthentication no

Restart SSH:

sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd

🌐 Step 3: Start Ollama Server on Mac Mini

Run Ollama in the background:

ollama serve &

To check if it's running:

ps aux | grep ollama

🔗 Step 4: Access Ollama Remotely via SSH

On Your Laptop

  1. SSH into your Mac Mini:
    ssh -i ~/.ssh/ssh_key_mac_mini user@MAC_IP_ADDRESS
  2. Send a request to Ollama (example with mistral model):
    curl http://localhost:11434/api/generate -d '{"model": "mistral", "prompt": "Hello!"}'

🔗 Step 5: List and Remove LLM

When LLM is no longer needed

  1. List LLM:
    ollama list
  2. Remove LLM:
    ollama rm mistral

🛠️ Troubleshooting

Find Mac Mini's IP Address

ipconfig getifaddr en0

Check SSH Logs (Mac Mini)

sudo log stream --process sshd

Manually Add SSH Key to Agent (Laptop)

ssh-add ~/.ssh/ssh_key_mac_mini

🎯 Summary

  • Installed Ollama on Mac Mini
  • Set up SSH key authentication
  • Started Ollama server and accessed it via SSH from another laptop

Now you can use your Mac Mini as a remote local LLM server! 🚀

About

This guide explains how to set up and run Ollama (a local LLM framework) on a Mac Mini, and access it from another laptop via SSH.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors