CentOS에서 부팅 커널 변경하기

OS의 패키지 관리자(YUM, APT)를 통해 업데이트를 하는 경우 Kernel 버전이 올라가기도 합니다. 이에 원하는 커널버전을 선택해서 부팅할 수 있도록 변경하는 포스트입니다.

순서는 간단합니다.

  1. 부팅가능한 커널 목록 출력
  2. 현재 설정된 커널 확인
  3. 원하는 커널로 변경
  4. 변경된 커널 확인
[root@localhost ~]# grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2
CentOS Linux (3.10.0-957.10.1.el7.x86_64) 7 (Core)
CentOS Linux (4.20.2-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-9f9ca89f268c44d3a06d5cbe0904200b) 7 (Core)

[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-957.10.1.el7.x86_64) 7 (Core)

[root@localhost ~]# grub2-set-default "CentOS Linux (4.20.2-1.el7.elrepo.x86_64) 7 (Core)"

[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (4.20.2-1.el7.elrepo.x86_64) 7 (Core)