読者です 読者をやめる 読者になる 読者になる

AKAI TSUKI

System development or Technical something

Upgrade CentOS 7 kernel to the latest version.

現在のバージョン
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# uname -r
3.10.0-327.el7.x86_64
[root@localhost ~]#
elrepoの利用設定

インストール

[root@localhost ~]# rpm -ivh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Retrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
warning: /var/tmp/rpm-tmp.oEb3Ys: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:elrepo-release-7.0-2.el7.elrepo  ################################# [100%]
[root@localhost ~]# vi /etc/yum.repos.d/elrepo.repo

設定ファイル/etc/yum.repos.d/elrepo.repoを
viにて[elrepo-kernel]のところで"enabled=1"へ変更します。

[root@localhost ~]# vi /etc/yum.repos.d/elrepo.repo

[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=http://elrepo.org/linux/kernel/el7/$basearch/
        http://mirrors.coreix.net/elrepo/kernel/el7/$basearch/
        http://jur-linux.org/download/elrepo/kernel/el7/$basearch/
        http://repos.lax-noc.com/elrepo/kernel/el7/$basearch/
        http://mirror.ventraip.net.au/elrepo/kernel/el7/$basearch/
mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-kernel.el7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
古いカーネルのtools削除
[root@localhost ~]# yum list installed |grep kernel
kernel.x86_64                         3.10.0-327.el7                   @anaconda
kernel-tools.x86_64                   3.10.0-327.el7                   @anaconda
kernel-tools-libs.x86_64              3.10.0-327.el7                   @anaconda
[root@localhost ~]# yum remove kernel-tools.x86_64 kernel-tools-libs.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package kernel-tools.x86_64 0:3.10.0-327.el7 will be erased
---> Package kernel-tools-libs.x86_64 0:3.10.0-327.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                          Arch                  Version                          Repository                Size
========================================================================================================================
Removing:
 kernel-tools                     x86_64                3.10.0-327.el7                   @anaconda                236 k
 kernel-tools-libs                x86_64                3.10.0-327.el7                   @anaconda                 18 k

Transaction Summary
========================================================================================================================
Remove  2 Packages

Installed size: 254 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Erasing    : kernel-tools-3.10.0-327.el7.x86_64                                                                   1/2
  Erasing    : kernel-tools-libs-3.10.0-327.el7.x86_64                                                              2/2
  Verifying  : kernel-tools-3.10.0-327.el7.x86_64                                                                   1/2
  Verifying  : kernel-tools-libs-3.10.0-327.el7.x86_64                                                              2/2

Removed:
  kernel-tools.x86_64 0:3.10.0-327.el7                     kernel-tools-libs.x86_64 0:3.10.0-327.el7

Complete!
[root@localhost ~]#
新しいカーネルのインストール
[root@localhost ~]# yum list kernel-ml.x86_64 kernel-ml-devel.x86_64 kernel-ml-headers.x86_64 kernel-ml-tools.x86_64 kernel-ml-tools-libs.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * elrepo: ftp.ne.jp
 * elrepo-kernel: ftp.ne.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Available Packages
kernel-ml.x86_64                                          4.6.2-1.el7.elrepo                               elrepo-kernel
kernel-ml-devel.x86_64                                    4.6.2-1.el7.elrepo                               elrepo-kernel
kernel-ml-headers.x86_64                                  4.6.2-1.el7.elrepo                               elrepo-kernel
kernel-ml-tools.x86_64                                    4.6.2-1.el7.elrepo                               elrepo-kernel
kernel-ml-tools-libs.x86_64                               4.6.2-1.el7.elrepo                               elrepo-kernel
[root@localhost ~]# yum install -y kernel-ml.x86_64 kernel-ml-devel.x86_64 kernel-ml-headers.x86_64 kernel-ml-tools.x86_64 kernel-ml-tools-libs.x86_64
 (省略)
[root@localhost ~]#
GRUB設定変更
[root@localhost ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
CentOS Linux (4.6.2-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.18.2.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-119b2a8116a44dacb83061ddd7ff6bd2) 7 (Core)
[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.6.2-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.6.2-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.18.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.18.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-119b2a8116a44dacb83061ddd7ff6bd2
Found initrd image: /boot/initramfs-0-rescue-119b2a8116a44dacb83061ddd7ff6bd2.img
done
[root@localhost ~]#
再起動
[root@localhost ~]# reboot

再起動後に確認する。

[root@localhost ~]# uname -r
4.6.2-1.el7.elrepo.x86_64
[root@localhost ~]#