Saturday, 31 July 2021

How to Update Kernel on RedHat 8.1 Linux Server


This tutorial will guide you on how to perform a Update on RedHat 8.1 Linux server. Before that check here to Register and Subscribe with RedHat Enterprise.

1. Check Kernel Version


[root@worldwide ~]# uname -a

Linux worldwide.linux.net 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


2. Update Server

After a successful certificate registration with RedHat, execute yum -y update command to update RedHat 8.1 Linux Server.


[root@worldwidelinux ~]# yum -y update


You will see the 1000's of packages are downloading, installing and updating on your terminal screen. Once done you will see the Complete! status at the end. Check the newly updated kernel using uname command.

3. Reboot Server

To start with updated kernel, we need to restart server. You can manually reboot server by pressing power button or execute a reboot command in terminal.


[root@worldwide ~]# reboot


4. Check updated new Kernel Version


[root@worldwide ~]# uname -a

Linux worldwide.linux.net 4.18.0-305.10.2.el8_4.x86_64 #1 SMP Mon Jul 12 04:43:18 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux


How to check Kernel Version and System Information in RedHat 8.1 Linux Server


This tutorial will guide you on how to check Kernel Version & System Information on RedHat 8.1 Linux server.

Open terminal and execute uname command.


[root@worldwide ~]# uname -a

Linux worldwide.linux.net 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


Friday, 30 July 2021

How to Register and get Subscription Certificates for RedHat 8.1 Linux server on RedHat Enterprise Website


This tutorial will guide you on how to Register your server and get Subscription Certificates on RedHat Enterprise Website.

If you execute yum update command without RedHat subscription, you will get an error message as mentioned below:

[root@worldwidelinux ~]# yum update

Updating Subscription Management repositories.

Unable to read consumer identity

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d".

Please follow the below steps to get RedHat subscriptions and certificates then update your kernel on RedHat8.1 Linux Server:

1. Login to RedHat Portal and create a system profile for your server.

2. Attach Subscriptions

Click the Subscriptions tab, and attach subscriptions with the system.

3. Download the Entitlement Certificate

Goto Download Certificates then download a certificate.

Download the Entitlement Certificate

The downloaded file will be named as similar 5b5a423b4-3e0e-1e68-b0g1-jh0597350c7b_certificates.zip. Then unzip a file as shown in the below format:


[root@worldwidelinux ~]# unzip 5b5a423b4-3e0e-1e68-b0g1-jh0597350c7b_certificates.zip

Archive: 5b5a423b4-3e0e-1e68-b0g1-jh0597350c7b_certificates.zip

signed Candlepin export for 5b5a423b4-3e0e-1e68-b0g1-jh0597350c7b

inflating: consumer_export.zip

inflating: signature


Unzip consumer_export.zip file, you will get an .pem file.


[root@worldwidelinux ~]# unzip consumer_export.zip

Archive: consumer_export.zip

Candlepin export for 5b5ad9b4-ee0e-4b68-b0f1-ce0551350c7b

inflating: export/meta.json

inflating: export/entitlement_certificates/246492651842394145.pem


4. Move .pem into /tmp directory.

Execute mv command to move a certificate .pem file into /tmp directory to subscribe.


[root@worldwidelinux ]# mv ./export/entitlement_certificates/146492651861694179.pem /tmp/


5. Subscription with RedHat

Make a subscription with RedHat Enterprise using subscription-manager and .pem file which we downloaded and moved into /tmp directory on RedHat 8.1 Linux Server.


[root@worldwidelinux ~]# subscription-manager import --certificate=/tmp/146492651861694179.pem

Successfully imported certificate 146492651861694179.pem


6. Update Server

How To Configure HostName Permanently on RedHat 8.1 Linux Server


This tutorial will guide you on how to Configure HostName Permanently on RedHat 8.1 Linux server.

Please follow the below steps to configure HostName permanently on RedHat 8.1 Linux Server.

1. Open hostname config file using vim editor as shown in the image given below:

[root@worldwidelinux ]# vim /etc/hostname

hostname config

2. Change default hostname from localhost.localdomain to your hostname.

For example, if we would like to change from localhost.localdomain to worldwide.linux.net, your hostname file should look like given below:

Change default hostname

Press Esc key then type :wq! and press Enter key to save and close the file.

There is an another way to configure hostname permanently using hostnamectl command.

Execute below command to configure hostname permanently.

[root@worldwidelinux ]# hostnamectl set-hostname worldwide.linux.net

3. Reboot a server

You can manually reboot server by pressing power button or execute a reboot command in terminal.

[root@worldwidelinux ]# reboot

Reboot

How to Change Network Interface Name from enp1s0f1 to eth0 on RedHat 8.1 Linux Server


This tutorial will guide you on how to perform a Network Interface Name change from ifcfg-enp1s0f1 to eth0 on RedHat 8.1 Linux server.

Execute below command to list all the network devices

[root@worldwidelinux ]# nmcli device

nmcli

Please follow below steps to change a network interface name on RedHat 8.1 Linux Server:

1. Update GRUB File

Edit file /etc/default/grub and add net.iframes=0 blosdevname=0 to line GRUB_CMDLINE_LINUX.

GRUB File

2. Regenerate a GRUB configuration file and overwrite existing one:

[root@worldwidelinux ]# grub2-mkconfig -o /boot/grub2/grub.cfg

GRUB File

3. Edit NAME, DEVICE and HWADDR paarameters in ifcfg-enp1s0f1 file.

Change NAME, DEVICE and HWADDR fields from enp1s0f1 to eth0 on ifcfg-enp1s0f1 file.

Network Script File

4. Move ifcfg-enp1s0f1 file to ifcfg-eth0

Move a network configuration file to ifcfg-eth0 using mv command.

[root@worldwidelinux ]# mv /etc/sysconfig/network-scripts/ifcfg-enp1s0f1 /etc/sysconfig/network-scripts/ifcfg-eth0

Move

5. Disable Network Manager Service

For network interface name change, you must disable networkmanager service otherwise it will revert back the changes on reboot.

Disable Network Manager

6. Reboot a server

You can manually reboot server by pressing power button or execute a reboot command in terminal.

[root@worldwidelinux ]# reboot

Reboot

7. Check Network Interface Name

Execute nmcli command to list all the network devices.

[root@worldwidelinux ]# nmcli device

Network Interface Name

How to Disable FireWall on RedHat 8.1 Linux Server


This tutorial will guide you on how to Disable FireWall and it's service on RedHat 8.1 Linux server.

Please follow the below steps to disable Firewall on RedHat 8.1 Linux server:

1. Check firewalld service status

[root@worldwidelinux ]# systemctl status firewalld.service

firewalld service status

We have to modify FireWall settings manually for incoming and outgoing requests for services.

2. Stop FireWall Service

[root@worldwidelinux ]# systemctl stop firewalld.service

Stop FireWall Service

3. Disable Firewall Service

[root@worldwidelinux ]# systemctl disable firewalld.service

Disable Firewall Service

How to Disable SELinux on RedHat 8.1 Linux Server


This tutorial will guide you on how to Disable SELinux on RedHat 8.1 Linux server. After successful RedHat 8.1 operating system installation this is the first step we need to do it on linux server.

[root@worldwidelinux ]# getenforce

Please follow the below steps to disable SELinux on RedHat 8.1 Linux server:

1. Open selinux config file using vim editor as shown in the image given below:

[root@worldwidelinux ]# vim /etc/selinux/config

selinux config

2. Change a value of SELINUX from enforcing to disabled.

SELINUX

Press Esc key then type :wq! and press Enter key to save and close the file.

3. Reboot a server

You can manually reboot server by pressing power button or execute a reboot command in terminal.

[root@worldwidelinux ]# reboot

reboot

4. Check status of SELinux

Execute getenforce command to check the status of SELinux and make sure it is disabled.

status of SELinux

Thursday, 29 July 2021

How to Enable Quota on File Systems in RedHat 8.1 Linux Server


This tutorial will guide you on how to Enable Quota on /home File Systems in RedHat 8.1 Linux server.

Please follow the below steps to enable quota for /home file systems:

1. Edit fstab file using vim editor.

Add usrquota & grpquota on /home mount point line after the defaults with seperated by comma.

[root@worldwidelinux ]# vim /etc/fstab

grpquota

Save and Close the file by pressing Esc key and type :wq! then press Enter key.

2. Reboot your server to reflect the user quota allocation on /home mount point.

[root@worldwidelinux ]# reboot

3. Turn on quota for home file system

[root@worldwidelinux ]# quotaon -avug

Whereas:
-a : All automatically mounted non NFS filesystems in /etc/fstab with quotas will have their quotas turned on.
-v : Display a messfae for each filesystem where quotas are turned on.
-u : Manipulate user quotas.
-g : Manipulate group quotas.
quota

Verify quota is turned on or not using below command:

[root@worldwidelinux ]# repquota -a

Verify quota

soft: Once soft limits reached, it will warn a users(Size should be in KB).

hard: Once hard limits reached, it will not allow users to create files(Size should be in KB).

How to Allocate Quota for Users on RedHat 8.1 Linux Server


This tutorial will guide you on how to Allocate Quota for User on RedHat 8.1 Linux server.

1. Execute edquota command with your username to set a quota for user.

Syntax: edquota -u username

For example, set a redhat user quota soft as 786 MB and hard as 1024 MB.

[root@worldwidelinux ]# edquota -u redhat

Change value of soft limit value as 804864 and hard limit value as 1048576 in KB.

edquota

Save and Close the file by pressing Esc key and type :wq! then press Enter key.

2. Verify quota is allocated to user using repquota command.

Verify quota

Execute below command, to set a same existing user quota to new user, execute below command:

Syntax: edquota -p olduser newuser

For example, copy user redhat quota to redhat1 user.

[root@worldwidelinux ]# edquota -p redhat redhat1

Tuesday, 20 July 2021

Top 10 Linux Network Monitoring Commands


  1. ifconfig - Configure a network interface

    Ifconfig is used to configure the network interfaces. View, edit and modify the configured IP address, DNS, gateway and Netmask.

  2. ip - show / manipulate routing, devices, policy routing and tunnels

  3. traceroute - print the route packets trace to network host

    Tracks the route packets taken from an IP network on their way to a given host. It utilizes the IP protocol's time to live (TTL) field and attempts to elicit an ICMP TIME_EXCEEDED response from each gateway along the path to the host.

  4. ping - send ICMP ECHO_REQUEST to network hosts

    Check whether the particular ipaddress/domain is available or not.

  5. netstat - Print network connections, routing tables and interface statistics

    Netstat prints information about the Linux networking subsystem.

  6. route - show/manipulate the IP routing table

    Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program.

  7. nslookup - query Internet name servers interactively

    Nslookup is a program to query Internet domain name servers.

    Nslookup has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.

  8. tcpdump - Dump traffic on a network

    Prints out a description of the contents of packets on a network interface that match the boolean expression; the description is preceded by a time stamp, printed, by default, as hours, minutes, seconds, and fractions of a second since midnight.

  9. -

  10. -

Disk Usage Linux Commands


  1. free - Display amount of free and used memory in the system

    Free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel.

  2. du - Estimate file space usage

    Amount of disk space used by the specified files or folders

  3. df - Report file system disk space usage

    Displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown.

Top 5 System Monitoring Tools


Monitor linux

Monitor linux system performance using default tools in linux operating system.

  1. top - Display all linux running linux process

    Top command provides you the real-time process or threads currently managed by linux kernel.

  2. htop - Simllar to top

    you can see all the processes running on the system, along with their full command lines, as well as viewing them as a process tree, selecting multiple processes and acting on them all at once

  3. lsof - Lists all open files belonging to all active processes

  4. ps - Report a snapshot of the current processes.

    ps -A to select all the process.

  5. uptime - Tell how long the system has been running.

    Uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

Top 10 Basic Linux Commands For Beginners


Let's learn some basic linux commands

Let's learn some basic linux commands

  1. ls - List all the folder contents

    Example: ls -la List all hidden files and directories

  2. pwd - Print name of current/working directory

    Know your working directory location or path

  3. cd - Enter into or exit from the directory

    Syntax: cd destination_path

    Example: cd /home/user Enter into a home user location

  4. mkdir - Create a directory

    Syntax: mkdir directory_name

    Example: mkdir test Create a new directory named test

  5. rm - Remove a file or directory

    Syntax: rm filename

    Example: rm myfile Remove a file called myfile

    Example: rm -r myfolder Remove a folder called myfolder

  6. mv - Move/Rename a file or folder

    Syntax: mv source_filename destination_filename

    Example: mv file1 file2 Move or rename a file1 to file2

  7. cp - Copy files and directories

    Syntax: cp source_filename destination_filename

    Example: cp file1 file2 Copy all contents from a file1 to file2

  8. cat - Display file contents

    Syntax: cat filename

    Example: cat file1 Show all the contents inside the file1 in standared output device(usually your monitor).

  9. su - Switch user account

    Syntax: su - username

    Example: su - linuxer logged into linuxer user account.

  10. touch - Create an empty file with the specified name.

    Syntax: touch filename

    Example: touch file1 Create an empty file called file1.