一、安裝NVIDIA驅動
檢查電腦是否配有Nvidia顯卡
/usr/sbin/lspci | grep -i nvidia
安裝顯卡檢測程序
ELRepo源安裝顯卡驅動
ELRepo項目(yum源)側重於硬件相關的包來增強你的經驗與企業Linux, 包括文件系統驅動,顯卡驅動,網絡驅動程序,聲音驅動,攝像頭和視頻驅動程序。 適用於RHEL-7, SL-7 or CentOS-7。
添加ELRepo源去官網查找:http://elrepo.org/tiki/tiki-index.php
# 導入公共密鑰
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# 安裝ELRepo(對於CentOS-7)
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
安裝顯卡檢測程序
# 安裝顯卡檢測程序
yum install nvidia-detect
# 查找合適的驅動
nividia-detect
安裝驅動,可以yum search 也可以去NVIDIA官網下載驅動,因爲這個版本的驅動在yum源裏搜索不到,因此我採用了方法二
方法一:yum search
# 查看軟件源中的驅動程序
yum search kmod-nvidia
# 安裝驅動
yum -y install kmod-nvidia.x86_64
方法二:去英偉達官網下載驅動安裝
在官網,按照剛剛的條件填寫搜索信息:https://www.geforce.cn/drivers
找到符合要求的驅動版本,下載:
更新kernel版本
# 方法一
# 查看當前kernel包
rpm -qa | grep kernel
# kernel版本升級
yum update -y
# 方法二
# 查看可用的內核
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
# 下載安裝需要的內核
yum --enablerepo=elrepo-kernel install kernel-ml
安裝內核頭文件
# The version of the kernel your system is running can be found by running the following command: $ uname -r
$ yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
很不幸。。自己去下吧!
安裝 kernel-devel-3.10.0-693.el7.x86_64.rpm和kernel-headers-3.10.0-693.el7.x86_64.rpm
# -i 安裝
# -v 可視化
# -h 顯示安裝進度
# --force kernel-doc.noarch
# --nodeps 當要安裝的rpm包依賴其他包時,即使其他包沒有安裝,也要安裝這個包
rpm -ivh kernel-devel-3.10.0-693.el7.x86_64.rpm
rpm -ivh kernel-headers-3.10.0-693.el7.x86_64.rpm
# 升級一個包
rpm -Uvh 包名
# 查詢一個包是否安裝
rpm -q 包名
# 卸載一個rpm包
rpm -e 包名
安裝gcc、g++編譯器
yum install gcc gcc-c++
安裝顯卡驅動
sh NVIDIA-Linux-x86_64-410.78.run --kernel-source-path=/usr/src/kernels/3.10.0-693.el7.x86_64/
又。雙。。叒。。。叕。。。。
切換到根權限,再重新安裝
# 輸入init3進入文本模式
init 3
驗證是否安裝成功
nvidia-smi
終於成功了嗚嗚嗚------------------------------------------------------------------------------------------------------------------------------------
卸載驅動。。總會用到的。。
# 顯卡驅動.run文件安裝
sh NVIDIA-Linux-x86-270.41.19.run --uninstall
# yum安裝
# 確定是否是yum安裝
yum list installed
# 卸載
yum remove [package]