Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save meisa233/83fe437af1c16dd520bdd8878bd7181a to your computer and use it in GitHub Desktop.
Save meisa233/83fe437af1c16dd520bdd8878bd7181a to your computer and use it in GitHub Desktop.

1. Install Dependencies

# 更新系统
sudo dnf update -y

# 安装编译工具和内核头文件
sudo dnf install -y gcc gcc-c++ make kernel-devel kernel-headers
sudo dnf install -y dkms wget

2. Disable nouveau

sudo vi /etc/modprobe.d/blacklist-nouveau.conf
# add these lines
##########################
blacklist nouveau
options nouveau modeset=0
##########################
sudo dracut --force

3. Download NVIDIA Driver

Download driver from https://www.nvidia.com/en-us/drivers/details/249194/
chmod +x NVIDIA-Linux-x86_64-570.172.08.run
sudo systemctl set-default multi-user.target
sudo reboot

# find kernel
ls -la /usr/src/kernels/
# you can see the folders like that
# /usr/src/kernels/5.10.0-xxx.xxx.xxx.oe2203sp4.x86_64/

# please modify it to true path
sudo ./NVIDIA-Linux-x86_64-570.172.08.run --kernel-source-path=/usr/src/kernels/5.10.0-xxx.xxx.xxx.oe2203sp4.x86_64
Enter Yes, Yes, Yes

4. Install CUDA

find your CUDA version using nvidia-smi
https://developer.nvidia.com/cuda-12-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=RHEL&target_version=8&target_type=runfile_local
Download runfile
chmod +x cuda_12.8.0_570.86.10_linux.run
sudo sh cuda_12.8.0_570.86.10_linux.run

# 编辑 ~/.bashrc
vim ~/.bashrc

# 添加以下行(根据实际安装路径调整)
export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-12.8

# 重新加载环境变量
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment