一下操作步骤来自于各种搜索出来的杂七杂八的东西。主要来自:https://blog.csdn.net/happyfreeangel/article/details/85088706

前置环境:CentOS 7 x86 任意一个版本

前置的一些步骤(可选):
更换yum源为国内:
#CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
#CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

安装工具链条:
sudo yum install -y gcc kernel-devel
sudo yum install -y epel-release
sudo yum group install -y “Development Tools”
sudo yum install -y bc wget xz ncurses-devel bison flex elfutils-libelf-devel openssl-devel

然后就是脚本内容:

export version=4.14.59 #这里写你要编译的内核版本
export kernelfile=linux-${version}.tar.xz

#wget https://mirror.bjtu.edu.cn/kernel/linux/kernel/v4.x/linux-${version}.tar.xz #longterm kernel 4.14.89

#xz -d -v ${kernelfile}

#wget https://mirror.bjtu.edu.cn/kernel/linux/kernel/v4.x/linux-${version}.tar.sign

result=$(gpg --verify linux-4.14.59.tar.sign | grep 'using RSA key')
recv_keys=""
for word in result
do
recv_keys=word
done

echo $recv_keys
gpg --recv-keys recv_keys
gpg --verify linux-{version}.tar.sign

tar xvf linux-${version}.tar

cd linux-$(version)
cp -v /boot/config-$(uname -r).config

#下面的make menuconfig 需要手动 干预, 我是选择默认,直接保存退出,什么都没改。就是为了生成一个标准的.config 文件。

make menuconfig #这里要特别注意,进去后退出必须保存为.config 否则下面的运行每个都要确认.
#make xconfig # X windows (Qt) based configuration tool, works best under KDE desktop
#make gconfig #X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

echo 开始编译内核linux-${version}

#使用多个线程编译,每个cpu 一个线程. 如果你是单个cpu,可以设置 make -j 2

make -j $(nproc)

sudo make modules_install

sudo make install

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo grubby --set-default /boot/vmlinuz-${version}

echo 'do reboot'
#sudo reboot

p.s.

http://wiki.centos.org/Download centos系统版本与内核版本对应关系在这查

https://mirror.bjtu.edu.cn/kernel/linux/kernel     linux内核源码国内镜像站

Linux-通过源码安装某个版本的内核的更多相关文章

  1. linux通过源码安装nodejs

    1.下载nodejs源码,下载地址:https://nodejs.org/en/download/ 2.下载回来后,解压缩,ubuntu系统ctrl + alt +T 打开终端 假如tar.gz压缩包 ...

  2. 通过源码安装PostgresSQL

    通过源码安装PostgresSQL 1.1 下载源码包环境: Centos6.8 64位 yum -y install bison flex readline-devel zlib-devel yum ...

  3. 在centos6.7通过源码安装python3.6.7报错“zipimport.ZipImportError: can't decompress data; zlib not available”

    在centos6.7通过源码安装python3.6.7报错: zipimport.ZipImportError: can't decompress data; zlib not available 从 ...

  4. 【Git】CentOS7 通过源码安装Git

    yum源仓库里的Git版本更新不及时,最新版的Git是1.8.3,但是官方的最新版早已经更新到2.9.5.想要安装最新版本Git,只能下载源码进行安装 建议最好更新git为较新版本,便于使用 1.查看 ...

  5. 在CentOS7(虚拟机)下通过源码安装Postgresql10以及基本配置

    操作系统:CentOS7 安装文件:postgresql-10.0.tar.gz 系统环境:gcc.Python 1:源码安装 [postgres@localhost ~]# tar zxvf pos ...

  6. Ubuntu 14.04 卸载通过源码安装的库

    cd cere-solvermkdir buildcd buildcmake ..sudo makesudo make install 卸载通过以上方式源码安装的库 再次进入buildsudo mak ...

  7. 在linux通过源码编译安装redis详细步骤

    1.下载源码包 [root@localhost opt]# wget http://download.redis.io/releases/redis-4.0.10.tar.gz 2.解压缩redis ...

  8. linux下通过源码安装git

    1.移除旧版本git [root@Git ~]# git --version ## 查看自带的版本git version 1.8.3.1 [root@Git ~]# yum remove git ## ...

  9. Centos7 linux下通过源码安装redis以及使用

    下载redis安装包 wget http://download.redis.io/releases/redis-5.0.3.tar.gz 解压压缩包 tar -zxvf redis-.tar.gz y ...

随机推荐

  1. Java ArrayList对象集合去重

    import java.util.ArrayList; import java.util.Iterator; public class StringSampleDemo { public static ...

  2. select2多选设置select多选,select2取值和赋值

    select2设置select多选,select2取值和赋值,作为筛选条件的时候,取值相对简单,把选中的id值转为字符串传给后端查询,查询之后会刷新页面,为了在下拉框中显示刚刚选中的值,就需要给sel ...

  3. CSS3 clip-path & clip-path 打破矩形设计的限制

    CSS 形状模块标准1(CSS Shapes Module Level 1)这个规范打破了 WEB 中的矩形盒模型的限制,并且将网页设计提升到一个新的高度. 关于 Shapes 规范 shape-ou ...

  4. 【2019.10.17】十天Web前端程序员体验(软件工程实践第五次作业)

    结对信息.具体分工 Github地址:https://github.com/MokouTyan/131700101-031702425 学号 昵称 主要负责内容 博客地址 131700101 莫多 代 ...

  5. #C++初学记录(贪心算法#二分查找)

    D - Aggressive cows 农夫 John 建造了一座很长的畜栏,它包括N (2 <= N <= 100,000)个隔间,这些小隔间依次编号为x1,...,xN (0 < ...

  6. Python-matplotlib画图(莫烦笔记)

    https://www.zhihu.com/collection/260736383 https://blog.csdn.net/gaotihong/article/details/80983937 ...

  7. 制作基于软盘的Linux系统

    制作基于软盘的Linux系统(张宏伟.欧阳平平 2001年07月26日 11:22) 嵌入式Linux由一个几百KB的kernel(内核)和一些根据需要进行定制的系统模块组成.由于Linux是开放源代 ...

  8. text-align-last 实现文本居中对齐

    1.示例代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...

  9. web文件上传,带进度条

    原生ajax上传带进度条 (百分比) <%@ page language="java" contentType="text/html; charset=UTF-8& ...

  10. pt-table-checksum校验与pt-table-sync修复数据【转】

    1:下载工具包 登录网站下载相应的工具包 https://www.percona.com/downloads/percona-toolkit/LATEST/ 2:安装 (1)yum安装: sudo y ...