{"id":242,"date":"2018-08-08T05:22:00","date_gmt":"2018-08-08T10:22:00","guid":{"rendered":"http:\/\/etapien.com\/guides\/?p=242"},"modified":"2020-08-24T14:22:20","modified_gmt":"2020-08-24T19:22:20","slug":"how-to-compile-a-kernel-on-centos-7","status":"publish","type":"post","link":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/","title":{"rendered":"How to compile a kernel on CentOS 7"},"content":{"rendered":"<div class=\"entry-inner\">\n<h3>Install Required Packages for Kernel Compilation<\/h3>\n<p>To get started we\u2019ll need to make sure all repositories are up to date and that te system its self is up to date as well, then we&#8217;ll install the development tools that we\u2019ll need to compile the kernel, and we should also install the nurses library using the following yum command.<\/p>\n<pre># yum update\n# yum install -y ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel grub2\n<\/pre>\n<h3>Compile and Install Kernel in CentOS 7<\/h3>\n<p><center><\/center>Let\u2019s download the latest Kernel <strong>4.17<\/strong> sources using wget command&nbsp;under <strong>\/usr\/src\/<\/strong> directory or you can also download the latest kernel by going to kernel.org<\/p>\n<pre># cd \/usr\/src\/\n# wget https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v4.x\/linux-4.17.11.tar.xz\n<\/pre>\n<p>Extract the archived files and change directories using following commands.<\/p>\n<pre># tar -xvf linux-4.17.11.tar.xz\n# cd linux-4.17.11\/\n<\/pre>\n<h3>Configure the Kernel in CentOS 7<\/h3>\n<p>The Kernel must be correctly configured with the following required configuration options within the <strong>CentOS 7<\/strong>environment.<\/p>\n<pre>CONFIG_KVM_GUEST=y\nCONFIG_VIRTIO_PCI=y\nCONFIG_VIRTIO_PCI_LEGACY=y\nCONFIG_BLK_DEV_SD\nCONFIG_SCSI_VIRTIO=y\nCONFIG_VIRTIO_NET=y\nCONFIG_SERIAL_8250=y\nCONFIG_SERIAL_8250_CONSOLE=y\n<\/pre>\n<p>It is important that you copy the running kernel configuration (<code>.config<\/code>) from the <strong>\/boot<\/strong> directory to new kernel <strong>linux-4.17.11<\/strong> directory.<\/p>\n<pre># cp -v \/boot\/config-3.10.0-693.5.2.el7.x86_64 \/usr\/src\/linux-4.17.11\/.config\n<\/pre>\n<p>We\u2019re now ready to run the <code>make menuconfig<\/code> command to configure the Linux kernel. Once you execute the below command a pop up window will appear with all the menus. This is where you can enable or disable kernel features, however if you unfamiliar with these menus, it\u2019s best if you just hit <code>ESC<\/code> key to exit and continue as is.<\/p>\n<pre># cd \/usr\/src\/linux-4.17.11\/\n# make menuconfig\n<\/pre>\n<p>Once your kernel configuration options are set, click on <strong>Save<\/strong> to save the configuration interface and exit from the menu.<\/p>\n<p><a href=\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-243\" src=\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\" alt=\"\" width=\"969\" height=\"700\" srcset=\"https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png 969w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig-300x217.png 300w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig-768x555.png 768w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig-624x451.png 624w\" sizes=\"(max-width: 969px) 100vw, 969px\" \/><\/a><\/p>\n<div id=\"attachment_30202\" class=\"wp-caption aligncenter\">\n<p class=\"wp-caption-text\">Make Menuconfig<\/p>\n<\/div>\n<div id=\"attachment_30203\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-244\" src=\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration.png\" alt=\"\" width=\"969\" height=\"705\" srcset=\"https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration.png 969w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration-300x218.png 300w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration-768x559.png 768w, https:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Save-Kernel-Configuration-624x454.png 624w\" sizes=\"(max-width: 969px) 100vw, 969px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Save Kernel Configuration<\/p>\n<\/div>\n<h3>Compile the Kernel in CentOS 7<\/h3>\n<p>Before starting kernel compilation, make sure your system has more than <strong>25GB<\/strong> of free space on the file system. To confirm, you can check the file system free space using df command&nbsp;as shown.<\/p>\n<pre># df -h\n<\/pre>\n<p>Now we can compile and install the kernel and modules using following commands (<strong>it may take several hours depending on the available resources<\/strong>). The compilation process place files under <strong>\/boot<\/strong> directory and also make a new kernel entry in your <strong>grub.conf<\/strong> file.<\/p>\n<pre># make bzImage\n# make modules\n# make\n# make install\n# make modules_install\n<\/pre>\n<p>Once the compilation completes, reboot the system and verify newly installed Kernel.<\/p>\n<pre># uname -sr\n<\/pre>\n<div id=\"attachment_24813\" class=\"wp-caption aligncenter\">\n<p class=\"wp-caption-text\">\n<\/div>\n<p>You should be able to verify the kernel version from the output shown by the previous command and that\u2019s it!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Install Required Packages for Kernel Compilation To get started we\u2019ll need to make sure all repositories are up to date and that te system its self is up to date as well, then we&#8217;ll install the development tools that we\u2019ll need to compile the kernel, and we should also install the nurses library using the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to compile a kernel on CentOS 7 - Tech Howtos<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to compile a kernel on CentOS 7 - Tech Howtos\" \/>\n<meta property=\"og:description\" content=\"Install Required Packages for Kernel Compilation To get started we\u2019ll need to make sure all repositories are up to date and that te system its self is up to date as well, then we&#8217;ll install the development tools that we\u2019ll need to compile the kernel, and we should also install the nurses library using the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Tech Howtos\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-08T10:22:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-24T19:22:20+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\" \/>\n<meta name=\"author\" content=\"Etapien\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etapien\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/\",\"url\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/\",\"name\":\"How to compile a kernel on CentOS 7 - Tech Howtos\",\"isPartOf\":{\"@id\":\"https:\/\/etapien.com\/guides\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\",\"datePublished\":\"2018-08-08T10:22:00+00:00\",\"dateModified\":\"2020-08-24T19:22:20+00:00\",\"author\":{\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\"},\"breadcrumb\":{\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage\",\"url\":\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\",\"contentUrl\":\"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/etapien.com\/guides\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to compile a kernel on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/etapien.com\/guides\/#website\",\"url\":\"https:\/\/etapien.com\/guides\/\",\"name\":\"Tech Howtos\",\"description\":\"Tech related useful howtos\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/etapien.com\/guides\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\",\"name\":\"Etapien\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"caption\":\"Etapien\"},\"url\":\"https:\/\/etapien.com\/guides\/author\/Etapien\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to compile a kernel on CentOS 7 - Tech Howtos","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to compile a kernel on CentOS 7 - Tech Howtos","og_description":"Install Required Packages for Kernel Compilation To get started we\u2019ll need to make sure all repositories are up to date and that te system its self is up to date as well, then we&#8217;ll install the development tools that we\u2019ll need to compile the kernel, and we should also install the nurses library using the [&hellip;]","og_url":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/","og_site_name":"Tech Howtos","article_published_time":"2018-08-08T10:22:00+00:00","article_modified_time":"2020-08-24T19:22:20+00:00","og_image":[{"url":"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png"}],"author":"Etapien","twitter_misc":{"Written by":"Etapien","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/","url":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/","name":"How to compile a kernel on CentOS 7 - Tech Howtos","isPartOf":{"@id":"https:\/\/etapien.com\/guides\/#website"},"primaryImageOfPage":{"@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage"},"image":{"@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage"},"thumbnailUrl":"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png","datePublished":"2018-08-08T10:22:00+00:00","dateModified":"2020-08-24T19:22:20+00:00","author":{"@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424"},"breadcrumb":{"@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#primaryimage","url":"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png","contentUrl":"http:\/\/etapien.com\/guides\/wp-content\/uploads\/2018\/08\/Make-Menuconfig.png"},{"@type":"BreadcrumbList","@id":"https:\/\/etapien.com\/guides\/how-to-compile-a-kernel-on-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/etapien.com\/guides\/"},{"@type":"ListItem","position":2,"name":"How to compile a kernel on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/etapien.com\/guides\/#website","url":"https:\/\/etapien.com\/guides\/","name":"Tech Howtos","description":"Tech related useful howtos","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/etapien.com\/guides\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424","name":"Etapien","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","caption":"Etapien"},"url":"https:\/\/etapien.com\/guides\/author\/Etapien\/"}]}},"_links":{"self":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/242"}],"collection":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":2,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"predecessor-version":[{"id":247,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/242\/revisions\/247"}],"wp:attachment":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}