标签:i++ debug wan centos ssl bash mina pre 备份
两种方式升级内核参考:https://blog.csdn.net/kikajack/article/details/79396793
不多废话了,直接操作,原理看别的文章
[root@localhost ~]# uname -r
3.10.0-957.el7.x86_64
参考:http://elrepo.org/tiki/tiki-index.php
[root@localhost ~]# yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm -y
#就是一个repo仓库文件
[root@localhost ~]# rpm -ql elrepo-release-7.0-4.el7.elrepo.noarch
/etc/pki/elrepo
/etc/pki/elrepo/SECURE-BOOT-KEY-elrepo.org.der
/etc/pki/rpm-gpg
/etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
/etc/yum.repos.d
/etc/yum.repos.d/elrepo.repo
参考:http://elrepo.org/tiki/kernel-lt
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt
# ‘作为分隔符,查找第一列为menuentry的行,打印改行的第二列,i++打印序号,除了数字和字母其他符号要引起来
[root@localhost ~]# awk -F\‘ ‘$1=="menuentry " {print i++ " : " $2}‘ /etc/grub2.cfg
0 : CentOS Linux (4.4.190-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-dd6fe5c491024a9486fa9acf832f21a6) 7 (Core)
[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# sed -i ‘s/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/‘ /etc/default/grub
[root@localhost ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed ‘s, release .*$,,g‘ /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
能不清理旧别清理吧,centos允许多内核共存
[root@localhost ~]# yum install gcc ncurses-devel flex bison openssl-devel elfutils-libelf-devel -y
[root@localhost ~]# tar xf linux-5.2.11.tar.xz -C /usr/src/
[root@localhost ~]# cd /usr/src/linux-5.2.11/
[root@localhost linux-5.2.11]# cp /boot/config-3.10.0-957.el7.x86_64 .config
[root@localhost linux-5.2.11]# make menuconfig
加一个NTFS文件系统支持:
[root@localhost linux-5.2.11]# grep -i ntfs .config
CONFIG_NTFS_FS=m
CONFIG_NTFS_DEBUG=y
CONFIG_NTFS_RW=y
[root@localhost linux-5.2.11]# make -j 4
#经过了一个多小时
[root@localhost linux-5.2.11]# du -sh .
12G .
[root@localhost linux-5.2.11]# find -name ntfs.ko
./fs/ntfs/ntfs.ko
[root@localhost linux-5.2.11]# make modules_install
[root@localhost linux-5.2.11]# ls /lib/modules
3.10.0-957.el7.x86_64 4.4.190-1.el7.elrepo.x86_64 5.2.11-1.0-laowang_linux_x86_64
[root@localhost linux-5.2.11]# du -sh /lib/modules/5.2.11-1.0-laowang_linux_x86_64/
2.7G /lib/modules/5.2.11-1.0-laowang_linux_x86_64/
[root@localhost linux-5.2.11]# make install
如果只是需要ntfs,只需安装ntfs-3g
[root@localhost ~]# uname -r
5.2.11-1.0-laowang_linux_x86_64
[root@localhost ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
└─sdb1 ntfs 小黑屋 A0283A0D2839E2C8
sr0 iso9660 CentOS 7 x86_64 2018-11-25-21-21-31-00
sda
├─sda2 LVM2_member h2lAZD-7e2i-TiO6-x0Bc-2b41-U15R-iGMXBG
│ ├─centos-swap swap c06f8b43-1b47-4412-bae7-785f3b599368 [SWAP]
│ ├─centos-home xfs c30dee7e-0800-4737-b7b0-90db187eb3f8 /home
│ └─centos-root xfs 444b91d1-7fde-4f5d-9016-ad7b63862a5d /
└─sda1 xfs 3778e6e0-8f51-4843-8b8f-239c8b5e826b /boot
[root@localhost ~]# mount /dev/sdb1 /mnt/usb
[root@localhost ~]# ls /mnt/usb
#查看下
[root@localhost ~]# awk -F\‘ ‘$1=="menuentry " {print i++ " : " $2}‘ /etc/grub2.cfg
0 : CentOS Linux (5.2.11-1.0-laowang_linux_x86_64) 7 (Core)
1 : CentOS Linux (4.4.190-1.el7.elrepo.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-dd6fe5c491024a9486fa9acf832f21a6) 7 (Core)
#设置5.2内核有限启动
[root@localhost ~]# grep -i default /etc/default/grub
GRUB_DEFAULT=0
#重新生成grub配置文件
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@localhost ~]# rm /boot/*5.2.11* -f
[root@localhost ~]# rm /boot/*5.2.11* -f
[root@localhost ~]# rm -rf /lib/modules/5.2.11-1.0-laowang_linux_x86_64/
[root@localhost ~]# rm -rf /usr/src/linux-5.2.11/
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
标签:i++ debug wan centos ssl bash mina pre 备份
原文地址:https://blog.51cto.com/14012942/2434398