首页 / 安装部署 / Ubuntu 22.4 服务器版安装3090显卡驱动与CUDA

Ubuntu 22.4 服务器版安装3090显卡驱动与CUDA

2024-10-02 12:44:49安装部署 阅读 82
为了在本机电脑运行chatglm3-6b,特地给电脑配了一张3090的显卡,并安装了Ubuntu 22.4的系统。现把在Ubuntu 22.4下安装cuda记录一下,无桌面Linux操作明显与windows不同。

安装cuda成果展示

Ubuntu 22.4成功安装cuda效果展示

解决GCC问题

根据遇到的过的坑,我的笔记里第一步就是解决系统gcc问题。

可通过 https://docs.nvidia.com/cuda/archive/12.4.1/cuda-installation-guide-linux/index.html 查看12.4.1对 gcc版本要求。

cuda与gcc版本要求截图

这个页面的入口在 https://developer.nvidia.com/cuda-toolkit-archive 上,对应版本的 Versioned Online Documentation 链接,installation-guide-linux 菜单。

root@ss:/usr/tmp# gcc -v
Command 'gcc' not found, but can be installed with:
通过个命令,发现gcc未安装。

如果没有gcc,安装一次
root@ss:/usr/tmp# gcc -v
Command 'gcc' not found, but can be installed with:
安装一次
apt update
apt install gcc-11 g++-11
gcc -v
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11
update-alternatives --config gcc
ln -sf /usr/bin/gcc /usr/bin/cc
再次查看gcc版本
root@ss:/usr/tmp# gcc --version
gcc (Ubuntu 11.4.0-9ubuntu1) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

解决初装系统的其它依赖

#如果是新的初装系统,可能会少很多开发依赖,直接一次搞起。
apt install build-essential

卸载与禁用自带驱动

apt-get remove --purge nvidia*
#不存在则创建
vim /etc/modprobe.d/blacklist-nouveau.conf 
#添加以下
blacklist nouveau
options nouveau modeset=0
#更新并重启
update-initramfs -u
reboot

安装步骤

root@ss:/usr/tmp# lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GA102 [GeForce RTX 3090] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GA102 High Definition Audio Controller (rev a1)
root@ss:/usr/tmp# wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run

你可以通过 https://developer.nvidia.com/cuda-toolkit-archive 查看更多其它cuda版本,笔者在这里用12.4.1并不是特定的,个人喜好,之前租用别的算力云的时候,也是这个版本。

wget下载完成之后,执行安装。【PS:我主要是root用户,如果你是普通用户运行要sudo】

root@ss:/usr/tmp# chmod 777 cuda_12.4.1_550.54.15_linux.run
root@ss:/usr/tmp# ./cuda_12.4.1_550.54.15_linux.run

Ubuntu 22.4安装3090 cuda步骤

安装成功

Ubuntu 22.4安装3090 cuda步骤 结果展示

运行 nvidia-smi

nvidia-smi 截图展示

本文《Ubuntu 22.4 服务器版安装3090显卡驱动与CUDA》由爱思考吧 isres.com 分享,转载请注明出处。本文网址:https://www.isres.com/bushu/Ubuntu-3090-cuda.html

本站主要收集测评能够节省时间和提升效率的软件工具并分享使用与学习的过程和感受,任何情况下用户都需遵守所使用软件资源的相关协议。与《Ubuntu 22.4 服务器版安装3090显卡驱动与CUDA》有关的本站文章及资源仅供个人学习交流使用,相关资源请下载后24小时内删除,请勿用于其它用途,因此产生的任何问题由您自行承担。

相关推荐

猜你喜欢