更新内核到 v6.2.1
bash -c "$(curl -sSL https://bd-rce.coding.net/api/user/bd-rce/project/shell/shared-depot/lts-tools-v10/git/blob/master/kernel/v6.2.1-t2023022801/install.sh | jq -r '.data.file.data')"
#!/usr/bin/env bash__main() {#导入公钥rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org#添加YUM源yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm# 查看最新内核版本# kernel-lt 长期支持版# kernel-ml 主线最新版本# yum --disablerepo="*" --enablerepo=elrepo-kernel list kernel*# 本文主要安装主线最新版_branch="ml"_version="" # 不填版本则是最新版yum install -y --disablerepo="*" --enablerepo="elrepo-kernel" \"kernel-${_branch}${_version}" \"kernel-${_branch}-devel$_version" \"kernel-${_branch}-headers$_version" \"kernel-${_branch}-tools$_version" \"kernel-${_branch}-tools-libs$_version" \"kernel-${_branch}-tools-libs-devel$_version" \--skip-brokencat >/etc/default/grub <<'EOF'GRUB_DEFAULT="saved"GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DISABLE_SUBMENU="true"GRUB_DISABLE_RECOVERY="true"GRUB_TIMEOUT="3"GRUB_TERMINAL="console serial"GRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="intel_iommu=ats intel_iommu=unsafe_interrupts intel_iommu=on iommu=pt crashkernel=auto rhgb quiet"GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200"GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"EOFgrub2-set-default 0 #设置新内核为默认启动项,默认情况下新内核序号为0grub2-mkconfig -o /boot/grub2/grub.cfg 2>/dev/nullgrub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg 2>/dev/null# 开机免密码sed -i 's,^ExecStart=.*$,ExecStart=-/sbin/agetty --autologin root --noclear %I,' /usr/lib/systemd/system/serial-getty@.servicesed -i 's,^ExecStart=.*$,ExecStart=-/sbin/agetty --autologin root --noclear %I,' /usr/lib/systemd/system/getty@.servicesystemctl enable serial-getty@ttyS0.service}__main
内核参数设置
bash -c "$(curl -sSL https://bd-rce.coding.net/api/user/bd-rce/project/shell/shared-depot/lts-tools-v10/git/blob/master/kernel/v6.2.1-t2023022801/sysctl_conf.sh | jq -r '.data.file.data')"
推荐阅读
CentOS 7 内核更新
CentOS 7升级内核简要说明_ITPUB博客
centos7 升级内核版本
升级 centos7 内核_若云_bai的博客-CSDN博客
