0%

80. Ubuntu 显卡安装

  • 全部命令

    1
    2
    3
    4
    5
    6
    ubuntu-drivers devices
    sudo apt install nvidia-440
    sudo apt install nvidia-driver-440
    reboot
    lshw -numeric -C display
    lspci -vnn | grep VGA
  • 具体步骤

    方法一

    1. 禁用显卡的方法这里在记一下:在/etc/modprobe.d/blacklist.conf里添加,如下内容,并执行 sudo update-initramfs -u,
      1
      2
      blacklist nouveau
      options nouveau modeset=0
    2. 重启后用lsmod | grep nouveau,如果没有任何输出说明禁用成功。

      但是我并没有禁用显卡

    3. 直接输入: sudo ubuntu-drivers autoinstall
    4. 验证是否安装成功:nvidia-smi

方法二 (推荐)

  1. 如果需要安装新版本的驱动可以先添加源:
    1
    2
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
  2. 执行 ubuntu-drivers devices,如下所示:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00001C8Csv00001028sd00000798bc03sc00i00
    vendor : NVIDIA Corporation
    model : GP107M [GeForce GTX 1050 Ti Mobile]
    driver : nvidia-driver-390 - third-party free
    driver : nvidia-driver-430 - distro non-free
    driver : nvidia-driver-415 - third-party free
    driver : nvidia-driver-435 - distro non-free
    driver : nvidia-driver-440 - third-party free recommended
    driver : nvidia-driver-410 - third-party free
    driver : xserver-xorg-video-nouveau - distro free builtin
  3. 选择 recommended (推荐的) 安装: sudo apt install nvidia-driver-440
  4. 可使用下面命令,查看是否安装成功
    1
    2
    lshw -numeric -C display
    lspci -vnn | grep VGA
    显示结果:
    1. lshw -numeric -C display
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      WARNING: you should run this program as super-user.
      *-display
      description: VGA compatible controller
      product: GP107M [GeForce GTX 1050 Ti Mobile] [10DE:1C8C]
      vendor: NVIDIA Corporation [10DE]
      physical id: 0
      bus info: pci@0000:01:00.0
      version: a1
      width: 64 bits
      clock: 33MHz
      capabilities: vga_controller bus_master cap_list rom
      configuration: driver=nvidia latency=0
      resources: irq:128 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff
      *-display
      description: VGA compatible controller
      product: Intel Corporation [8086:591B]
      vendor: Intel Corporation [8086]
      physical id: 2
      bus info: pci@0000:00:02.0
      version: 04
      width: 64 bits
      clock: 33MHz
      capabilities: vga_controller bus_master cap_list rom
      configuration: driver=i915 latency=0
      resources: irq:127 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64) memory:c0000-dffff
      WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
    2. lspci -vnn | grep VGA
      1
      2
      00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:591b] (rev 04) (prog-if 00 [VGA controller])
      01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] [10de:1c8c] (rev a1) (prog-if 00 [VGA controller])
      参考网址