ubuntu 22.04 LTS TensorRT 安装

本文详细描述了在Ubuntu22.04上安装CUDA12.1,处理GPU驱动黑列表,更新initramfs,添加NVIDIACUDA仓库,安装TensorRT及相关Python库,以及设置Docker环境的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先安装 cuda 12.1



    Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

    blacklist nouveau
    options nouveau modeset=0

    Regenerate the kernel initramfs:

    sudo update-initramfs -u




sudo apt-get install linux-headers-$(uname -r) \
&& sudo apt-key del 7fa2af80 \
&& 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.0/local_installers/cuda-repo-ubuntu2204-12-1-local_12.1.0-530.30.02-1_amd64.deb \
&& sudo dpkg -i cuda-repo-ubuntu2204-12-1-local_12.1.0-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


TensorRT 安装命令:

   98  sudo dpkg -i nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb
   99  sudo cp /var/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0/nv-tensorrt-local-42B2FC56-keyring.gpg /usr/share/keyrings/
  100  sudo apt-get update
  101  sudo apt-get install tensorrt

  107  python3 -m pip install numpy
  108  sudo apt-get install python3-libnvinfer-dev
  109  python3 -m pip install protobuf
  110  sudo apt-get install uff-converter-tf
  111  python3 -m pip install numpy onnx
  112  sudo apt-get install onnx-graphsurgeon
  113  dpkg-query -W tensorrt
  114  history

安装 docker engine 并 pull nvidia docker image:

https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository


https://hub.docker.com/r/nvidia/cuda/tags?page=1&name=ubuntu22

docker pull nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值