CentOS 7 停服后(2024-06-30)升级最新的Linux Kernel 6.9.7
CentOS 7 在2024-06-30 停服后,一些源都不能使用了。更新CentOS 7 内核也不好操作。下面的内容记录了 CentOS 7 更新源和Linux内核版本的过程。
如下的操作过程是在一个 新安装的 CentOS 7009 版本操作记录的。
1、CentOS 7 更新 USTC 的源
sudo sed -i.bak \
-e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos-vault/centos|g' \
/etc/yum.repos.d/CentOS-Base.repo
命令输出如下:
[root@localhost ~]# sudo sed -i.bak \
> -e 's|^mirrorlist=|#mirrorlist=|g' \
> -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos-vault/centos|g' \
> /etc/yum.repos.d/CentOS-Base.repo
2、安装 wget
yum install -y wget
输出如下
[root@localhost ~]# yum install -y wget
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 253 kB 00:00:00
(3/4): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(4/4): updates/7/x86_64/primary_db | 27 MB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Installing:
wget x86_64 1.14-18.el7_6.1 base 547 k
Transaction Summary
=================================================================================================================================================================================
Install 1 Package
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/wget-1.14-18.el7_6.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY ] 0.0 B/s | 0 B --:--:-- ETA
Public key for wget-1.14-18.el7_6.1.x86_64.rpm is not installed
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-18.el7_6.1.x86_64 1/1
Verifying : wget-1.14-18.el7_6.1.x86_64 1/1
Installed:
wget.x86_64 0:1.14-18.el7_6.1
Complete!
3、下载并安装最新的 CentOS 适用的 Linux 内核
## 访问 https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/ 查看支持版本列表
wget https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
yum localinstall kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
reboot
命令输出如下:
[root@localhost ~]# wget https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
--2024-08-13 22:02:29-- https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
Resolving linux.cc.iitk.ac.in (linux.cc.iitk.ac.in)... 202.3.77.78
Connecting to linux.cc.iitk.ac.in (linux.cc.iitk.ac.in)|202.3.77.78|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71885940 (69M) [application/x-rpm]
Saving to: ‘kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm’
100%[=======================================================================================================================================>] 71,885,940 6.27MB/s in 14s
2024-08-13 22:02:46 (4.99 MB/s) - ‘kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm’ saved [71885940/71885940]
[root@localhost ~]# yum localinstall kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
Loaded plugins: fastestmirror
Examining kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm: kernel-ml-6.9.7-1.el7.elrepo.x86_64
Marking kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:6.9.7-1.el7.elrepo will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Installing:
kernel-ml x86_64 6.9.7-1.el7.elrepo /kernel-ml-6.9.7-1.el7.elrepo.x86_64 350 M
Transaction Summary
=================================================================================================================================================================================
Install 1 Package
Total size: 350 M
Installed size: 350 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kernel-ml-6.9.7-1.el7.elrepo.x86_64 1/1
Verifying : kernel-ml-6.9.7-1.el7.elrepo.x86_64 1/1
Installed:
kernel-ml.x86_64 0:6.9.7-1.el7.elrepo
Complete!
[root@localhost ~]# reboot
4、重启后,选择 新的内核启动