[GPU] RockyLinux 9.4 환경에서 RKE2 구성 및 GPU 테스트 - III - Nvidia Drivers 설치 > SUSE Rancher자료실

본문 바로가기

사이트 내 전체검색

뒤로가기 SUSE Rancher자료실

[GPU] RockyLinux 9.4 환경에서 RKE2 구성 및 GPU 테스트 - III - Nvidia Drivers 설치

페이지 정보

작성자 꿈꾸는여행자 작성일 25-01-03 17:42 조회 68 댓글 0

본문

안녕하세요.

 

꿈꾸는여행자입니다.

 

 

지난 내용에 계속하여 올립니다. 

 

 

이번 항목에서는 

 

Nvidia Drivers 설치에 대한 요건 확인 내용입니다. 

 

상세 내역은 아래와 같습니다.



감사합니다. 


> 아래 

 


________________



목차 

 

 

 

1. Install Nvidia Drivers

1.1. Nvidia Drivers Installation Preparations

1.1.1. Update Rocky Linux Before Nvidia Drivers Installation

1.1.2. Identifying Your Graphics Card

1.1.3. Checking the Secure Boot Status

1.1.3.1. Secure Boot 비활성화

1.2. Add EPEL Repository For Nvidia Drivers Installation

1.2.1. Setting Up the EPEL Repository for Nvidia Drivers on Rocky Linux

1.2.1.1. Configuring EPEL for Rocky Linux 9

1.2.1.2. Configuring EPEL for Rocky Linux 8

1.3. Finalize NVIDIA Drivers Installation via DNF Commands

1.3.1. Import Nvidia Drivers RPM

1.3.1.1. Adding Nvidia Repository RPM for Rocky Linux 9

1.3.1.2. Adding Nvidia Repository RPM for Rocky Linux 8

1.3.2. Prerequisite Package

1.3.3. Install NVIDIA driver

1.3.3.1. nvidia-driver

1.3.3.2. Install the Specific Driver Version

1.3.3.3. Set CUDA env

 

________________



III. Nvidia 



1. Install Nvidia Drivers

https://linuxcapable.com/how-to-install-nvidia-drivers-on-rocky-linux/#google_vignette

1.1. Nvidia Drivers Installation Preparations

1.1.1. Update Rocky Linux Before Nvidia Drivers Installation

The first thing to do before commencing the installation process is to update your system. Doing so will avoid potential conflicts during the installation, often caused by out-of-date packages. To accomplish this task, the command that you need to execute is:



sudo dnf upgrade --refresh





1.1.2. Identifying Your Graphics Card

As you progress, it’s important to identify the NVIDIA Graphics card installed in your system. Verifying its compatibility will ensure a smooth installation process. However, you can skip this step if you have a newer model, as they are likely supported.



You can use the following command to determine your graphics card model:



lspci | grep -e VGA

[root@host ~]# lspci | grep -e VGA

00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]

01:00.0 VGA compatible controller: NVIDIA Corporation TU117GLM [Quadro T1000 Mobile] (rev a1)

[root@host ~]# 


1.1.3. Checking the Secure Boot Status

If you have secure boot enabled, you might encounter issues during the NVIDIA drivers installation. You might need to either disable it or take additional steps to avoid conflicts. Thus, it’s crucial to check the status of the secure boot.





You can use the following command to verify if secure boot is enabled:



mokutil --sb-state

[root@host ~]# mokutil --sb-state

SecureBoot enabled

[root@host ~]# 


This command will provide output on your terminal, indicating whether the secure boot is active. Depending on your system configuration, you may need to change your setup. Be sure to consult your system documentation or the troubleshooting section if you encounter issues related to secure boot.



1.1.3.1. Secure Boot 비활성화

이 문제를 해결하려면 Secure Boot를 비활성화해야 합니다. Secure Boot가 활성화된 상태에서는 서명되지 않은 커널 모듈이 로드되지 않으므로, 이를 비활성화하면 드라이버 모듈을 정상적으로 로드할 수 있습니다.

Secure Boot를 비활성화하려면 BIOS 설정에서 다음 단계를 따릅니다:

1. 시스템 재부팅 후 BIOS 설정에 들어갑니다 (재부팅 시 F2, F10, Del 등 BIOS 진입 키를 누릅니다).

   1. ThinkPad > 재부팅 시 F1 으로 BIO 진입

2. Secure Boot 설정을 찾아서 비활성화(disable) 합니다.

3. 설정을 저장하고 시스템을 재부팅합니다.

mokutil --sb-state

[root@host ~]# mokutil --sb-state

SecureBoot disabled

[root@host ~]# 




1.2. Add EPEL Repository For Nvidia Drivers Installation

1.2.1. Setting Up the EPEL Repository for Nvidia Drivers on Rocky Linux

Our initial task involves the installation of the EPEL repository. It is advisable to incorporate both repositories for the best outcome.



1.2.1.1. Configuring EPEL for Rocky Linux 9

The first action involves activating the CodeReady Builder (CRB). It can be done using this command:

sudo dnf config-manager --set-enabled crb

[root@host ~]# sudo dnf config-manager --set-enabled crb

[root@host ~]# 


Once the CRB is activated, you can install both EPEL versions. Utilize the command below to complete this process:



sudo dnf install \

    https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \

    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

[root@host ~]# sudo dnf install \

    https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \

    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

Rocky Linux 9 - BaseOS                                                                             1.3 kB/s | 4.1 kB     00:03    

Rocky Linux 9 - AppStream                                                                          2.0 kB/s | 4.5 kB     00:02    

Rocky Linux 9 - CRB                                                                                5.0 kB/s | 4.5 kB     00:00    

epel-release-latest-9.noarch.rpm                                                                   5.2 kB/s |  18 kB     00:03    

epel-next-release-latest-9.noarch.rpm                                                              4.3 kB/s | 7.8 kB     00:01    

Package epel-release-9-8.el9.noarch is already installed.

Dependencies resolved.

===================================================================================================================================

 Package                              Architecture              Version                      Repository                       Size

===================================================================================================================================

Installing:

 epel-next-release                    noarch                    9-8.el9                      @commandline                    7.8 k



Transaction Summary

===================================================================================================================================

Install  1 Package



Total size: 7.8 k

Installed size: 3.1 k

Is this ok [y/N]: y

Downloading Packages:

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                           1/1 

  Installing       : epel-next-release-9-8.el9.noarch                                                                          1/1 

  Verifying        : epel-next-release-9-8.el9.noarch                                                                          1/1 



Installed:

  epel-next-release-9-8.el9.noarch                                                                                                 



Complete!

[root@host ~]# 


1.2.1.2. Configuring EPEL for Rocky Linux 8

To setup the EPEL for Rocky Linux 8, you can use the following command:

sudo dnf install \

    https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \

    https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm



In the context of these instructions, we are activating and integrating an additional repository of software packages to your Linux distribution. This will broaden the selection of software you can install and ensure compatibility with your specific Rocky Linux version.



1.3. Finalize NVIDIA Drivers Installation via DNF Commands

1.3.1. Import Nvidia Drivers RPM

The upcoming process requires the installation of the NVIDIA drivers repository sourced from NVIDIA itself. The reason behind this is the convenience it brings by providing immediate access to newly released updates.



Ensure the repository aligns well with your specific Rocky Linux distribution while importing it into your system.





1.3.1.1. Adding Nvidia Repository RPM for Rocky Linux 9

Use the command below to incorporate the repository into Rocky Linux 9:

sudo dnf config-manager --add-repo \

    http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo

[root@host ~]# sudo dnf config-manager --add-repo \

    http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo

Adding repo from: http://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo

[root@host ~]# 


1.3.1.2. Adding Nvidia Repository RPM for Rocky Linux 8

For Rocky Linux 8, the command changes slightly as follows:

sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/$(uname -i)/cuda-rhel8.repo


1.3.2. Prerequisite Package

Following the repository import, it’s recommended that the necessary dependencies be installed. Some of them might be pre-installed, but running the following command ensures their presence:



sudo dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r) tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-opengl libglvnd-glx libglvnd-devel acpid pkgconfig dkms

[root@host ~]# sudo dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r) tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-opengl libglvnd-glx libglvnd-devel acpid pkgconfig dkms

Last metadata expiration check: 0:01:50 ago on Thu 17 Oct 2024 01:50:08 PM KST.

Package kernel-headers-5.14.0-427.37.1.el9_4.x86_64 is already installed.

Package tar-2:1.34-6.el9_4.1.x86_64 is already installed.

Package bzip2-1.0.8-8.el9.x86_64 is already installed.

Package make-1:4.3-8.el9.x86_64 is already installed.

Package gcc-11.4.1-3.el9.x86_64 is already installed.

Package gcc-c++-11.4.1-3.el9.x86_64 is already installed.

Package pciutils-3.7.0-5.el9.x86_64 is already installed.

Package libglvnd-opengl-1:1.3.4-1.el9.x86_64 is already installed.

Package libglvnd-glx-1:1.3.4-1.el9.x86_64 is already installed.

Package pkgconf-pkg-config-1.7.3-10.el9.x86_64 is already installed.

Dependencies resolved.

===================================================================================================================================

 Package                              Architecture          Version                                 Repository                Size

===================================================================================================================================

Installing:

 acpid                                x86_64                2.0.32-7.el9                            appstream                 63 k

 automake                             noarch                1.16.2-8.el9                            appstream                662 k

 dkms                                 noarch                3.1.0-2.el9                             epel                      82 k

 elfutils-libelf-devel                x86_64                0.190-2.el9                             appstream                 20 k

 kernel-devel                         x86_64                5.14.0-427.37.1.el9_4                   appstream                 20 M

 libglvnd-devel                       x86_64                1:1.3.4-1.el9                           appstream                155 k

Installing dependencies:

 autoconf                             noarch                2.69-38.el9                             appstream                666 k

 bison                                x86_64                3.7.4-5.el9                             appstream                921 k

 flex                                 x86_64                2.6.4-9.el9                             appstream                308 k

 kernel-devel-matched                 x86_64                5.14.0-427.37.1.el9_4                   appstream                4.7 M

 libX11-devel                         x86_64                1.7.0-9.el9                             appstream                939 k

 libXau-devel                         x86_64                1.0.9-8.el9                             appstream                 13 k

 libglvnd-core-devel                  x86_64                1:1.3.4-1.el9                           appstream                 17 k

 libxcb-devel                         x86_64                1.13.1-9.el9                            appstream                1.0 M

 m4                                   x86_64                1.4.19-1.el9                            appstream                294 k

 perl-File-Compare                    noarch                1.100.600-481.el9                       appstream                 12 k

 perl-File-Copy                       noarch                2.34-481.el9                            appstream                 19 k

 perl-Thread-Queue                    noarch                3.14-460.el9                            appstream                 21 k

 perl-threads                         x86_64                1:2.25-460.el9                          appstream                 57 k

 perl-threads-shared                  x86_64                1.61-460.el9.0.1                        appstream                 44 k

 xorg-x11-proto-devel                 noarch                2022.2-1.el9                            appstream                263 k



Transaction Summary

===================================================================================================================================

Install  21 Packages

Complete!

[root@host ~]# 




1.3.3. Install NVIDIA driver

1.3.3.1. nvidia-driver 

Once done, it’s time to integrate the most recent NVIDIA drivers using:

* You might encounter a prompt inquiring about importing GPG keys during this step. Should this happen, respond affirmatively with a “Yes.”

# 삭제

dnf list installed | grep nvidia



sudo dnf remove nvidia-driver*



sudo dnf module reset nvidia-driver





# 설치

sudo dnf module install nvidia-driver:latest-dkms



sudo dnf module install nvidia-driver:555-dkms

sudo dnf module install nvidia-driver:550-dkms

[root@host ~]# sudo dnf module install nvidia-driver:latest-dkms

Last metadata expiration check: 0:04:39 ago on Thu 17 Oct 2024 01:50:08 PM KST.

Dependencies resolved.

===================================================================================================================================

 Package                               Architecture         Version                          Repository                       Size

===================================================================================================================================

Installing group/module packages:

 kmod-nvidia-latest-dkms               x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                49 M

 libnvidia-cfg                         x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               151 k

 libnvidia-fbc                         x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                97 k

 libnvidia-ml                          x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               617 k

 nvidia-driver                         x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               6.1 M

 nvidia-driver-cuda                    x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               450 k

 nvidia-driver-cuda-libs               x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                41 M

 nvidia-driver-libs                    x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               150 M

 nvidia-kmod-common                    noarch               3:560.35.03-1.el9                cuda-rhel9-x86_64                44 M

 nvidia-libXNVCtrl                     x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                23 k

 nvidia-libXNVCtrl-devel               x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                51 k

 nvidia-modprobe                       x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                29 k

 nvidia-persistenced                   x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                32 k

 nvidia-settings                       x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64               842 k

 nvidia-xconfig                        x86_64               3:560.35.03-1.el9                cuda-rhel9-x86_64                92 k

Installing dependencies:

 dnf-plugin-nvidia                     noarch               2.2-1.el9                        cuda-rhel9-x86_64                14 k

 egl-gbm                               x86_64               2:1.1.2-1.el9                    cuda-rhel9-x86_64                21 k

 egl-wayland                           x86_64               1.1.13.1-2.el9                   cuda-rhel9-x86_64                42 k

 libvdpau                              x86_64               1.5-11.el8                       cuda-rhel8-x86_64                17 k

 ocl-icd                               x86_64               2.2.13-4.el9                     appstream                        51 k

 opencl-filesystem                     noarch               1.0-15.el9                       appstream                       7.4 k

Installing module profiles:

 nvidia-driver/default                                                                                                            

Enabling module streams:

 nvidia-driver                                              latest-dkms                                                           



Transaction Summary

===================================================================================================================================

Install  21 Packages

Importing GPG key 0xD42D0685:

 Userid     : "cudatools <cudatools@nvidia.com>"

 Fingerprint: 610C 7B14 E068 A878 070D A4E9 9CD0 A493 D42D 0685

 From       : https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/D42D0685.pub

Is this ok [y/N]: y

Complete!

[root@host ~]# reboot

[root@host ~]# 


As an alternative, Nvidia RPM modules can be listed using the command:

* Here’s another image depicting an example output from this process:

sudo dnf module list nvidia-driver


cuda-rhel9-x86_64

nvidia-driver      555-dkms             default [d], fm, ks           Nvidia driver for 555-dkms branch       


1.3.3.2. Install the Specific Driver Version

Install the NVIDIA driver and the CUDA toolkit for version 12.5.1:

* 10분 소요

sudo dnf install cuda-12-5 nvidia-driver-cuda nvidia-driver-cuda-libs



sudo dnf install \

    cuda-12-4 \

    nvidia-driver-cuda \

    nvidia-driver-cuda-libs



1.3.3.3. Set CUDA env

CUDA를 사용하려면 `.bashrc` 파일에 CUDA 경로를 추가하여 환경 변수를 설정해야 합니다. 아래 명령을 실행하여 환경 변수를 설정합니다.



echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc

echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc 

source ~/.bashrc

[root@host ~]# echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc

[root@host ~]# echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc

[root@host ~]# source ~/.bashrc 

[root@host ~]# tail -n 2 ~/.bashrc 

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

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

[root@host ~]# 




________________

 

 

댓글목록 0

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

PC 버전으로 보기