适用于Debian系统,GPU版大模型工具ollama运行,需要独立显卡,(Ubuntu执行会出现错误),具体操作如下:
分别新建gpu_install.txt脚本文件:
nano gpu_install1.txt nano gpu_install1.txt
分别执行脚本命令:
sudo sh gpu_install1.txt sudo sh gpu_install2.txt
以下分别为一键脚本cpu_install.txt内容:
第一部分脚本gpu_install1.txt,安装docker和gpu显卡驱动
sudo apt update sudo apt update -y #docker安装 # Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin #gpu 版本 wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update sudo apt-get install -y cuda-drivers curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \ | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \ | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker sudo reboot
第二部分脚本gpu_install2.txt,安装docker版ollama大模型和webui工具maxkb,便于网页调用
#运行docker docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama #加载webui sudo docker run -d --name=maxkb -p 8080:8080 -v ~/.maxkb:/var/lib/postgresql/data 1panel/maxkb
maxkb工具的基础信息
maxkb工具 访问:ip:8080 用户名: admin 密码: MaxKB@123..
原创文章,作者:开心电脑网,如若转载,请注明出处。