Posts

Showing posts with the label RHEL 7

Preparing RHEL 7.5 base image for docker container from scratch

Whenever we start working with a container, to start you need a base image for any specific Operating system as per your requirement. You can get base images for many OS distributions except RHEL OS as it needs licensing. So in case, you want to prepare a base image of RHEL operating system you can follow below steps which are pretty straight forward:  Prerequisites: Mount RHEL 7.5 ISO on /mnt and create a .repo file: [root@localhost yum.repos.d]# cat /etc/yum.repos.d/local.repo [localrepo] name=Local Repository baseurl=file:///mnt gpgcheck=0 enabled=1 OPTIONAL: HTTP/HTTPS repository is needed when you need to install any packages inside a container, or while preparing containers. [root@localhost yum.repos.d]# cat httplocal.repo [rhel-core] name=RHEL 7.5 Core baseurl=http://web1.repo.local/linux/RedHat/7.5Server/en/os/x86_64/ gpgcheck=0 enabled=1 OPTIONAL: Set proxy if needed in your network. Steps to create a base image: ...

Monitoring Memory, CPU and swap on RHEL or CentOS 7

Image
top : The top provides a dynamic real-time view of running processes, CPU, Memory and SWAP utilization on a system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel. [root@localhost ~]# top In case as a root you want to check it for some particular user then : [root@localhost ~]# top -u hpe pmap : This command report memory map of a process or processes. [root@localhost ~]# pmap -d 22745 vmstat : This command reports information about processes, memory, paging, block IO, traps, disks and cpu activity. [root@localhost ~]# vmstat -w [root@localhost ~]# vmstat -as [root@localhost ~]# vmstat -dw [root@localhost ~]# vmstat -D             5 disks             2 partitions         48470 total reads           104 merged reads     ...

Space reclamation / UNMAP on RHEL or CentOS 7

What is Space Reclamation? This feature supports Thin Provisioned environment, and it is the process of freeing space from the storage system that has already been freed from the host file system. A host file system contains metadata to keep track to know which blocks are available to store new data and which blocks contain actual data and must not be overwritten. This metadata is stored within the LUN. When a file is deleted in the host file system, the file system metadata is updated to mark that file's blocks as free space. Total file system free space is then recalculated to include the newly-freed blocks. To the storage system, these metadata updates appear no different than any other writes being performed by the host. Therefore, the storage system is unaware that any deletions have occurred. What is Unmapping? Unmapping is a process which de-allocates relationship between LBA and a physical block in a logical unit. Reclamation within RHEL and CentOS: RHEL / Ce...

How to install and configure Docker on RHEL or CentOS 7 ?

How to install and configure Docker on RHEL or CentOS 7 ? Step 1. Install the required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the device-mapper storage driver. Verify if centos "extras" repository is enabled in "/etc/yum.repos.d/CentOS-Base.repo", bydefault it would be enabled: [ extras ] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 NOTE:  If installing on RHEL 7.5 or ater version, please mount RHEL 7.6  or later ISO to /mnt and add local repository for yum, note that RHEL 7.6 iso is needed to update few of the packages and dependencies as 7.5 ISO has old version of packages which are not compatible to the latest docker release...

How to change default run-level in RHEL or CentOS 7

How to change default run-level in RHEL or CentOS 7 There is change in process to setup default run-levels from init 3 (multi-user) to init 5 (Graphical) and vice versa. If we see "/etc/inittab" file it's been changed from RHEL/CentOS 6.x to 7.x. [root@localhost ~]# cat /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target # To check what is the default run-level configured currently : [root@localhost ~]# ls -l /lib/systemd/system/default.target l...

Blacklisting modules in RHEL or CentOS 7

Blacklisting modules in RHEL or CentOS 7 You may come to a requirement where you want to "blacklist" a module. Why would you need this feature? Because sometimes a module may cause conflict with another modules, or is superseded by another module, or is otherwise undesirable. To blacklist a module, the easiest way is to add an module entry to /etc/modprobe.d/blacklist.conf Let's see how it can be done ! We can take "vfat" module for example, check if it is loaded: [root@localhost ~]# lsmod | grep -i vfat [root@localhost ~]# If you see in below command it's allowed to load, not blacklisted: [root@localhost ~]# modprobe --showconfig | grep vfat alias fs_vfat vfat [root@localhost ~]# Now we will try to load it: [root@localhost ~]# modprobe vfat [root@localhost ~]# lsmod | grep -i vfat vfat                   17461  0 fat                  ...

How to recover /boot partition on RHEL or CentOS 7?

Image
What if mistakenly you delete all the files from /boot partition or files got corrupted due to some reason ! You will see below error on the screen at the time of system boot. But there is a way to recover /boot partition files :) Follow these steps to recover /boot partition : Step 1 :  Mount RHEL or CentOS 7 ISO image on your physical server and boot from it. In case you are using HPE Prolient server you can mount this ISO image on iLO, if this is virtual environment then mount it accordingly and reboot server or VM from ISO. Once rebooted you will see below options: Step 2 :  Scroll down and select "Troubleshooting" option from menu and PRESS "Enter" Step 3 :  Select "Rescue a CentOS system" and press ENTER: Step 4 :  Press ENTER key again to continue: Step 5 :  To continue, Type "1" and press ENTER, this will bring you to rescue mode, chroot sysimage filesystem using below command: ...

Recover or restore initramfs file in RHEL or CentOS 7

Image
What if "initramfs" file is deleted or corrupted on your RHEL or CentOS 7 ? Lets know what is initramfs image ? The INITial RAM Disk (initrd) is an initial root file system that usually get mounted prior to when the real root file system gets available. The "initrd" image is also known as "initramfs (Initial RAM FileSystem)" from RHEL 6.x onwards. The initrd/initramfs gets bound to the kernel and loaded as part of the kernel boot procedure. The kernel then mounts this initrd/initramfs as part of the two-stage boot process to load the modules to make the real file systems available and mount's the real root file system. Initrd/Initramfs image provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root filesystem and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root filesystem which was mounted from initrd/initramfs is then ...

Extending root partition size online in RHEL or CentOS 7

Why do we need to extend root partition size? There are couple of reasons that root filesystem should always be having free space, else: 1. Without free space programs and OS can crash. 2. No new services or application can be started on the server. 3. Can't write anymore data resulting DU Hence admin will be left with two options either remove unnecessary files and free up some space or extend root partition size online i.e. without impacting running application or downtime. Below detailed steps will help you to extend your root partition space online: Step 1. Check current root partition size: # df -kh Filesystem               Size  Used Avail Use% Mounted on /dev/mapper/centos-root   46G  6.1G   40G  14% / Here root partition is of "46GB". Step 2. Add a new disk and re-scan HBA's to discover it: # fdisk -l Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1...

Installing and configuring Crash utility for kernel dumps analysis on RHEL OR CentOS 7

Installing and configuring Crash utility for kernel dumps analysis on RHEL OR CentOS 7 What is Crash utility? Crash is a linux utility which analyses the core dump file created by kdump. Crash utility depends on the kdump and kexec utilities to obtain its input file. A linux kernel, when boots with the crashkernel argument, it reserves some memory space to capture kernel dump in panic conditions. In case kernel panic's, the kexec utility triggers a warm reboot into a dump kernel, where the memory contents of the panicked kernel get's backed up. Once the core dump copied to the configured location then system does cold reboot and loads up standard default kernel. Step 1. Install Crash utility and Kernel-debug package: # yum install crash OR You can download "Crash" source, compile it and install: # wget http://people.redhat.com/anderson/crash-7.2.5.tar.gz # tar -zxvf crash-7.2.5.tar.gz # cd crash-7.2.5 # make && make install ...