ubuntu 安装 cuda

安装 cuda 过程中报错处理

apt-get update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Hit:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Hit:5 http://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial InRelease
Get:6 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  InRelease [1,484 B]
Hit:7 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:8 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64  InRelease
Hit:9 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64  InRelease
Fetched 1,484 B in 1s (1,337 B/s)
Reading package lists... Done
W: http://mirrors.aliyun.com/kubernetes/apt/dists/kubernetes-xenial/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://download.docker.com/linux/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

导出问题key 到指定目录

使用 apt-key list 命令列出 Warning key

apt-key list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

pub   rsa4096 2015-08-12 [SC]
      2388 FF3B E10A 76F6 38F8  0723 FCAE 110B 1118 213C
uid           [ unknown] Launchpad PPA for Graphics Drivers Team

pub   rsa4096 2017-09-28 [SCE]
      C95B 321B 61E8 8C18 09C4  F759 DDCA E044 F796 ECB0
uid           [ unknown] NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>

pub   rsa2048 2021-05-04 [SC]
      35BA A0B3 3E9E B396 F59C  A838 C0BA 5CE6 DC63 15A3
uid           [ unknown] Artifact Registry Repository Signer <artifact-registry-repository-signer@google.com>

pub   rsa2048 2022-05-21 [SC]
      A362 B822 F6DE DC65 2817  EA46 B53D C80D 13ED EF05
uid           [ unknown] Rapture Automatic Signing Key (cloud-rapture-signing-key-2022-03-07-08_01_01.pub)
sub   rsa2048 2022-05-21 [E]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
uid           [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub   rsa4096 2018-09-17 [SC]
      F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>

在这里插入图片描述
导出所有的 warning key 只指定 key id 值的后 8 位即可,导出到/etc/apt/trusted.gpg.d/ 目录下即可,gpg 名字自己随意指定。

apt-key export 0EBFCD88|gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
apt-key export 1118213C|gpg --dearmour -o /etc/apt/trusted.gpg.d/ppa.gpg
apt-key export F796ECB0|gpg --dearmour -o /etc/apt/trusted.gpg.d/cudatools.gpg
apt-key export DC6315A3|gpg --dearmour -o /etc/apt/trusted.gpg.d/artifact-registry-repository-signer.gpg
apt-key export 13EDEF05|gpg --dearmour -o /etc/apt/trusted.gpg.d/cloud-rapture-signing.gpg

删除 warning 的 key 文件

rm /etc/apt/trusted.gpg

重新执行命令即可成功

apt-get update
Hit:1 http://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial InRelease
Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Hit:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Hit:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Get:6 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  InRelease [1,484 B]
Hit:7 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64  InRelease
Hit:8 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:9 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64  InRelease
Fetched 1,484 B in 1s (1,346 B/s)
Reading package lists... Done

安装 cuda

https://developer.nvidia.com/cuda-12-1-1-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network
方法1

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda-repo-ubuntu2204-12-1-local_12.1.1-530.30.02-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-1-local_12.1.1-530.30.02-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda

方法2

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda

方法3

wget https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run
sudo sh cuda_12.1.1_530.30.02_linux.run
export PATH=/usr/local/cuda/bin:$PATH
echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:16:06_PDT_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

相关推荐

  1. Ubuntu 安装Cuda 12

    2024-03-15 15:50:04       43 阅读
  2. Ubuntu20.04安装cuda12.11

    2024-03-15 15:50:04       67 阅读
  3. ubuntu 20 CUDA12.1安装流程

    2024-03-15 15:50:04       44 阅读
  4. ubuntu22.04 安装 docker cuda

    2024-03-15 15:50:04       33 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-15 15:50:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-15 15:50:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-15 15:50:04       87 阅读
  4. Python语言-面向对象

    2024-03-15 15:50:04       96 阅读

热门阅读

  1. 《Effective Modern C++》- 极精简版 36-42条

    2024-03-15 15:50:04       41 阅读
  2. 记录启动Dubbo-admin遇到的问题

    2024-03-15 15:50:04       57 阅读
  3. 软考高级:软件工程集成测试的策略概念和例题

    2024-03-15 15:50:04       48 阅读
  4. Uniapp Vue2 image src动态绑定static目录下的图片

    2024-03-15 15:50:04       44 阅读
  5. 力扣题库第9题:找到字符串中所有的异位词

    2024-03-15 15:50:04       44 阅读
  6. Web安全攻防措施

    2024-03-15 15:50:04       39 阅读
  7. 程序分享--排序算法--冒泡排序

    2024-03-15 15:50:04       41 阅读
  8. int8量化和int16量化的区别

    2024-03-15 15:50:04       45 阅读