Centos7安装CUDA和QT

1、禁用默认的驱动nouveau,由于系统默认安装nouveau kernel driver,会与NVIDIA驱动冲突

  • 在/usr/lib/modprobe.d/dist-blacklist.conf中添加两行内容

blacklist nouveau

options nouveau modeset=0

  • 给当前镜像备份

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

  • 建立新的镜像

dracut /boot/initramfs-$(uname -r).img $(uname -r)

  • 重启。输入lsmod | grep nouveau 结果为空,说明禁用成功。

2、下载CUDA,网址:https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=runfilelocal

注意:这里选择安装类型为runfile(local),里面已经包括了安装GPU驱动部分,就不用再下载NVIDAI GPU驱动。把下载好的.run放到home目录下,以便后面查找安装软件在哪。

3、在界面下关闭X Server

  • 通过systemctl stop gdm.service来关掉X Server
  • 通过systemctl --all|grep gdm查看X Server是否关闭【列表中显示inactive或者dead】
  • 在命令行界面中,cd /home转到cuda安装程序所在目录
  • chmod +x cuda_10.1.168_418.67_linux.run

./ cuda_10.1.168_418.67_linux.run             

填accpet,即可安装cuda

  • 通过执行systemctl start gdm.service来启动X Server,进入界面。
  • 查看 /var/log/cuda_installer.log 文件中是否有error,若无,则安装成功。

4、添加环境变量

  • vim /etc/profile文件中添加

export PATH=/usr/local/cuda-10.1/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH

  • # 使生效  source /etc/profile

5、安装QT

网址:https://www.qt.io/offline-installers

  • 安装程序【联网】

chmod u+x qt-creator-opensource-linux-x86_64-4.0.0.run

./qt-creator-opensource-linux-x86_64-4.0.0.run

  • 安装库

yum install gcc-c++

yum install mesa-libGL-devel mesa-libGLU-devel

 

 

猜你喜欢

转载自blog.csdn.net/qq_33457548/article/details/89001952
今日推荐