Wiki-Quellcode von Fedora Nvidia Treiber installieren
Zuletzt geändert von René Schmidt am 2023/10/18 17:58
Zeige letzte Bearbeiter
| author | version | line-number | content |
|---|---|---|---|
| 1 | = How to Install Nvidia Drivers on Fedora = | ||
| 2 | |||
| 3 | |||
| 4 | [[fedora>>url:https://phoenixnap.com/kb/tag/fedora]][[nvidia>>url:https://phoenixnap.com/kb/tag/nvidia]] | ||
| 5 | |||
| 6 | [[Home>>url:https://phoenixnap.com/kb/]] » [[SysAdmin>>url:https://phoenixnap.com/kb/category/sysadmin]] » How to Install Nvidia Drivers on Fedora | ||
| 7 | |||
| 8 | Contents | ||
| 9 | |||
| 10 | Introduction | ||
| 11 | |||
| 12 | Keeping your GPU drivers up to date ensures system running smoothly and at peak performance. Since Fedora doesn't come with the proprietary Nvidia drivers already installed, administrators need to install and regularly update them. | ||
| 13 | |||
| 14 | **In this tutorial, we will show you how to install Nvidia drivers on Fedora manually or using third-party tools.**[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-heading-image.png||alt="How to install Nvidia drivers on Fedora" height="400" width="799"]] | ||
| 15 | |||
| 16 | Prerequisites | ||
| 17 | |||
| 18 | * A system running Fedora | ||
| 19 | * An account with sudo privileges | ||
| 20 | * Access to the terminal window | ||
| 21 | |||
| 22 | == Install Nvidia Drivers with RPM Fusion == | ||
| 23 | |||
| 24 | Using RPM Fusion lets you automate most of the installation process for Nvidia drivers. | ||
| 25 | |||
| 26 | === Step 1: Enable RPM Fusion Repositories === | ||
| 27 | |||
| 28 | ~1. Start by updating your Fedora system with: | ||
| 29 | |||
| 30 | {{{sudo dnf update}}} | ||
| 31 | |||
| 32 | Type **Y** and press **Enter** to confirm the update when prompted. | ||
| 33 | |||
| 34 | 2. Add the RPM Fusion repositories to your Fedora system. | ||
| 35 | |||
| 36 | **Option 1: Adding RPM Repositories via the Terminal Window** | ||
| 37 | |||
| 38 | Add the RPM repositories using the following commands in the terminal. For free repositories, use: | ||
| 39 | |||
| 40 | {{{sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm}}} | ||
| 41 | |||
| 42 | For non-free repositories, use: | ||
| 43 | |||
| 44 | {{{https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm}}} | ||
| 45 | |||
| 46 | When prompted, type **Y** and press **Enter** to confirm each installation. | ||
| 47 | |||
| 48 | **Option 2: Adding RPM Repositories via GUI** | ||
| 49 | |||
| 50 | Visit the [[RPM Fusion Configuration page>>url:https://rpmfusion.org/Configuration]] and scroll down until you find the link to the free RPM repositories package that matches your version of Fedora. In this example, we are using Fedora 33:[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-01-rpm-gui-link.png||alt="Select the version of RPM repositories that matches your system" height="320" width="800"]] | ||
| 51 | |||
| 52 | Click the link and select the **Open** option in Firefox. Click **OK** to confirm.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-02-rpm-gui-open.png||alt="Open the repository package using Firefox" height="450" width="800"]] | ||
| 53 | |||
| 54 | In Software Center, click the **Install** button to add the RPM repositories to your system. When prompted, enter the administrator password to proceed with the installation.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-03-rpm-gui-install.png||alt="Install the repositories using the Software Center" height="250" width="800"]] | ||
| 55 | |||
| 56 | Repeat the process outlined above for non-free RPM repositories. | ||
| 57 | |||
| 58 | === Step 2: Detect Nvidia Card === | ||
| 59 | |||
| 60 | Use the **lspci** command to detect the model of your GPU: | ||
| 61 | |||
| 62 | {{{lspci | grep VGA}}}[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-04-detect-gpu.png||alt="Detect your GPU model using the lspci command" height="75" width="800"]] | ||
| 63 | |||
| 64 | In this example, we are installing drivers for a GeForce GTX 1060 GPU. | ||
| 65 | |||
| 66 | === Step 3: Install Nvidia Drivers === | ||
| 67 | |||
| 68 | ~1. Depending on your GPU model, use the appropriate command to install corresponding Nvidia drivers. For current GeForce/Quadro/Tesla models, use: | ||
| 69 | |||
| 70 | {{{sudo dnf install akmod-nvidia}}} | ||
| 71 | |||
| 72 | For legacy drivers for GeForce 400/500 models, use: | ||
| 73 | |||
| 74 | {{{sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx}}} | ||
| 75 | |||
| 76 | For legacy drivers for GeForce 8/9/200/300 models, use: | ||
| 77 | |||
| 78 | {{{sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx}}} | ||
| 79 | |||
| 80 | When prompted, type **Y** and press **Enter** to confirm the installation. | ||
| 81 | |||
| 82 | 2. Reboot your system for the installation to take effect: | ||
| 83 | |||
| 84 | {{{sudo reboot}}} | ||
| 85 | |||
| 86 | == Manually Install Nvidia Drivers Using the Official Nvidia.com Package == | ||
| 87 | |||
| 88 | Manually installing Nvidia drivers is a more complex and time-consuming process than using RPM Fusion. However, this method allows for greater customization and more control over which drivers you install. | ||
| 89 | |||
| 90 | **Note:** You have to disable UEFI Secure Boot in your system's BIOS before attempting to install Nvidia drivers manually. | ||
| 91 | |||
| 92 | === Step 1: Detect Nvidia Card === | ||
| 93 | |||
| 94 | Using the **lspci** command, detect your GPU model: | ||
| 95 | |||
| 96 | {{{lspci | grep VGA}}}[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-04-detect-gpu.png||alt="Use the lspci command to detect your GPU model" height="75" width="800"]] | ||
| 97 | |||
| 98 | === Step 2: Download Nvidia Driver === | ||
| 99 | |||
| 100 | ~1. Use the [[Nvidia driver search tool>>url:https://www.nvidia.com/Download/index.aspx]] to find the appropriate driver for your GPU model. Select the series, model, and operating system from the drop-down menus. Download Type should be Production Branch as the other option is for testing purposes. Click **Search** to find the correct driver. | ||
| 101 | |||
| 102 | In this example, we are looking for a GeForce GTX 1060 (Series 10) driver for a 64-bit Linux OS:[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-05-download-driver.png||alt="Nvidia driver search tool" height="300" width="800"]] | ||
| 103 | |||
| 104 | 2. Click the **Download** button to open the download page for the recommended driver.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-06-driver-page-open.png||alt="Click the Download button to open the driver page" height="200" width="800"]] | ||
| 105 | |||
| 106 | Click the **Download** button on the new page to start downloading.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-07-driver-page-dl.png||alt="Click the Download button to start the download" height="150" width="800"]] | ||
| 107 | |||
| 108 | 3. To make the installation process more streamlined, move the driver package in the //Home// directory once the download finishes. | ||
| 109 | |||
| 110 | 4. [[Change the permissions>>url:https://phoenixnap.com/kb/chmod-recursive]] to make the driver package executable: | ||
| 111 | |||
| 112 | {{{chmod +x [path to driver package]}}} | ||
| 113 | |||
| 114 | In this example, we are using: | ||
| 115 | |||
| 116 | {{{chmod +x NVIDIA-Linux-x86_64-470.74.run}}} | ||
| 117 | |||
| 118 | === Step 3: Install Driver Dependencies === | ||
| 119 | |||
| 120 | ~1. Update your Fedora system to the latest version with: | ||
| 121 | |||
| 122 | {{{sudo dnf update}}} | ||
| 123 | |||
| 124 | Press **Y**, then **Enter** to confirm the update when prompted. | ||
| 125 | |||
| 126 | 2. Reboot your system for the update to take effect: | ||
| 127 | |||
| 128 | {{{sudo reboot}}} | ||
| 129 | |||
| 130 | 3. Install the Nvidia driver compilation dependencies with: | ||
| 131 | |||
| 132 | {{{sudo dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig}}} | ||
| 133 | |||
| 134 | Confirm the installation by typing **Y** and pressing **Enter** when prompted. | ||
| 135 | |||
| 136 | === Step 4: Disable Default Drivers === | ||
| 137 | |||
| 138 | ~1. Create and open a new configuration file. In this example, we are using [[nano>>url:https://phoenixnap.com/kb/use-nano-text-editor-commands-linux]]: | ||
| 139 | |||
| 140 | {{{sudo nano /etc/modprobe.d/blacklist.conf}}} | ||
| 141 | |||
| 142 | 2. Add the following lines to the file: | ||
| 143 | |||
| 144 | {{{blacklist nouveau | ||
| 145 | options nouveau modeset=0 | ||
| 146 | }}} | ||
| 147 | |||
| 148 | 3. Save the changes and exit nano by pressing **Ctrl+X**, typing **Y**, and pressing **Enter**. | ||
| 149 | |||
| 150 | 4. Open the Grub loader configuration file: | ||
| 151 | |||
| 152 | {{{sudo nano /etc/default/grub}}} | ||
| 153 | |||
| 154 | 5. Add **rd.driver.blacklist=nouveau** to the end of the line that starts with **GRUB_CMDLINE_LINUX=**. For instance: | ||
| 155 | |||
| 156 | {{{GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=nouveau"}}}[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-08-blacklist-nouveau.png||alt="Edit the Grub configuration file" height="200" width="800"]] | ||
| 157 | |||
| 158 | 6. Press **Crtl+X**, then type **Y** and press **Enter** to save changes and exit. | ||
| 159 | |||
| 160 | 7. Update the Grub configuration file: | ||
| 161 | |||
| 162 | {{{sudo grub2-mkconfig -o /boot/grub2/grub.cfg}}}[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-09-update-grub.png||alt="Updating the Grub configuration file" height="110" width="800"]] | ||
| 163 | |||
| 164 | 8. Remove the Xorg x11 driver with: | ||
| 165 | |||
| 166 | {{{sudo dnf remove xorg-x11-drv-nouveau}}} | ||
| 167 | |||
| 168 | Type **Y** and press **Enter** to confirm. | ||
| 169 | |||
| 170 | 9. [[Rebuild the kernel>>url:https://phoenixnap.com/kb/build-linux-kernel]] **initramfs** using: | ||
| 171 | |||
| 172 | {{{sudo dracut --force /boot/initramfs-$(uname -r).img $(uname -r)}}} | ||
| 173 | |||
| 174 | === Step 5: Reboot to Multi-User Login === | ||
| 175 | |||
| 176 | With the default GPU drivers disabled, you need to **switch to a text-based login** to continue the installation. | ||
| 177 | |||
| 178 | ~1. Enable the text-based, multi-user login with: | ||
| 179 | |||
| 180 | {{{systemctl set-default multi-user.target}}} | ||
| 181 | |||
| 182 | 2. Enter your administrator password in the security prompt and press **Enter** to confirm.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-10-enable-multiuser.png||alt="Switching to multi-user log in" height="110" width="800"]] | ||
| 183 | |||
| 184 | 3. Reboot your system: | ||
| 185 | |||
| 186 | {{{sudo reboot}}} | ||
| 187 | |||
| 188 | === Step 6: Install Nvidia Drivers === | ||
| 189 | |||
| 190 | ~1. Once the system restarts, log in as the administrator.[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-11-tty-login.png||alt="Using the multi-user login prompt to log in as the administrator" height="150" width="800"]] | ||
| 191 | |||
| 192 | 2. Start the installation process by using: | ||
| 193 | |||
| 194 | {{{sudo bash [path to the Nvidia installer package]}}} | ||
| 195 | |||
| 196 | In our example, this is: | ||
| 197 | |||
| 198 | {{{sudo bash NVIDIA-Linux-x86_64-470.74.run}}} | ||
| 199 | |||
| 200 | 3. When prompted, select **Yes** to register the kernel module with DKMS:[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-12-kernel-dkms.png||alt="Registering the kernel module with DKMS" height="110" width="800"]] | ||
| 201 | |||
| 202 | 4. Select **Yes** to install Nvidia's 32-bit compatibility libraries:[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-13-32bit-compatability.png||alt="Installing Nvidia's 32-bit compatibility libraries" height="100" width="800"]] | ||
| 203 | |||
| 204 | 5. Select **Yes** to allow automatic Xorg backup:[[image:https://phoenixnap.com/kb/wp-content/uploads/2021/10/install-nvidia-drivers-fedora-14-xorg-backup.png||alt="Confirming automatic Xorg backup" height="100" width="800"]] | ||
| 205 | |||
| 206 | 6. Once the installation is complete, select **OK** to proceed. | ||
| 207 | |||
| 208 | === Step 7: Enable GUI === | ||
| 209 | |||
| 210 | ~1. Enable the GUI login to start up the new Nvidia drivers and bring back the option of using a GUI like GNOME: | ||
| 211 | |||
| 212 | {{{systemctl set-default graphical.target}}} | ||
| 213 | |||
| 214 | 2. Reboot your system to finish the installation: | ||
| 215 | |||
| 216 | {{{sudo reboot}}} |