[PR #2432] [CLOSED] Snap packaging #10886

Closed
opened 2026-04-12 23:14:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/2432
Author: @mz2
Created: 2/9/2024
Status: Closed

Base: mainHead: snap


📝 Commits (4)

📊 Changes

5 files changed (+112 additions, -1 deletions)

View changed files

📝 .gitignore (+2 -1)
snap/hooks/configure (+4 -0)
snap/hooks/install (+8 -0)
snap/local/snap_launcher.sh (+14 -0)
snap/snapcraft.yaml (+84 -0)

📄 Description

Adds strictly confined snap packaging for x86-64 (and arm64 just x86-64 for starters, looks like this needs overall a bit of love in ollama), presently published on the channel latest/beta. This is a nice alternative to docker (no need to install and configure the nvidia docker runtime for example, systemd service is set up automatically, over-the-air updates, straightforward to access resources and data from user's host system within the limits of the application's confinement) and safer than bare installation onto host system with the shell script that some users might not want to go ahead with (strict confinement ~= containerised analogously to docker from the host system).

Installable with:

sudo snap install ollama --channel latest/beta
  • strict confinement used with network, network-bind, home, removable-media, opengl interfaces in use, i.e. it can access and serve a port, access home directory and /media, and access the GPU (the opengl interface also grants access to CUDA etc).
  • starts up a systemd service automatically with ollama serve.
  • if removable media access is needed (e.g. user prefers storing models under a disk mounted under /media), sudo snap connect ollama:removable-media (for security reasons, removable media access not granted without user action).

If this looks interesting, I'm happy to hand over the package on snapcraft.io to an ollama maintainer, and can contribute CI integration to make it easy to keep the snap package up to date whenever you release.

If you want to build this locally, after installing snapcraft and either the multipass or LXD provider for it go to the root directory of the repository, and ...:

snapcraft

Configuration

  • host configurable in style sudo snap set ollama host=0.0.0.0:12345 (changing the config value will automatically restart the systemd service)
  • models directory configurable in style sudo snap set ollama models=/your/preferred/path/to/your/models (changing the config value will automatically restart the service)
  • when calling ollama from the shell, automatically calls it with OLLAMA_HOST and OLLAMA_MODELS set based on above configuration (i.e. no need for setting these in bashrc etc).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/2432 **Author:** [@mz2](https://github.com/mz2) **Created:** 2/9/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `snap` --- ### 📝 Commits (4) - [`a3d809c`](https://github.com/ollama/ollama/commit/a3d809c21ee7222d7f07e4dd0c6cd2c94c3c6c84) Snap packaging - [`542f323`](https://github.com/ollama/ollama/commit/542f3232fb1ee409edf935c5188cba2dde64630c) Merge branch 'ollama:main' into snap - [`26f7904`](https://github.com/ollama/ollama/commit/26f79045baf0c095afc628b140f04c6b6e2a5605) Update to v0.1.30 - [`c7005c9`](https://github.com/ollama/ollama/commit/c7005c931a2f7561d38da719f51d4621866c3884) Build v0.1.32 ### 📊 Changes **5 files changed** (+112 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -1) ➕ `snap/hooks/configure` (+4 -0) ➕ `snap/hooks/install` (+8 -0) ➕ `snap/local/snap_launcher.sh` (+14 -0) ➕ `snap/snapcraft.yaml` (+84 -0) </details> ### 📄 Description Adds strictly confined snap packaging for x86-64 (~~and arm64~~ just x86-64 for starters, looks like this needs overall a bit of love in `ollama`), presently published on the channel `latest/beta`. This is a nice alternative to docker (no need to install and configure the nvidia docker runtime for example, systemd service is set up automatically, over-the-air updates, straightforward to access resources and data from user's host system within the limits of the application's confinement) and safer than bare installation onto host system with the shell script that some users might not want to go ahead with (strict confinement ~= containerised analogously to docker from the host system). Installable with: ```bash sudo snap install ollama --channel latest/beta ``` - strict confinement used with [`network`](https://snapcraft.io/docs/network-interface), [`network-bind`](https://snapcraft.io/docs/network-bind-interface), [`home`](https://snapcraft.io/docs/home-interface), [`removable-media`](https://snapcraft.io/docs/removable-media-interface), [`opengl`](https://snapcraft.io/docs/opengl-interface) interfaces in use, i.e. it can access and serve a port, access home directory and `/media`, and access the GPU (the `opengl` interface also grants access to CUDA etc). - starts up a systemd service automatically with `ollama serve`. - if removable media access is needed (e.g. user prefers storing models under a disk mounted under `/media`), `sudo snap connect ollama:removable-media` (for security reasons, removable media access not granted without user action). If this looks interesting, I'm happy to hand over the package on snapcraft.io to an ollama maintainer, and can contribute CI integration to make it easy to keep the snap package up to date whenever you release. If you want to build this locally, [after installing `snapcraft` and either the multipass or LXD provider for it](https://snapcraft.io/docs/snapcraft-setup) go to the root directory of the repository, and ...: ```bash snapcraft ``` ## Configuration - **host** configurable in style `sudo snap set ollama host=0.0.0.0:12345` (changing the config value will automatically restart the systemd service) - **models** directory configurable in style `sudo snap set ollama models=/your/preferred/path/to/your/models` (changing the config value will automatically restart the service) - when calling `ollama` from the shell, automatically calls it with `OLLAMA_HOST` and `OLLAMA_MODELS` set based on above configuration (i.e. no need for setting these in `bashrc` etc). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:14:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#10886