What is Linux Patching

In the context of Linux systems, patching referes to the process to applying updates, fixes, or improvements to the operating system's software. These updates are often released by the Linux distribution maintainers or the open-source community to address security vulnerabilities, fix bugs, enhace performance, or introduce new features, patching is a critical aspect of maintaining a secure and stable Linux System.


Update Releases:

    Linux distributions regularly release updates, which may include security patches, bug fixes and feature enhancements.


Package Management:

    Linux system use packages management system to install, update and remove software packages.


Patch Identification:

    System administrator or automated tools identify which patches are relevant to the system's installed software. the often involves checking security advisories and release notes provided by the Linux distribution.


Download and Verification:

    The necessary patches are download from the official repositories. Many Linux distributions use digital signatures to verify the authenticity and integrity of the patches.


Installation:

    The pathces are installed on the system using the packages management tools. The installation process may involve updating software packages or installing new once.


Dependency Resolutions:

    Packages managers automatically resolve and install any dependencies required by the patches to ensure that the system remains in a consistent state.


Configuration Updates:

    In some cases, patches may require configuration updates. This could involve modifying system configuration files or applying changes to ensure compatibilityy with the new software version.


Reboot:

    Some updates, especially those that involve the Linux Kernel or critical system libraties, may requires a system reboot to take effect.


Testing:

    After patching. it's advisable to test the system to ensure that the updates do not introduce new issues. This may involve checking the functionality of critical applications and services.


Documentation:

    System administrators often document the pathcing process, including the applied updates, to keep a record of changes made to the system.


Regular and timely patching is essential fot maintaining the security of linux systems. It helps protect against known vulnerabilities and ensures that the system benefits from the latest improvements in software fuctionality and performance. Automated tools and package management systems simplify the patching process for administrators, making it more efficient and less error-prone.



Difference Between Operating System (OS) & Kernel

 The operating system (OS) and the kernel are closely related components of a computer system, but they serve for different purposes.


Operating System (OS):

  • User Interface:
    The operating system provides a user interface that allows users to interact with the computer. This interface can be command-line-based (textual) or graphical, depending on the OS.

  • Resource Management:
    Manages system resources such as CPU, memory, disk space, and peripherals to ensure efficient utilization and prevent conflicts.

  • File System Management:
    Handles file creation, deletion, and manipulation, organizing data into files and directories.

  • Device Drivers:
    Includes device drives to facilitate communication between the operating system and hardware devices, ensuring compatibility.

  • Security:
    Enforces security measures, such as user authentication, access control, and encryption protect the system and its data.

  • Networking:
    Manages network connections, protocols, and communication between devices in a network.

  • Application Support:
    Provides an environment for software applications to run offering services and libraries that applications can use.

  • Task scheduling:
    Manages the ececution of processes and applications, allocating CPU time and prioritizaing tasks.

Kernel:

  • Core System Functions:
    The kernel is the core component that directly interacts with the hardware, managing essential fuctions like process scheduling, memory allocation, and device communication.

  • Process Management:
    Controls the execution of processes, including process creation, termination and scheduling.

  • Memory Management:
    Allocates and deallocates memory space for processes, ensuring efficient use of available RAM.

  • Device Management:
    Handles communication between software and hardware devices through device drivers.

  • Interrupt Handling:
    Manages hardware interrupts, allowing the kernel to respond to events such as I/O requests or hardware errors.

  • System calls:
    Provides an interface for system calls, which are requests made by applications or processes to access kernel services.

  • Security:
    Enforces security measures at the kernel level, controlling access to system resources and protecting against unauthorized actions.

  • Bootstapping:
    Responsible for loading the operating system into memory during the boot process, initalizing essestial system components.

Understanding the relationship between the operating system and the kernel is crucial for grasping how a computer system manages its resources and ececutes tasks. The OS relies on the kernel to interact with hardware and perform low-level operations, while the kernel relies the OS for higher-level management and user interaction.


How to Upgrade Linux Kernel in CentOS

Introduction

The kernel is the core component of an operating system, serving as the bridge between hardware and software. It manages system resources, facilities communication between hardware and applications and ensures the overall stability and functionality of the computer. Acting as a supervisor, the kernel handles tasks such as process scheduling, memory management and device communication. It plays a pivotal role in enabling various software programs to run efficiently on a computer, making it an essential component for the proper functioning of an operating system.


Steps to Update Kernel Version on CentOS/RHEL

Before updating Kernel version on CentOS/RHEL, check installed kernel version of your system OS by following any one of the commands.

uname -r  

cat /proc/version  


Step 1: -  Enable to latest version of EL Repository

To install the new kernel version, a new latest version of EL repository needs to be enabled by following commands

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org  
        
$ sudo rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm  

Step 2: -  List All Available Kernel versions

To list all available kernek versions, execute following command

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

Step 3: - Select Required version of the kernel to install

To install the latest version of stable long-term support kernel use following command

sudo yum --enablerepo=elrepo-kernel install kernel-lt  

Step 4: -  Set Default Kernel Version

To set latest installed version of the kernel to load at the boot time automatically edit grub file under /etc/default

sudo vim /etc/default/grub  

Search for the GRUB_DEFAULT line and change it to GRUB_DEFAULT=0. This will instruct boot loader to load default to the first kernel on the list, which is the latest.

After saving the /etc/default/grub file execute the following command to recreate the kernel configuration

sudo grub2-mkconfig -o /boot/grub2/grub.cfg  

Step 5: - Reboot  the system
    
sudo reboot