[Linux服务器] 【笔记】linux离线部署Ollama+Deepseek r1+open webui

744 0
Honkers 2025-8-14 23:16:51 来自手机 | 显示全部楼层 |阅读模式

昨天看到了实验室服务器文件夹下面有一个deepseek的gguf文件,就顺便部署一下
至于为什么要本地呢?https://chat.deepseek.com/downloads/DeepSeek%20Privacy%20Policy.html


可能有一些学术隐私的东西不方便被收集吧。(我应该没有关系,反正都是学术垃圾)

此外,也要感谢deepseek的开源精神!!!!!!

实验室服务器是ubuntu 18(没人管理升级),不能上外网。
看了一眼lm studio的linux,要求ubuntu20
https://lmstudio.ai/docs/system-requirements,所以选择了ollama。


在这里选择ollama+open webui进行部署。

1. 安装ollama

1.1 ollama是什么

这里就不多赘述了,别的大佬和成熟的文章都写了
Ollama是一个支持在Windows、Linux和MacOS上本地运行大语言模型的工具。它允许用户非常方便地运行和使用各种大语言模型,比如Qwen模型等。用户只需一行命令就可以启动模型。

有一种Docker的感觉。

1.2 安装ollma

这里主要参考这篇文章:
linux离线安装Ollama并完成大模型配置(无网络)

ollama在github里面推荐使用sh安装,当然也有手动自定义配置。我们这里就直接参考上面的文章,修改sh文件,使用本地安装包进行安装。

1.2.1. 下载安装包

可以去github的release页面下载:https://github.com/ollama/ollama/releases


或者直接在官网下载:https://ollama.com/download/ollama-linux-amd64.tgz。我这里是amd64,就选择对应的安装包即可

1.2.2. 新建sh文件并运行

这里就直接参考上面文章了。

  1. 在安装包同一目录下,新建一个install.sh文件,文本编辑器编辑,写入以下内容:
  1. #!/bin/sh
  2. # This script installs Ollama on Linux.
  3. # It detects the current operating system architecture and installs the appropriate version of Ollama.
  4. set -eu
  5. status() {
  6. echo ">>> $*" >&2; }
  7. error() {
  8. echo "ERROR $*"; exit 1; }
  9. warning() {
  10. echo "WARNING: $*"; }
  11. TEMP_DIR=$(mktemp -d)
  12. cleanup() {
  13. rm -rf $TEMP_DIR; }
  14. trap cleanup EXIT
  15. available() {
  16. command -v $1 >/dev/null; }
  17. require() {
  18. local MISSING=''
  19. for TOOL in $*; do
  20. if ! available $TOOL; then
  21. MISSING="$MISSING $TOOL"
  22. fi
  23. done
  24. echo $MISSING
  25. }
  26. [ "$(uname -s)" = "Linux" ] || error 'This script is intended to run on Linux only.'
  27. ARCH=$(uname -m)
  28. case "$ARCH" in
  29. x86_64) ARCH="amd64" ;;
  30. aarch64|arm64) ARCH="arm64" ;;
  31. *) error "Unsupported architecture: $ARCH" ;;
  32. esac
  33. IS_WSL2=false
  34. KERN=$(uname -r)
  35. case "$KERN" in
  36. *icrosoft*WSL2 | *icrosoft*wsl2) IS_WSL2=true;;
  37. *icrosoft) error "Microsoft WSL1 is not currently supported. Please use WSL2 with 'wsl --set-version <distro> 2'" ;;
  38. *) ;;
  39. esac
  40. VER_PARAM="${OLLAMA_VERSION:+?version=$OLLAMA_VERSION}"
  41. SUDO=
  42. if [ "$(id -u)" -ne 0 ]; then
  43. # Running as root, no need for sudo
  44. if ! available sudo; then
  45. error "This script requires superuser permissions. Please re-run as root."
  46. fi
  47. SUDO="sudo"
  48. fi
  49. NEEDS=$(require curl awk grep sed tee xargs)
  50. if [ -n "$NEEDS" ]; then
  51. status "ERROR: The following tools are required but missing:"
  52. for NEED in $NEEDS; do
  53. echo " - $NEED"
  54. done
  55. exit 1
  56. fi
  57. for BINDIR in /usr/local/bin /usr/bin /bin; do
  58. echo $PATH | grep -q $BINDIR && break || continue
  59. done
  60. OLLAMA_INSTALL_DIR=$(dirname ${
  61. BINDIR})
  62. status "Installing ollama to $OLLAMA_INSTALL_DIR"
  63. $SUDO install -o0 -g0 -m755 -d $BINDIR
  64. $SUDO
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行