Ubuntu22.04安装RTX3080
1 安装基础环境
更新依赖包
sudo apt-get update
sudo apt-get upgrade
2 安装驱动
(1)查看适合的显卡驱动
# 查看可用的驱动
sudo ubuntu-drivers devices# 返回值,推荐版本:nvidia-driver-550
ERROR:root:aplay command not found
== /sys/devices/pci0000:ae/0000:ae:00.0/0000:af:00.0 ==
modalias : pci:v000010DEd00002216sv00001458sd0000403Fbc03sc00i00
vendor : NVIDIA Corporation
model : GA102 [GeForce RTX 3080 Lite Hash Rate]
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-545-open - distro non-free
driver : nvidia-driver-550 - distro non-free recommended
driver : nvidia-driver-550-open - distro non-free
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : nvidia-driver-535 - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
(2)安装驱动
# 安装驱动nvidia-driver550
sudo apt install nvidia-driver-550# 重启
sudo shutdown -r now
(3)查看驱动
# 查看驱动
nvidia-smi# 返回值,注意查看CUDA的版本号
CUDA Version: 12.4
3 安装CUDA
选择显卡对应版本,驱动对应的大版本即可:12.4
# cuda官网地址
https://developer.nvidia.com/cuda-toolkit-archive
下载地址
# 下载
wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run# 安装
sudo sh cuda_12.4.1_550.54.15_linux.run
安装步骤
# 选择
continue# 输入
accept# 取消安装Driver,前面框中的X消失
[ ] Driver# 选择
Install# 完成安装后,会返回配置路径,一定要记住,用于下面添加环境变量
===========
= Summary =
===========Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-12.4/Please make sure that- PATH includes /usr/local/cuda-12.4/bin- LD_LIBRARY_PATH includes /usr/local/cuda-12.4/lib64, or, add /usr/local/cuda-12.4/lib64 to /etc/ld.so.conf and run ldconfig as rootTo uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-12.4/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 550.00 is required for CUDA 12.4 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 --driverLogfile is /var/log/cuda-installer.log
Continue
Install
安装成功
添加环境变量
# 编辑环境变量文件
sudo vim /etc/profile# 在最后一行添加环境变量
export PATH=$PATH:/usr/local/cuda-12.4/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.4/lib64
export CUDA_HOME=/usr/local/cuda-12.4/# 使环境变量生效
source /etc/profile
查看版本
# 查看版本
nvcc -V# 返回值
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0