收起左侧

零刻Gti12显卡坞+5060TI+ollama

3
回复
1069
查看
[ 复制链接 ]

3

主题

6

回帖

0

牛值

fnOS系统内测组

2025-5-15 00:49:44 显示全部楼层 阅读模式
悬赏1飞牛币未解决

折腾了2天(下班时间),在官网搜索发现有5060TI的驱动,便试着在飞牛里安装5060TI的驱动和CUDA ,终于成功了。Snipaste_2025-05-15_00-34-06.png

切换到root账号
sudo -i
输入密码,回车
# 更新软件源列表
apt-get update

# 升级已安装的软件包
#apt-get upgrade

# 安装gcc相关依赖
sudo apt-get install aptitude
sudo apt-get install build-essential

安装 aptitude,参考给出的solution选一个合适的。给出的第一个方案如果没有安**uild-essential,继续输入no直到出现安**uild-essential的方案

 
##安装驱动之前,需要禁用nouveau(nouveau 是专门用来逆向工程 NVIDIA 闭源驱动的开源驱动项目),因为ubuntu安装时会默认安装nouveau驱动,如果不禁用,会阻碍NVIDIA官方驱动的安装。

 **禁用nouveau**

 sudo vim /etc/modprobe.d/blacklist.conf

 **在文件末尾添加,打开如无内容,直接添加以下内容**

blacklist nouveau
options nouveau modeset=0
####
blacklist vga16fb
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
####
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off

ctrl+o,回车,ctrl+x,保存文件。
##s更新当前内核   
sudo update-initramfs -u

 **重启计算机,查看nouveau是否禁用成功**
sudo reboot

lsmod | grep nouveau


********************************************************************************************************************************
安装驱动
驱动地址:https://www.nvidia.cn/geforce/drivers/ ,按照自己的显卡选择驱动,注意操作系统选择操作系统:
Linux 64-bit。
下载完驱动,上传到任意文件夹,我的是放在 /vol1/1000/Tools/nvidia 目录下,自己的修改下实际位置
cd /vol1/1000/Tools/nvidia
sudo chmod +x NVIDIA-Linux-x86_64-580.105.08.run

sudo ./NVIDIA-Linux-x86_64-580.105.08.run -m=kernel-open -no-opengl-files -no-x-check -no-nouveau-check --dkms

参数说明:
 -m=kernel-open: 指定内核版本
 -no-x-check:安装驱动时关闭 X 服务
 -no-nouveau-check:安装驱动时禁用 nouveau
 -no-opengl-files:只安装驱动文件,不安装 OpenGL 文件
 --dkms 避免手动编译问题

加载完驱动安装程序后,按<-和-选择,回车间确认。
1########################################################################################################################
Multiple kernel module types are available for this system. Which would you like to use?

                           NVIDIA Proprietary                                                                      MIT/GPL
######################################################### NVIDIA Proprietary#############################################

2########################################################################################################################
WARNING: nvidia-installer was forced to guess the X library path '/usr/lib' and X module path '/usr/lib/xorg/modules'; 
these paths were not queryable from the system.  If X fails to find the NVIDIA X driver module, please install the `pkg-config`
           utility and the X.Org SDK/development package for your distribution and reinstall the driver.                                                                                         

                                                                      OK
######################################################## OK #############################################################

3########################################################################################################################
WARNING: Unable to find a suitable destination to install 32-bit compatibility libraries. Your system may not be set up for 32-bit compatibility. 
32-bit compatibility files will not be installed; if you wish to install them, re-run the installation 
           and set a valid directory with the --compat32-libdir option.
                                                                        OK
########################################################### OK ##########################################################

4########################################################################################################################
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?
  Any pre-existing X configuration file will be backed up.
                                                                                                                                                                                                 
                                        Yes                                         No
############################################################### YES #####################################################

5########################################################################################################################
Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 575.57.08) is now complete.  
Please update your xorg.conf file as appropriate; see the file /usr/share/doc/NVIDIA_GLX-1.0/README.txt for details.

                                                               OK
######################################################### OK ###########################################################
‍
6########################################################################################################################
Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if your kernel changes later.
                                                                                                                                                                                                 
                                          Yes                                            No
################################################################# yes ####################################################

驱动安装完成,然后挂载重启系统。
 ##挂载 Nvidia 驱动
sudo modprobe nvidia
 #10、查看驱动是否安装成功
nvidia-smi

## 重启系统
reboot

#监控显卡状态
watch -n 1 nvidia-smi

Thu Sep 25 15:48:58 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.82.07              Driver Version: 580.82.07      CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Com** M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5060 Ti     Off |   00000000:01:00.0 Off |                  N/A |
|  0%   31C    P8              4W /  180W |       0MiB /  16311MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+


Cuda下载
cd /vol1/1000/Tools/nvidia
wget https://developer.download.nvidia.com/com**/cuda/13.0.2/local_installers/cuda_13.0.2_580.95.05_linux.run

sudo sh cuda_13.0.2_580.95.05_linux.run

# 1.输入 accept 接受安装
**──────────────────────────────────────────────────────────────────────────────**
**  End User License Agreement                                                  **
**  --------------------------                                                  **
**                                                                              **
**  NVIDIA Software License Agreement and CUDA Supplement to                    **
**  Software License Agreement.                                                 **
**                                                                              **
**  The CUDA Toolkit End User License Agreement applies to the                  **
**  NVIDIA CUDA Toolkit, the NVIDIA CUDA Samples, the NVIDIA                    **
**  Display Driver, NVIDIA Nsight tools (Visual Studio Edition),                **
**  and the associated documentation on CUDA APIs, programming                  **
**  model and development tools. If you do not agree with the                   **
**  terms and conditions of the license agreement, then do not                  **
**  download or use the software.                                               **
**                                                                              **
**  Last updated: January 12, 2025                                              **
**                                                                              **
**                                                                              **
**  Preface                                                                     **
**  -------                                                                     **
**                                                                              **
**──────────────────────────────────────────────────────────────────────────────**
** Do you accept the above EULA? (accept/decline/quit):                         **
**                                                                              **
**──────────────────────────────────────────────────────────────────────────────**
‍输入 accept,回车

# 2.空格去除驱动,,光标移到Install,安装cuda
**──────────────────────────────────────────────────────────────────────────────**
** CUDA Installer                                                               **
** - [ ] Driver                                                                 **
**      [ ] 580.65.06                                                           **
** + [X] CUDA Toolkit 13.0                                                      **
**   [X] CUDA Documentation 13.0                                                **
** - [ ] Kernel Objects                                                         **
**      [ ] nvidia-fs                                                           **
**   Options                                                                    **
**   Install                                                                    **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
** Up/Down: Move | Left/Right: Expand | 'Enter': Select | 'A': Advanced options **
**──────────────────────────────────────────────────────────────────────────────**

**──────────────────────────────────────────────────────────────────────────────**
** A symlink already exists at /usr/local/cuda. Update to this installation?    **
** Yes                                                                          **
** No                                                                           **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
**                                                                              **
** Up/Down: Move | 'Enter': Select                                              **
**──────────────────────────────────────────────────────────────────────────────**
yes
#####################################################安装成功提示########################################
===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-13.0/

Please make sure that
 -   PATH includes /usr/local/cuda-13.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-13.0/lib64, or, add /usr/local/cuda-13.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-13.0/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 580.00 is required for CUDA 13.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver

Logfile is /var/log/cuda-installer.log
######################################################################################################


#配置cuda环境变量
sudo vim /etc/profile
export PATH=$PATH:/usr/local/cuda-13.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-13.0/lib64

#生效配置
source /etc/profile

#查看安装版本
nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Wed_Aug_20_01:58:59_PM_PDT_2025
Cuda compilation tools, release 13.0, V13.0.88
Build cuda_13.0.r13.0/compiler.36424714_0


#安装 NVIDIA Container Toolkit:用于在 Docker 容器中启用 GPU。
#官方配置地址,配置内容会有更新,以实际配置信息为准(debain):https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
按顺序执行以下安装命令,部分命令网络加载较慢,执行时间较长

sudo apt-get update && sudo apt-get install -y --no-install-recommends \
   curl \
   gnupg2

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 sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update

export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.18.0-1
  sudo apt-get install -y \
      nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}

#######################################部分执行命令后内容日志###########################################
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit nvidia-container-toolkit-base
0 upgraded, 4 newly installed, 0 to remove and 184 not upgraded.
Need to get 5,929 kB of archives.
After this operation, 28.2 MB of additional disk space will be used.
Get:1 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  libnvidia-container1 1.17.8-1 [924 kB]
Get:2 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  libnvidia-container-tools 1.17.8-1 [20.8 kB]  
Get:3 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  nvidia-container-toolkit-base 1.17.8-1 [3,795 kB]   
Get:4 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  nvidia-container-toolkit 1.17.8-1 [1,189 kB]  
Fetched 5,929 kB in 19min 49s (4,986 B/s)                                                  
Selecting previously unselected package libnvidia-container1:amd64.
(Reading database ... 72304 files and directories currently installed.)
Preparing to unpack .../libnvidia-container1_1.17.8-1_amd64.deb ...
Unpacking libnvidia-container1:amd64 (1.17.8-1) ...
Selecting previously unselected package libnvidia-container-tools.
Preparing to unpack .../libnvidia-container-tools_1.17.8-1_amd64.deb ...
Unpacking libnvidia-container-tools (1.17.8-1) ...
Selecting previously unselected package nvidia-container-toolkit-base.
Preparing to unpack .../nvidia-container-toolkit-base_1.17.8-1_amd64.deb ...
Unpacking nvidia-container-toolkit-base (1.17.8-1) ...
Selecting previously unselected package nvidia-container-toolkit.
Preparing to unpack .../nvidia-container-toolkit_1.17.8-1_amd64.deb ...
Unpacking nvidia-container-toolkit (1.17.8-1) ...
Setting up nvidia-container-toolkit-base (1.17.8-1) ...
Setting up libnvidia-container1:amd64 (1.17.8-1) ...
Setting up libnvidia-container-tools (1.17.8-1) ...
Setting up nvidia-container-toolkit (1.17.8-1) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
ldconfig: /usr/local/lib/libzmq.so.5 is not a symbolic link
#########################################################################################

看到 ldconfig: /usr/local/lib/libzmq.so.5 is not a symbolic link,安装完成。
配置docker环境,重启docker生效。

sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker

docker配置nvidia运行环境:
sudo vim /etc/docker/daemon.json,增加以下内容
{
  "default-runtime": "nvidia",
  "runtimes": {
    "nvidia": {
      "path": "nvidia-container-runtime",
      "runtimeArgs": []
    }
  }
}

systemctl daemon-reload && systemctl restart docker

docker中如果已经安装过ollama,先关闭ollama,点击重置,然后启动,显卡生效

完整daemon.json文件内容参考:

{
    "data-root": "/vol1/docker",
    "insecure-registries": [
        "127.0.0.1:19827"
    ],
    "live-restore": true,
    "log-driver": "json-file",
    "log-opts": {
        "max-file": "5",
        "max-size": "100m"
    },
    "proxies": {},
    "registry-mirrors": [
	    "https://docker.1ms.run",
	    "https://proxy.1panel.live",
	    "https://docker.amingg.com",
        "https://docker.fnnas.com",
        "https://docker.ketches.cn",
        "https://registry.hub.docker.com"
    ],
	"default-runtime": "nvidia",
    "runtimes": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    }
}

附件: 您需要 登录 才可以下载或查看,没有账号?立即注册
收藏
送赞 5
分享

本帖子中包含更多资源

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

x

0

主题

4

回帖

0

牛值

江湖小虾

2025-5-18 02:29:33 显示全部楼层

能给个教程嘛? 十分感谢

0

主题

1

回帖

0

牛值

江湖小虾

2025-8-23 17:42:14 显示全部楼层
您好,如果您能分享一下实现的过程,我将非常感激,真的很想实现gpu推理....谢谢!

3

主题

6

回帖

0

牛值

fnOS系统内测组

2025-11-18 19:06:03 楼主 显示全部楼层
😂一直没看消息,有空就整理发上来。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则