05_Linux 内核下载及升级
<p>aarch64当前环境内枋版本为4.18不需升级即可安装秒云。这里仅记录内核下载接及内核升级方法。
查找内核并下载:</p>
<p>下载清单:</p>
<pre><code class="language-bash">kernel-ml-4.15.15-1.el7.elrepo.x86_64.rpm
kernel-ml-devel-4.15.15-1.el7.elrepo.x86_64.rpm
kernel-ml-headers-4.15.15-1.el7.elrepo.x86_64.rpm</code></pre>
<p>本地文件存入路径:</p>
<pre><code class="language-bash">G:\01_Linux\18_服务器\思华云科技(云桌面+虚拟机+容器)\思华秒云(容器)\安装包\miaoyun\CentOS7.5内核升级\rpm包升级内核法</code></pre>
<p>内核源码下载URL:</p>
<pre><code class="language-bash">https://mirrors.edge.kernel.org/pub/linux/kernel/
文件名:linux-4.20.9.tar.xz
HTTP
https://www.kernel.org/pub/
GIT
https://git.kernel.org/
RSYNC
http://rsync.kernel.org/pub/linux/kernel/</code></pre>
<p>rpm包下载</p>
<pre><code class="language-bash">https://pkgs.org/search/?q=kernel #搜索
https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/
https://mirror.imt-systems.com/elrepo/kernel/el7/x86_64/RPMS/
https://centos.pkgs.org/7/elrepo-kernel-x86_64/</code></pre>
<p>aarch64内核rpm包下载:</p>
<pre><code class="language-bash">https://pkgs.org/download/kernel-devel
kernel-devel-4.18.0-147.8.1.el7.aarch64.rpm</code></pre>
<p>一、内核升级说明
make[1]: 警告:检测到时钟错误。您的创建可能是不完整的
解决办法:
用touch 命令把源程序的时间戳改一下
find . -type f -exec touch {} \;
make clean
make</p>
<p>1、内核升级
内核升级有三种方法:小版本升级、大版本升级、自编译升级;
<a href="https://blog.csdn.net/breeze915/article/details/79243673">https://blog.csdn.net/breeze915/article/details/79243673</a></p>
<p>2、大版本升级(但不能升级任意指定的版本,而是升级至源里的最新版本)
<a href="https://www.cnblogs.com/fuhai0815/p/9317969.html">https://www.cnblogs.com/fuhai0815/p/9317969.html</a></p>
<p>3、自编译升级(可升级到任意指定版本)
CentOS内核版本升级的两种方式(升级到最新版本内核、编译方式安装内核)
<a href="https://blog.csdn.net/mofiu/article/details/77894203">https://blog.csdn.net/mofiu/article/details/77894203</a> 等于下面链接
<a href="https://www.cnblogs.com/cnwangshijun/p/7405153.html">https://www.cnblogs.com/cnwangshijun/p/7405153.html</a> 等于上面链接</p>
<h2>4、内核源码下载URL:<a href="https://www.kernel.org/pub/linux/kernel/v4.x/">https://www.kernel.org/pub/linux/kernel/v4.x/</a>
15:11 2019/2/21:最新版本为:linux-4.20.9.tar.xz
5、秒云现在支持:linux-4.15.18.tar.xz
下 载 地 址:<a href="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.15.18.tar.xz">https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.15.18.tar.xz</a></h2>
<p>二、自编升级内核至任意版本(linux-4.15.18.tar.xz)
centos7升级内核到指定版本
<a href="https://www.cnblogs.com/cnwangshijun/p/7405153.html">https://www.cnblogs.com/cnwangshijun/p/7405153.html</a></p>
<p>Protocol Location
HTTP
<a href="https://www.kernel.org/pub/">https://www.kernel.org/pub/</a>
GIT
<a href="https://git.kernel.org/">https://git.kernel.org/</a>
RSYNC
<a href="http://rsync.kernel.org/pub/linux/kernel/">http://rsync.kernel.org/pub/linux/kernel/</a></p>
<p>1、安装开发工具包
[root@localhost ~]# yum groupinstall "Development Tools" -y</p>
<p>2、安装常用软件
[root@localhost ~]# yum install -y elfutils-libelf-devel bc openssl-devel ncurses-devel wget ntpdate vim net-tools</p>
<p>3、同步时间
同步时间,如果时间不对,编译可能会出问题
[root@localhost ~]# ntpdate -u times.aliyun.com</p>
<p>4、下载内核源代码
[root@localhost ~]# wget <a href="https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.15.18.tar.xz">https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.15.18.tar.xz</a></p>
<p>5、解压内核并进入目录
[root@localhost ~]# tar -xf linux-4.15.18.tar.xz -C /usr/src/
[root@localhost ~]# cd /usr/src/linux-4.15.18</p>
<p>6、准备编译配置文件
[root@localhost ~]# cp /boot/config-3.10.0-957.5.1.el7.x86_64 .config</p>
<p>7、验证和更新配置
[root@localhost ~]# sh -c 'yes "" | make oldconfig' #配置内核,在将新的设定更新到.config中去的同时,将原来的.config文件保存为.config.old。</p>
<p>8、测试机是8核,这里用6,尽可能加快编译速度
[root@localhost ~]# make -j6 bzImage
[root@localhost ~]# make -j6 modules
[root@localhost ~]# make -j6 modules_install
[root@localhost ~]# make install</p>
<p>9、查看已安装的内核版本
[root@localhost ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg #等于下面这行
[root@localhost ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg #等于上面这行
[root@localhost ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2-efi.cfg #CentOS7.6实体服务器上;</p>
<p>10、设置升级后的最新版本,即就是编号为0的那个
[root@localhost ~]# grub2-set-default 0
设置后验证:
vim /etc/default/grub
GRUP_DEFAULT=0</p>
<p>11、生产grub2配置文件,并重启
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot</p>
<p>12、验证
uname -r</p>
<p>13、删除旧的内核版本
通过 yum remove 命令或通过 yum-utils 工具
[root@localhost ~]# rpm -qa | grep kernel
[root@localhost ~]# yum remove kernel-tools .....
或者通过yum-utils工具删除
[root@localhost ~]# yum install yum-utils -y
[root@localhost ~]# package-cleanup --oldkernels ##安装的内核大于 3 个时,才会自动删除旧内核</p>