June/리눅스

CentOS 커널 업데이트, GPU 서버 Nvidia update 하기

상황

CentOS 7 환경에서 커널을 업데이트 하고 싶다.
하지만 NCP에서 제공하는 GPU는 yum 레파지토리에서 3.10.0-530까지만 제공을 한다.
최신버전인 3.10.0-1127.19로 버전 업그레이드를 해야한다

해결

  • repository 참조 변경
    기존의 repository는 패키지가 많이 부족하였다. 더 많은 리소스를 참조하도록 범용적인 레파지토리로 설정을 변경해준다.
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  • 커널 업데이트
    리눅스의 커널을 업데이트 해준다.
    단, 시스템을 재부팅 해야 변경 사항이 적용된다.
    아래의 명령어로 먼저 리눅스 커널 버전을 확인한다.
uname -r

  • 업데이트 진행
    최종적으로 1127의 원하는 버전이 커널 리스트에 출력되는 것을 확인할 수 있다.
    하지만 시스템을 리부팅 하기 전가지는 구버전이다.
    그래서 시스템 리부트도 같이 진행해준다.
yum update -y kernel
grub2-editenv list
systemctl reboot

  • 커널 업데이트 및 그래픽 카드 빌드를 위한 환경 세팅
    하기 명령어들은 리눅스에 있는 기본 gpu 그래픽 드라이버 사용을 제거하고(nvidia와 충돌 가능)
    환경의 초기세팅을 담당한다.
    이 과정에서 시스템이 또 한번 리부팅 된다.
yum install -y kernel-devel kernel-headers gcc make
echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist.conf
dracut /boot/initramfs-$(uname -r).img $(uname -r) --force
reboot

  • nvidia 그래픽 드라이버 세팅
    아래의 명령어를 치면 에러가 뜨는게 확인 가능하다. 커널이 업데이트 된다면 될 떄마다 nvidia도 같이 빌드 업데이트를 해줘야 한다.
nvidia-smi

  • 설치
    nvidia의 홈페이지에 가서 리눅스 LTS 최신 버전의 도메인을 카피뜬다.
    실제로 압축이 해제된 run 파일을 구동하면 설치 창으로 넘어가게 되는데 전부 okay, yes를 눌러주면 넘기면 된다. 그리고 다시 nvidia 그래픽 카드 정보를 조회하면 최신이 뜨는것을 확인할 수 있다.
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/450.66/NVIDIA-Linux-x86_64-450.66.run
sh NVIDIA-Linux-x86_64-450.66.run
nvidia-smi