{"id":12932,"date":"2019-03-29T03:17:09","date_gmt":"2019-03-29T03:17:09","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12932"},"modified":"2019-03-29T03:17:09","modified_gmt":"2019-03-29T03:17:09","slug":"how-to-install-or-upgrade-to-kernel-5-0-in-centos-7-2","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/how-to-install-or-upgrade-to-kernel-5-0-in-centos-7-2\/","title":{"rendered":"How to Install or Upgrade to Kernel 5.0 in CentOS 7"},"content":{"rendered":"<p>Although some people use the word\u00a0<strong>Linux<\/strong>\u00a0to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries.<\/p>\n<p>During normal operations, the kernel is responsible for performing two important tasks:<\/p>\n<ol>\n<li>Acting as an interface between the hardware and the software running on the system.<\/li>\n<li>Managing system resources as efficiently as possible.<\/li>\n<\/ol>\n<p>To do this, the kernel communicates with the hardware through the drivers that are built into it or those that can be later installed as a module.<\/p>\n<p>For example, when an application running on your machine wants to connect to a wireless network, it submits that request to the kernel, which in turns uses the right driver to connect to the network.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/upgrade-kernel-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">How to Upgrade Kernel in Ubuntu<\/a><\/p>\n<p>With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions.<\/p>\n<p>Ready to update your kernel on\u00a0<strong>CentOS 7<\/strong>\u00a0or one of their derivatives such as<strong>\u00a0RHEL 7<\/strong>\u00a0and\u00a0<strong>Fedora<\/strong>? If so, keep reading!<\/p>\n<h3>Step 1: Checking Installed Kernel Version<\/h3>\n<p>When we install a distribution it includes a certain version of the Linux kernel. To show the current version installed on our system we can do:<\/p>\n<pre># uname -sr\r\n<\/pre>\n<p>The following image shows the output of the above command in a\u00a0<strong>CentOS 7<\/strong>\u00a0server:<\/p>\n<div id=\"attachment_24807\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Check-Kernel-Version-in-CentOS-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24807\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Check-Kernel-Version-in-CentOS-7.png\" alt=\"Check Kernel Version in CentOS 7\" width=\"340\" height=\"120\" aria-describedby=\"caption-attachment-24807\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-24807\" class=\"wp-caption-text\">Check Kernel Version in CentOS 7<\/p>\n<\/div>\n<p>If we now go to\u00a0<a href=\"https:\/\/www.kernel.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kernel.org\/<\/a>, we will see that the latest kernel version is\u00a0<strong>5.0<\/strong>\u00a0at the time of this writing (other versions are available from the same site).<\/p>\n<p>This new\u00a0<strong>Kernel 5.0<\/strong>\u00a0version is a long-term release and will be supported for 6 years, earlier all Linux Kernel versions were supported for 2 years only.<\/p>\n<p>One important thing to consider is the life cycle of a kernel version \u2013 if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date. For more info, refer to the\u00a0<a href=\"https:\/\/www.kernel.org\/category\/releases.html\" target=\"_blank\" rel=\"nofollow noopener\">kernel Releases<\/a>\u00a0page.<\/p>\n<h3>Step 2: Upgrading Kernel in CentOS 7<\/h3>\n<p>Most modern distributions provide a way to upgrade the kernel using a\u00a0<a href=\"https:\/\/www.tecmint.com\/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement\/\" target=\"_blank\" rel=\"noopener\">package management system such as yum<\/a>\u00a0and an officially-supported repository.<\/p>\n<p><strong>Important<\/strong>: If you looking to run custom compiled Kernel, then you should read our article that explains\u00a0<a href=\"https:\/\/www.tecmint.com\/compile-linux-kernel-on-centos-7\/\" target=\"_blank\" rel=\"noopener\">How to Compile Linux Kernel on CentOS 7<\/a>\u00a0from sources.<\/p>\n<p>However, this will only perform the upgrade to the most recent version available from the distribution\u2019s repositories \u2013 not the latest one available in the\u00a0<a href=\"https:\/\/www.kernel.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kernel.org\/<\/a>. Unfortunately, Red Hat only allows to upgrade the kernel using the former option.<\/p>\n<p>As opposed to\u00a0<strong>Red Hat<\/strong>,\u00a0<strong>CentOS<\/strong>\u00a0allows the use of\u00a0<strong>ELRepo<\/strong>, a third-party repository that makes the upgrade to a recent version a kernel.<\/p>\n<p>To enable the ELRepo repository on CentOS 7, do:<\/p>\n<pre># rpm --import https:\/\/www.elrepo.org\/RPM-GPG-KEY-elrepo.org\r\n# rpm -Uvh http:\/\/www.elrepo.org\/elrepo-release-7.0-3.el7.elrepo.noarch.rpm \r\n<\/pre>\n<div id=\"attachment_24808\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Enable-ELRepo-in-CentOS-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24808\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Enable-ELRepo-in-CentOS-7.png\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Enable-ELRepo-in-CentOS-7.png 866w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Enable-ELRepo-in-CentOS-7-768x205.png 768w\" alt=\"Enable ELRepo in CentOS 7\" width=\"866\" height=\"231\" aria-describedby=\"caption-attachment-24808\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-24808\" class=\"wp-caption-text\">Enable ELRepo in CentOS 7<\/p>\n<\/div>\n<p>Once the repository has been enabled, you can use the following command to list the available\u00a0<strong>kernel.related<\/strong>packages:<\/p>\n<pre># yum --disablerepo=\"*\" --enablerepo=\"elrepo-kernel\" list available\r\n<\/pre>\n<div class=\"code-label\">Yum \u2013 Find Available Kernel Versions<\/div>\n<pre>Loaded plugins: fastestmirror, langpacks\r\nLoading mirror speeds from cached hostfile\r\n * elrepo-kernel: mirror-hk.koddos.net\r\nAvailable Packages\r\nkernel-lt.x86_64                        4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-devel.x86_64                  4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-doc.noarch                    4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-headers.x86_64                4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-tools.x86_64                  4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-tools-libs.x86_64             4.4.176-1.el7.elrepo        elrepo-kernel\r\nkernel-lt-tools-libs-devel.x86_64       4.4.176-1.el7.elrepo        elrepo-kernel\r\n<strong>kernel-ml.x86_64                        5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-devel.x86_64                  5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-doc.noarch                    5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-headers.x86_64                5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-tools.x86_64                  5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-tools-libs.x86_64             5.0.0-1.el7.elrepo          elrepo-kernel\r\nkernel-ml-tools-libs-devel.x86_64       5.0.0-1.el7.elrepo          elrepo-kernel\r\nperf.x86_64                             5.0.0-1.el7.elrepo          elrepo-kernel\r\npython-perf.x86_64                      5.0.0-1.el7.elrepo          elrepo-kernel<\/strong>\r\n<\/pre>\n<p>Next, install the latest mainline stable kernel:<\/p>\n<pre># yum --enablerepo=elrepo-kernel install kernel-ml\r\n<\/pre>\n<div class=\"code-label\">Install Kernel 5.0 in CentOS 7<\/div>\n<pre>Loaded plugins: fastestmirror, langpacks\r\nLoading mirror speeds from cached hostfile\r\n * base: centos.mirror.net.in\r\n * elrepo: mirror-hk.koddos.net\r\n * elrepo-kernel: mirror-hk.koddos.net\r\n * epel: repos.del.extreme-ix.org\r\n * extras: centos.mirror.net.in\r\n * updates: centos.mirror.net.in\r\nResolving Dependencies\r\n--&gt; Running transaction check\r\n---&gt; Package kernel-ml.x86_64 0:5.0.0-1.el7.elrepo will be installed\r\n--&gt; Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n====================================================================================\r\n Package                Arch        Version                 Repository        Size\r\n====================================================================================\r\nInstalling:\r\n kernel-ml              x86_64      5.0.0-1.el7.elrepo      elrepo-kernel     47 M\r\n\r\nTransaction Summary\r\n====================================================================================\r\nInstall  1 Package\r\n\r\nTotal download size: 47 M\r\nInstalled size: 215 M\r\nIs this ok [y\/d\/N]: y\r\nDownloading packages:\r\nkernel-ml-5.0.0-1.el7.elrepo.x86_64.rpm                           |  47 MB  00:01:21     \r\nRunning transaction check\r\nRunning transaction test\r\nTransaction test succeeded\r\nRunning transaction\r\n  Installing : kernel-ml-5.0.0-1.el7.elrepo.x86_64                1\/1 \r\n  Verifying  : kernel-ml-5.0.0-1.el7.elrepo.x86_64                1\/1 \r\n\r\nInstalled:\r\n  kernel-ml.x86_64 0:5.0.0-1.el7.elrepo                                                                                                                                                                            \r\n\r\nComplete!\r\n<\/pre>\n<p>Finally,\u00a0<code>reboot<\/code>\u00a0your machine to apply the latest kernel, and then select latest kernel from the menu as shown.<\/p>\n<div id=\"attachment_30041\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Select-Latest-Kernel-Version.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30041\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Select-Latest-Kernel-Version.png\" alt=\"Select Latest Kernel Version\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-30041\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30041\" class=\"wp-caption-text\">Select Latest Kernel Version<\/p>\n<\/div>\n<p>Login as root, and run following command to check the kernel version:<\/p>\n<pre># uname -sr\r\n<\/pre>\n<div id=\"attachment_24813\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Verify-Kernel-Version.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24813\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Verify-Kernel-Version.png\" alt=\"Verify Kernel Version\" width=\"464\" height=\"183\" aria-describedby=\"caption-attachment-24813\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-24813\" class=\"wp-caption-text\">Verify Kernel Version<\/p>\n<\/div>\n<h3>Step 3: Set Default Kernel Version in GRUB<\/h3>\n<p>To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows:<\/p>\n<p>Open and edit the file\u00a0<strong>\/etc\/default\/grub<\/strong>\u00a0and set\u00a0<code>GRUB_DEFAULT=0<\/code>. This means that the first kernel in the GRUB initial screen will be used as default.<\/p>\n<pre>GRUB_TIMEOUT=5\r\n<strong>GRUB_DEFAULT=0<\/strong>\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"console\"\r\nGRUB_CMDLINE_LINUX=\"rd.lvm.lv=centos\/root rd.lvm.lv=centos\/swap crashkernel=auto rhgb quiet\"\r\nGRUB_DISABLE_RECOVERY=\"true\"\r\n<\/pre>\n<p>Next, run the following command to recreate the kernel configuration.<\/p>\n<pre># grub2-mkconfig -o \/boot\/grub2\/grub.cfg\r\n<\/pre>\n<div class=\"code-label\">Set Default Kernel Version in Grub<\/div>\n<pre>Generating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-5.0.0-1.el7.elrepo.x86_64\r\nFound initrd image: \/boot\/initramfs-5.0.0-1.el7.elrepo.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-4.20.0-1.el7.elrepo.x86_64\r\nFound initrd image: \/boot\/initramfs-4.20.0-1.el7.elrepo.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-4.19.11-1.el7.elrepo.x86_64\r\nFound initrd image: \/boot\/initramfs-4.19.11-1.el7.elrepo.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-4.19.0-1.el7.elrepo.x86_64\r\nFound initrd image: \/boot\/initramfs-4.19.0-1.el7.elrepo.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-3.10.0-957.1.3.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-957.1.3.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-3.10.0-693.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-693.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-1e2b46dbc0c04b05b592c837c366bb76\r\nFound initrd image: \/boot\/initramfs-0-rescue-1e2b46dbc0c04b05b592c837c366bb76.img\r\ndone\r\n<\/pre>\n<p>Reboot and verify that the latest kernel is now being used by default.<\/p>\n<div id=\"attachment_24815\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Booting-Default-Kernel-Version.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24815\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/03\/Booting-Default-Kernel-Version.png\" alt=\"Booting Default Kernel Version in CentOS 7\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-24815\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-24815\" class=\"wp-caption-text\">Booting Default Kernel Version in CentOS 7<\/p>\n<\/div>\n<p>Congratulations! You have upgraded your kernel in\u00a0<strong>CentOS 7<\/strong>!<\/p>\n<h5>Summary<\/h5>\n<p>In this article we have explained how to easily upgrade the Linux kernel on your system. There is yet another method which we haven\u2019t covered as it involves compiling the kernel from source, which would deserve an entire book and is not recommended on production systems.<\/p>\n<p>Although it represents one of the best learning experiences and allows for a fine-grained configuration of the kernel, you may render your system unusable and may have to reinstall it from scratch.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-upgrade-kernel-version-in-centos-7\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although some people use the word\u00a0Linux\u00a0to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries. During normal operations, the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/how-to-install-or-upgrade-to-kernel-5-0-in-centos-7-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install or Upgrade to Kernel 5.0 in CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12932","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12932"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12932\/revisions"}],"predecessor-version":[{"id":12933,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12932\/revisions\/12933"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}