Linux OS patching commands: checklist for Pre and Post server Reboot

Every Linux admin should know what all action/checklist needs to be performed before/after the Linux OS Patching and server reboot.

In this article, we are going to learn Linux OS patching commands Checklist for Pre and Post server Reboot.

Introduction

Linux Host Patching is a feature in Enterprise Manager Grid Control that helps in keeping the machines in an enterprise updated with security fixes and critical bug fixes, especially in a data center or a server farm.

A patch contains software fixes and other updates. Patching is necessary to prevent an attacker from exploiting software vulnerabilities. It stops previous attacks from recurring and enhances data security.

Why is patching important?

Patch management is important for the following key reasons:

  • Security: Patch management fixes vulnerabilities in your software and applications that are susceptible to cyber-attacks, helping your organization reduce its security risk.
  • System uptime: Patch management ensures your software and applications are kept up-to-date and run smoothly, supporting system uptime.
  • Compliance: With the continued rise in cyber-attacks, organizations are often required by regulatory bodies to maintain a certain level of compliance. Patch management is a necessary piece of adhering to compliance standards.
  • Feature improvements: Patch management can go beyond software bug fixes to also include feature/functionality updates. Patches can be critical to ensuring that you have the latest and greatest that a product has to offer.

Linux OS patching commands: Checklist for Pre and Post server Reboot

Follow the steps below before patching the Linux OS and rebooting the server.

1. Linux os patching Checklist for Pre server Reboot

  • Register and Enable Red Hat Subscription
  • Note all running services on the Linux server.
  • Check the current kernel version.
  • Check the External disk/Volume attached to a Linux server and add an external disk entry in /etc/fstab (this will automount all disks after reboot)
  • Sanity-check and save the NTP system time synchronized
  • Stop services on the Linux server.
  • Reset password for root.

2. Linux os patching Checklist for Post server Reboot

  • Verify the service with the list which you have taken on pre-reboot.
  • Sanity-check – kernel version booted up, RAID status, system time, started service.
  • Check system logs – syslogs, error logs.

Linux OS patching Checklist Commands

We will now see the Linux OS patching Checklist Commands.

1. view route with the ip details

Check the route and server IP details with the following IP command.

ip r

2. check network interfaces

By using this command you can get network information like IP Address (both IPV4 & IPV6), Physical Address (MAC Address), Subnet Mask, Broadcast address, MTU, Metric, Packets, Drops, and lists of all connected network interface cards (eg: eth0, eth1, lo, WLANs), etc.

Suggested Read: Linux ifconfig Command With Examples.

ifconfig

3. server hostname

hostname command in Linux is used to obtain the DNS(Domain Name System) name and set the system’s hostname or NIS(Network Information System) domain name. to check the server hostname details with the following hostname command.

hostname

4. server uptime

This command returns a set of values that involve, the current time, the amount of time the system is in running state, the number of users currently logged in, and the load time for the past 1, 5, and 15 minutes respectively. to check the server uptime details with the following uptime command.

Suggested Read: Linux Uptime Command With Usage Examples.

uptime

5. Red Hat Subscription

to check that the server is registered with the RedHat subscription with the following subscription-manager commands.

subscription-manager status

6. check the Kernel release version

To check the Kernel release version just use the uname Linux command with the argument -r.

Suggested Read: Uname Linux Commands With Examples.

uname -r

7. view RHEL Linux version

To check the RHEL Linux version type the following cat command.

Suggested Read: cat Command Examples in Linux.

cat /etc/redhat-release

8. checking disk usage Information

To check the file system disk space statistics in “human-readable” format type the following df command.

Suggested Read: DF Command With Examples.

df -TH

9. file systems table

The fstab (or file systems table) file is a system configuration file. The /etc/fstab file is a system configuration file that contains all available disks, disk partitions, and their options. Each file system is described on a separate line. To check the type the following cat /etc/fstab command.

cat /etc/fstab

10. Get System Hardware Information

DMI Id gives us particular hardware information about the system. Dmidecode with options ‘-t ‘or ‘–type‘ and ‘Id‘ will provide us with the exact information. The id 1 will give us System information.

dmidecode -t1

11. Check available Physical Volumes

This represents the raw disk space as disk partitions. PVS command to check the quick short summary of all available Physical Volumes.

pvs

12. Check Volume Group Details

To check quick short details of Volumes Groups you can use vgs command.

vgs

13. Check logical Volume Details

To check all available Volume Groups follow the below command.

Suggested Read: Linux LVM (Logical Volume Manager)

lvs

14. display block devices

Lsblk is used to display details about block devices and these block devices(Except ram disk) are basically those files that represent devices connected to the system. To display block devices type the following lsblk command.

lsblk

Install and update Package using YUM Command

To install and update the package using the yum command follow the below command. You can use the yum command with option -y. This will assume Yes for any question asked during package installation.

Suggested Read: Yum Command With Examples

yum update -y

After successfully updating the package, reboot the server and verify the service with the list which you have taken on pre-reboot.

reboot

Command to check/list all running services

For CentOS 6.x / RHEL 6.x or older
service --status-allservice --status-all | moreservice --status-all | grep ntpdservice --status-all | less
For CentOS 7/RHEL 7 using systemctl
# systemctl list-units --type=serviceOR# systemctl --type=service

This is the end of the tutorial, we listed some Linux OS patching commands and Checklists for Pre and Post server Reboot, If you found any new checklists please mention them in the comment section below.

Conclusion

I hope you have learned something from this article.

Now I’d like to hear your thoughts.

Was this guide useful to you?

Or maybe you have some queries.

Have I not included any command in this guide?

Leave a comment below.

Share this:
WhatsApp Channel Join Now
Telegram Channel Join Now
Instagram Channel Join Now

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.