Centos upgrade kernel
1. Check the current kernel version
$ uname -r
3.10.0-514.el7.x86_64
$ Uname -a
Linux k8s-master 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ Cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
2. Upgrade the kernel
Update yum source warehouse
$ Yum -y update
Enable ELRepo warehouse
The ELRepo warehouse is a community-based enterprise-level Linux warehouse that provides support for RedHat Enterprise (RHEL) and other RHEL-based Linux distributions (CentOS, Scientific, Fedora, etc.).
ELRepo focuses on hardware-related software packages, including file system drivers, graphics card drivers, network drivers, sound card drivers, and camera drivers.
#Import the public key of the ELRepo warehouse
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
#Install the yum source of the ELRepo warehouse
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
3. Check the available system kernel packages
You can see the two versions 4.4 and 4.18
yum--disablerepo="*"--enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* Elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
elrepo-kernel | 2.9 kB 00:00:00
elrepo-kernel / primary_db | 1.8 MB 00:00:03
Available Packages
kernel-lt.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 4.4.155-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
perf.x86_64 4.18.7-1.el7.elrepo elrepo-kernel
python-perf.x86_64 4.18.7-1.el7.elrepo elrepo-
4. Install the latest version of the kernel
$yum--enablerepo=elrepo-kernel install kernel-ml
The --enablerepo option enables the designated repository on the CentOS system. The default is elrepo, which is replaced by elrepo-kernel here.
5. Set grub2
After the kernel is installed, it needs to be set as the default startup option and restarted to take effect
View all available kernels on the system:
$ Sudo awk -F\''$1=="menuentry "{print i++": "$2}' /etc/grub2.cfg
0: CentOS Linux (4.18.7-1.el7.elrepo.x86_64) 7 (Core)
1: CentOS Linux (3.10.0-862.11.6.el7.x86_64) 7 (Core)
2: CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
3: CentOS Linux (0-rescue-063ec330caa04d4baae54c6902c62e54) 7 (Core)
Method 2. Edit the /etc/default/grub file
Set GRUB_DEFAULT=0, and use the kernel number 0 shown in the above query as the default kernel:
$ vim /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="crashkernel=auto rd.lvm.lv=cl/root rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
Generate grub configuration file and restart
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file...
Found linux image: /boot/vmlinuz-4.18.7-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.18.7-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.11.6.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-063ec330caa04d4baae54c6902c62e54
Found initrd image: /boot/initramfs-0-rescue-063ec330caa04d4baae54c6902c62e54.img
done
$ reboot
6. Verification
$ Uname -r
4.18.7-1.el7.elrepo.x86_64
7. Delete the old kernel (optional)
View all kernels in the system:
$ rpm -qa | grep kernel
kernel-3.10.0-514.el7.x86_64
kernel-ml-4.18.7-1.el7.elrepo.x86_64
kernel-tools-libs-3.10.0-862.11.6.el7.x86_64
kernel-tools-3.10.0-862.11.6.el7.x86_64
kernel-3.10.0-862.11.6.el7.x86_64
Method 1, yum remove Delete the RPM package of the old kernel
$ Yum remove kernel-3.10.0-514.el7.x86_64 \
kernel-tools-libs-3.10.0-862.11.6.el7.x86_64 \
kernel-tools-3.10.0-862.11.6.el7.x86_64 \
kernel-3.10.0-862.11.6.el7.x86_64
Method 2, yum-utils tool
If no more than 3 kernels are installed, the yum-utils tool will not delete any of them. Only when there are more than 3 kernels installed will the old kernel be deleted automatically.
Install yum-utils
$ Yum install yum-utils
Delete old version
package-cleanup --oldkernels
Set up BBR
edit
vi /etc/sysctl.conf
Add the following content
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
Load system parameters (under normal circumstances, the content we added before will be output)
sysctl -p
Verify that bbr has been turned on
1. If
sysctl net.ipv4.tcp_available_congestion_control
return
net.ipv4.tcp_available_congestion_control = reno cubic bbr
Then succeed
like
lsmod | grep bbr
Return information in the form of success
tcp_bbr 20480 2
————————————————