# How to Use Deepseek with a Private Ollama Server

# **Introduction**

With the power of Ollama and the ease of Tailscale VPN, you can host a private AI model server that is both accessible and secure, allowing for local chat, code assistance, and remote access from mobile devices.

# **Ollama**

Let's start by installing Ollama, which helps serve LLM models. Install [Ollama](https://github.com/ollama/ollama/blob/main/README.md#quickstart) on the server machine using the official installer or system package managers. Then, download the models that are compatible with the machine. The latest [Deepseek-R1](https://ollama.com/library/deepseek-r1) models, 7B and 8B, require 16 GB of memory and can run on a MacBook Pro. After installation, make sure Ollama is working:

```bash
# Choose the model that can run on your hardware
ollama run deepseek-r1:7b
```

# Local AI code assitant

With the Ollama server running, you can use it for code assistance. You can use the open-source [Continue](https://www.continue.dev/) plugin for VSCode or IntelliJ IDEs. To use the local LLM, you need to configure the `config.json`.

Interestingly, you can use Deepseek to modify the config JSON itself! Set the context with the config.json, the Deepseek model, and then prompt:

`update file to use ollama with deepseek`

Here’s a screenshot of the chat

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1738176420474/7a361f5b-a101-4fb4-8c5e-dccc6fff8d54.png align="center")

# **Tailscale**

Tailscale allows you to create software defined networks. This is a secure alternative to something like ngrok. Install Tailscale on the server and clients using the preferred method (e.g., Homebrew for macOS or package managers for Linux/Windows) or [App Store](https://apps.apple.com/us/app/tailscale/id1470499037). Login with your preferred auth service, e.g. Google is supported.

## **Connect Devices**

If you do not want to use CLI, just visit the [admin console](https://login.tailscale.com/admin/machines) to add devices. There are apps available for iOS, Android and other OS.

Remember to note down the IP or DNS hostname of the server machine and mobile devices.

## **Configure Ollama to Use Tailscale Server**

```bash
# MacOS example 
launchctl setenv OLLAMA_HOST "<tailscale hostname>"
# Adjust port numbers as necessary based on your setup.
```

## **Access Models Across Devices**

Ensure ollama is running:

```bash
ollama serve
```

Now, install ollama compatible app on the mobile device. [Enchanted](https://github.com/gluonfield/enchanted) works well for iOS. In the settings, set ollama server as the tailscal IP/Hostname with the port 11434

Now, you can use the ollama model from the private server on the mobile device.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1738176472741/3fa9c454-5740-4cb9-8964-6c55adaa42ce.png align="right")
