centos 较新版本kernel安装方法

有时因为系统内核的bug 我们必须要安装新版本的kernel 来解决问题,有几种方法

  • 源码编译
  • 使用编译好的包

使用包的方式比较方便,同时一些依赖的问题可以自动帮助我们处理

添加yum 源

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

启用repo

可以通过修改文件
/etc/yum.repos.d/elrepo.repo 参考如下

[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=http://elrepo.org/linux/kernel/el7/$basearch/
 http://mirrors.coreix.net/elrepo/kernel/el7/$basearch/
 http://mirror.rackspace.com/elrepo/kernel/el7/$basearch/
 http://repos.lax-noc.com/elrepo/kernel/el7/$basearch/
 http://mirror.ventraip.net.au/elrepo/kernel/el7/$basearch/
mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-kernel.el7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

或者

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

刷新cache

yum clean dbcache
yum makecache

安装

yum install -y kernel-lt  or yum install -y kernel-ml

修改grub 启动

  • 修改文件
    /etc/default/grub 并设置 GRUB_DEFAULT=0, 让GRUB 初始化页面的第一个内核将作为默认内核。
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR="$(sed ‘s, release .*$,,g‘ /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto noibrs idle=halt net.ifnames=0 console=tty0 console=ttyS0,115200n8"
GRUB_DISABLE_RECOVERY="true"
  • 重新创建内核配置
grub2-mkconfig -o /boot/grub2/grub.cfg

效果

grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.1.5-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.1.5-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-4.4.180-2.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.4.180-2.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-20181212155109274552296824485474
Found initrd image: /boot/initramfs-0-rescue-20181212155109274552296824485474.img
done
  • 重启系统
reboot
  • 查看效果
uname -a
Linux iZ2zeg7uro1snhd9wqmp2oZ 5.1.5-1.el7.elrepo.x86_64 #1 SMP Sat May 25 16:10:51 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

参考资料

https://elrepo.org/tiki/kernel-lt

原文地址:https://www.cnblogs.com/rongfengliang/p/10930097.html

时间: 2024-08-30 09:08:42

centos 较新版本kernel安装方法的相关文章

centos gcc 新版本安装的一种方法

最近出来一个v 语言,打算试用下,但是需要编译,centos 7 gcc 版本太低,一种可选的解决方法 使用Software Collections Software Collections 安装方法 安装sc sudo yum install centos-release-scl sudo yum install devtoolset-7-gcc* 查看gcc 版本 需要使用sc 虚拟环境 scl enable devtoolset-7 bash gcc -v 效果 Using built-i

CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享

一.配置防火墙,开启80端口.3306端口CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/ipta

CentOS x64上Matlab R2015b的镜像安装方法与卸载

CentOS x64上Matlab R2015b的镜像安装方法与卸载 0. 原料 (1). CentOS_x64系统 CentOS 2.6.32-573.el6.x86_64 (2). Matlab  R2015b_glnxa64.iso,可以从百度网盘下载到:链接: http://pan.baidu.com/s/1dD9F8RJ 密码: t8zi 1. CentOS/Linux 安装MATLAB (0). Matlab的安装说明readme.txt,全文摘抄如下(可略过). I offer t

在CentOS/RHEL 7.X安装 EPEL repo 的方法

在CentOS/RHEL 7.X安装 EPEL repo 的方法 一 背景 RHEL以及他的衍生发行版如CentOS.Scientific Linux为了稳定,官方的rpm repository提供的rpm包往往是很滞后的,而EPEL恰恰可以解决这两方面的问题.EPEL的全称叫 Extra Packages for Enterprise Linux .EPEL是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS.Scientific Linux 等提供高质量软件包的项目.装上

CentOS下软件安装方法总结

一.rpm包安装方式步骤:1.找到相应的软件包,比如soft.version.rpm,下载到本机某个目录:2.打开一个终端,su -成root用户:3.cd soft.version.rpm所在的目录:4.输入rpm -ivh soft.version.rpm二.deb包安装方式步骤:1.找到相应的软件包,比如soft.version.deb,下载到本机某个目录:2.打开一个终端,su -成root用户:3.cd soft.version.deb所在的目录:4.输入dpkg -i soft.ve

CentOS 6.4下安装MySQL后重置root密码方法

本人在CentOS 6.4上安装万mysql后,无法通过root进入,因为安装的时候,并没有设置root密码,似乎有个初始随机密码,但是不记得了,太麻烦,直接重置root密码. 使用rpm包安装完mysql后,按照一下步骤重置root密码: 启动mysql:#/etc/init.d/mysql start 启动成功后查看mysql进程信息,获取mysqld_safe的安装目录(非常关键):#ps -ef | grep -i mysqlroot 3466 1 0 01:45 pts/1 00:00

CentOS 7.2最小安装后不能使用ifconfig,netstat等命令解决方法?

CentOS 7.2最小安装后不能使用ifconfig,netstat等命令是因为默认没有安装net-tools包,安装好CentOS 7.2后连接网络,通过默认的yum源可以安装net-tools包,就可以使用上述命令了. [email protected] ~]# ifconfig -bash: ifconfig: command not found [[email protected] ~]# ip add show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 6

转: 在CentOS 6.X 上面安装 Python 2.7.X

转:https://ruiaylin.github.io/2014/12/12/python%20update/ 在CentOS 6.X 上面安装 Python 2.7.X CentOS 6.X 自带的python版本是 2.6 , 由于工作需要,很多时候需要2.7版本.所以需要进行版本升级.由于一些系统工具和服务是对 Python 有依赖的,所以升级 Python 版本需要注意. 升级步骤 如何欢乐的,没有痛苦的升级python版本 ,往下看 … 更新系统和开发工具集 更新指令 yum -y

CentOS更新yum源的方法

一.下载国内比较稳定的yum源,我这里下载163的源 同时我使用的是CentOS6.2的x86_64版本,所以下载的是CentOS6-Base-163.repo 请根据,如下方法确认自己系统的版本 [[email protected] ~]# lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4