之前就有了解到 Termux 这一无需Root或设置即可使用的适用于 Android 的终端模拟器,接着在后面这几天又接触了解到本地大语言模型运行框架,先计划着是在手机安装体验的,但受限于安装 Debian 这步就先转而在 Linux 上使用 Llama.cpp 了。
环境
硬件环境
没有在手机硬件上使用,使用的是云手机,其配置如下:
- 运行内存:8G
- 运行CPU:4核
- 存储空间:64G
软件环境
- Android 版本:11.0
- Termux 带有软件包的终端模拟器:0.118.3
- Proot-Distro:Proot-Distro version ‘5.0.2’ by Termux (@sylirre).
- Debian:13(Trixie)
- 内核:Linux localhost 6.17.0-PRoot-Distro #1 SMP PREEMPT_DYNAMIC Fri, 10 Oct 2025 00:00:00 +0000 aarch64 GNU/Linux
- Ollama:0.24.0
下载与安装
安装 Termux
- 在 F-Droid 或者某处下载 Termux 即可。
- 将下载到手机的安装包安装即可,但我这一次先安装 F-Droid 后再在里面安装的 Termux 这软件。
- 修改镜像源:
- 其已内置快速替换方法,只需执行:
termux-change-repo
- 根据使用的物理位置网络类型选择:
Mirror group Rotate between several mirrors (re
- 然后再选择:
Mirrors in ChineseAll in Chinese Mainland
- 更新缓存:
pkg update
- 其已内置快速替换方法,只需执行:
安装 Debian
- 下载Proot-Distro:
pkg install proot-distro
- 安装基础镜像:
使用通用分发镜像非常方便,只需执行一句命令即可,例如使用ubuntu 24.04的系统镜像:proot-distro install ubuntu:24.04
- 进入系统:
proot-distro login ubuntu:24.04
本来按照正常来说这样就能成功,但是事情就是不能这么顺利下去,就此我就放弃在手机上体验转而在 Linux 上体验了。
这不在今儿我终于在 proot-distro 官方仓库中一番查看,才发现最终的解决办法既是如此简单。
- 下载镜像:
curl -LO https://github.com/termux/proot-distro/releases/download/v4.26.0/debian-trixie-aarch64-pd-v4.26.0.tar.xz
- 安装镜像:
proot-distro install ./debian-trixie-aarch64-pd-v4.26.0.tar.xz --name debian
- 进入系统:
proot-distro login debian
不久前 proot-distro 升级到 5.0 的版本,已由 Bash 脚本改由 Python 重写。怪不得刚搜索到的教程已经无效。
旧版教程:export PD_OVERRIDE_TARBALL_URL=https://ghfast.top/github.com/termux/proot-distro/releases/download/v4.30.1/ubuntu-questing-aarch64-pd-v4.30.1.tar.xz export PD_OVERRIDE_TARBALL_SHA256=5ab35b90cd9a9f180656261ba400a135c4c01c2da4b74522118342f985c2d328因为 5.0 的版本已经取消
PD_OVERRIDE_TARBALL_URL环境变量的支持。
安装 Ollama
- 进入容器:
proot-distro login debian
- 更新系统:
apt update apt upgrade
- 安装 Ollama:
curl -fsSL https://ollama.com/install.sh | sh
- 启动模型:
ollama run deepseek-r1:1.5b
然后系统所限需要手动启动Ollama:
ollama serve & - 经过“漫长”的等待后即可在命令行中交互使用。
体验
根据前面使用 Ollama 不太成功的经验,执行ollama run deepseek-r1:1.5b启动一个模型,果然在这内存比较大的时候即可成功将这模型跑起来!
参考
- Termux
https://termux.dev/cn/ - Ollama
https://ollama.com/ - An utility for managing installations of the Linux distributions in Termux.
https://github.com/termux/proot-distro - Version 5.0 release notes #666
https://github.com/termux/proot-distro/issues/666 - 提供优化proot-distro下载速度备选方案与python安装方式修正 #87
https://github.com/AstrBotDevs/AstrBot-docs/pull/87/files/141790a1f794b824a09b99e91a9f4c7185b73b58?short_path=5d0c96c#diff-5d0c96c5344aa789e9adc4097b2b7198e09cf0c0dd654e21a0bdfd0edb169fa6
ChiuYut
2026年05月24日