如何使用debian存储库安装NVIDIA驱动程序

时间:2020-03-05 15:25:11  来源:igfitidea点击:

Nvidia Corporation是一家美国技术,专门用于为移动计算和汽车市场的芯片单元(SOC)上的游戏,加密电力和系统设计图形处理单元(GPU)。
对于拥有PC运行Debian操作系统并具有NVIDIA显卡的人来说,我们需要通过直接渲染X服务器安装驱动程序以进行优化的OpenGL应用程序的硬件加速。
本文将介绍如何使用Debian 9存储库安装最新版本的NVIDIA驱动程序。

要识别已安装的视频卡的系统NVIDIA GPU代码名称,请使用LSPCI命令。

$lspci | grep -E "VGA|3D"
01:00.0 3D controller: NVIDIA Corporation GK107M [GeForce  GT 750M] (rev a1)

这将告诉我们系统上是否有NVIDIA显卡。

安装NVIDIA驱动程序

识别后,我们现在可以通过Debian 9上的图形驱动程序安装部分。
注意,Debian 9"弹力"可用多个预编译的驱动程序版本。
截至拉伸Debian释放,我们不再需要nvidia-xconfig和xorg。
在最多的情况下,不需要conf文件。
一切都应该用完盒子。

由于驱动程序可在"Contrib"和"非免费"存储库组件上。
将它们添加到/etc/apt /索道。
列表文件。

$sudo su 
# echo "deb http://httpredir.debian.org/debian/stretch main contrib non-free" >> /etc/apt/sources.list

然后更新缓存索引并进行系统升级。

$sudo apt-get update
$sudo apt-get upgrade && sudo apt-get dist-upgrade
$sudo reboot

在成功执行以上所有上述后,安装适当的Linux-Headers和Kernel模块包:

$sudo apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver nvidia-kernel-dkms

这将安装nvidia-driver包。
DKMS将通过NVIDIA-Kernel-DKMS包为系统构建NVIDIA模块。

对于Nouveau Xorg显示驱动程序被列入黑名单,重新启动系统。
WEVIDIA驱动程序将在后面装入。

$sudo reboot

获取NVIDIA驱动程序版本

使用nvidia-smi命令直接从gpu读取temps,无需使用x。
为此,运行:

$sudo nvidia-smi

它将为我们提供有关NVIDIA驱动程序版本的信息。
NVIDIA模块应适当加载到工作。

获取模块版本

如果由于无法加载NVIDIA模块,则执行上述命令的执行失败,则可以通过直接检索NVIDIA来始终查看NVIDIA版本号。
KO模块使用ModInfo Linux命令。
下面的命令将在当前运行的内核下检查NVIDIA驱动程序版本:

$modinfo /usr/lib/modules/$(uname -r)/kernel/drivers/video/nvidia.ko | grep ^version
version: 390.77

创建空Xorg.conf.

对于系统,我们可能需要删除Xorg。
CONF文件到NVIDIA正常工作。
使用下面的命令。

$sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old
$sudo touch /etc/X11/xorg.conf

并重新启动系统。

手动创建xorg.conf.

如果我们需要修改Xorg。
对于NVIDIA驱动器,下面提供了一种示例配置。

~$cat /etc/X11/xorg.conf
Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection
Section "Files"
EndSection
Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       30.0 - 80.0
    VertRefresh     55.0 - 75.0
    DisplaySize     400 225
    Modeline       "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
    Option         "DPMS"
EndSection
Section "Device"
    Identifier     "Device0"
    BusID          "PCI:1:0:0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Viewport    0 0
        Depth       24
        Modes      "1920x1080_60.00"
    EndSubSection
EndSection

所示的配置是用于1920x1080的分辨率。
要注意的关键事情。

  • 指定正确的Hyperyync和Vertrefresh

我们可以使用:

$gtf 1920 1080 60

然后在模式下添加名称模型。
更改后重新启动XORG服务器。
系统也可能需要重新启动系统。