Fedora 41 CUDA and CUDNN Setup
Fedora 41 CUDA and CUDNN Setup
``` bash
sudo dnf update -y
```
``` bash
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$
(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-
nonfree-release-$(rpm -E %fedora).noarch.rpm
```
``` bash
sudo dnf config-manager setopt fedora-cisco-openh264.enabled=1
```
``` bash
sudo dnf update -y
```
``` bash
sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda
```
### Replace the free version of FFmpeg with the full version
``` bash
sudo dnf swap ffmpeg-free ffmpeg --allowerasing
```
``` bash
sudo dnf update @multimedia --setopt="install_weak_deps=False" --
exclude=PackageKit-gstreamer-plugin
```
``` bash
sudo dnf install libva-nvidia-driver.{i686,x86_64}
```
------------------------------------------------------------------------
``` bash
sudo dnf install gcc-13
sudo dnf install g++-13
```
### Backup the current GCC binary and set GCC 13 as the default
``` bash
sudo mv /usr/bin/gcc /usr/bin/gcc.bak
sudo ln -s /etc/alternatives/gcc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 50
sudo update-alternatives --set gcc /usr/bin/gcc-13
```
### Backup the current G++ binary and set G++ 13 as the default
``` bash
sudo mv /usr/bin/g++ /usr/bin/g++.bak
sudo ln -s /etc/alternatives/g++ /usr/bin/g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 50
sudo update-alternatives --set g++ /usr/bin/g++-13
```
``` bash
gcc --version
g++ --version
```
``` bash
sudo rm /usr/bin/gcc
sudo mv /usr/bin/gcc.bak /usr/bin/gcc
sudo rm /usr/bin/g++
sudo mv /usr/bin/g++.bak /usr/bin/g++
```
------------------------------------------------------------------------
## CUDA Installation
``` bash
sudo dnf5 group install "development-tools" -y
```
``` bash
sudo dnf install -y make kernel-devel dkms
```
``` bash
wget https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/
cuda_12.5.1_555.42.06_linux.run
sudo sh cuda_12.5.1_555.42.06_linux.run
```
``` bash
export PATH=/usr/local/cuda-12.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH
```
``` bash
source ~/.zshrc
```
``` bash
source ~/.bashrc
```
``` bash
nvcc --version
```
------------------------------------------------------------------------
## CUDNN Installation
``` bash
wget https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-
x86_64/cudnn-linux-x86_64-9.3.0.75_cuda12-archive.tar.xz
```
``` bash
tar -xvf cudnn-linux-x86_64-9.3.0.75_cuda12-archive.tar.xz
```
``` bash
sudo cp cudnn-*-archive/include/* /usr/local/cuda-12.5/include/
sudo cp cudnn-*-archive/lib/* /usr/local/cuda-12.5/lib64/
```
``` bash
sudo chmod a+r /usr/local/cuda-12.5/include/cudnn*.h
/usr/local/cuda-12.5/lib64/libcudnn*
```
``` bash
cat /usr/local/cuda-12.5/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
```