rhel 8 – ExpLinux https://www.explinux.com Explore Linux How to, Tutorials, Unix, Updates, Technology. Tue, 01 Aug 2023 19:01:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://www.explinux.com/wp-content/uploads/2023/04/cropped-favicon-32x32-1-32x32.png rhel 8 – ExpLinux https://www.explinux.com 32 32 How to change UID and GID of the local user in Linux? 3 Easy Steps https://www.explinux.com/2021/04/how-to-change-uid-and-gid-of-the-local-user-in-linux.html https://www.explinux.com/2021/04/how-to-change-uid-and-gid-of-the-local-user-in-linux.html#respond Thu, 08 Apr 2021 11:43:00 +0000 How to change UID and GID of the local user in Linux? 3 Easy Steps Read More »

]]>
 How to change the UID and GID of the local user?
Have you ever faced the issue of a service not starting or a permission error? You need to check if it correct UID and GID assigned or not. If not then in this article you will learn how to change UID and GID or local users and service accounts.
How to change UID and GID in Linux
 

Environment

  • RHEL 6
  • RHEL 7
  • RHEL 8
  • CentOS 7
  • Rocky Linux 8

Issue

  • UID and GID of the local required to change

Related post: How to Disable Firewall in Linux 

Resolution

The task of changing UID and GID of the local user is not quite simple and caution must be taken doing this. UID and GID of the local user explinux will be modified from 503 to 505 in the below example.

Check Running Process

Check for any processes running in the system as this user and stop them. Changing the local user UID and GID to a new one while there are processes running in the system using old UID is dangerous and can lead to data loss. Note, that ps will print UID instead of the user name if the user name is too long, so search for both UID and the user name in the process list:

# ps -ef | grep explinux
# ps -ef | grep 503

If you find any running process kill it by kill -9 pid command

Modify UID and GID

Step 1

Backup is necessary  for /etc/passwd and /etc/group files before doing the steps below:

# cp -p /etc/passwd /etc/passwd.orig
# cp -p /etc/group /etc/group.orig

Currently, the user explinux has the UID and GID of 503 as shown below:

# id explinux
uid=503(explinux) gid=503(explinux) groups=503(explinux)

Step 2

First, we modify the GID of the user’s group to 505, as shown below:

# groupmod -g 505 explinux

Step 3

Next, modify the UID and GID value of the user explinux to 505, as shown below:

# usermod -u 505 -g 505 explinux

Alternate Method

The same can be done by direct editing /etc/passwd and /etc/group files.

Before:

[/etc/group]
explinux:x:503:

[/etc/passwd]
explinux:x:503:503:...(omit)...

After:

[/etc/group]
explinux:x:505:

[/etc/passwd]
explinux:x:505:505:...(omit)...

Now verify whether UID and GID were indeed changed, as shown below:

# id explinux
uid=505(explinux) gid=505(explinux) groups=505(explinux)

Effect of change UID and GID

If in your system or server, any other existing user is a member of the group previously having GID of 503, it will not be in this group anymore, because the GID of the group has been changed to 505. So change the GIDs of all the user which are having GID of 503 to 505 or any other existing group as per your requirements.

Change Files Ownership To user UID and GID

Owner UID and GID of the files and directories also will not change automatically. All the files and directories with a previous owner UID and GID should have changed them. The only way to do it reliably is by scanning through the filesystem beginning with the root (/) and changing UID or GID.

The chown command resets SETUID and SETGID bits, and you have to remember which ones by finding all such files first and setting it back after you do the chown command by the below command:

# find / -uid 503 -perm /6000 -ls
# find / -gid 503 -perm /6000 -ls

After saving the list of files with SETUID and SETGID bits, you may actually change files UID and GID by the below command :

# find / -uid 503 -exec chown -v -h 505 '{}' ;
# find / -gid 503 -exec chgrp -v 505 '{}' ;

Custom Settings

If you are running the default Linux program you are done with the above setting nut if you have configured any third-party application. Now we need to change the configuration file or setting where the affected user UID is used instead of the user name should be changed to reflect a new UID value of the user. For this locate such configuration files or settings according to the software installed and change the UID of the affected user to a new one, 503 to 505 in this example case. For Example you have added user details in any third-party software to access or run a program then you need to add them again.

Now at this point, you have learned how to correctly change UID and GID or any user or service account.

]]>
https://www.explinux.com/2021/04/how-to-change-uid-and-gid-of-the-local-user-in-linux.html/feed 0
Grub2 files are missing from /boot. How to recover ? https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html#respond Tue, 23 Feb 2021 02:13:00 +0000 Grub2 files are missing from /boot. How to recover ? Read More »

]]>
Repair Grub2

Grub2 or Boot Repair  

Due to some file corruption or mishandling we lost grub. This can cause the system to hang in the boot.

When you reboot the system it will not boot, So before rebooting the system check this file is in place or not. If you accidentally rebooted and the system is unable to boot then boot the server in rescue mode and follow the below steps.

Environment

  • Red Hat Enterprise Linux 7 
  • CentOS 7
  • RHEL 8

Issue

  • Missing the ‘/boot’, grub folder, and grub.conf file which are essential to boot the system.
  • How to recover missing boot files ?

Resolution

  • Verify Boot directory contents are really missing or the /boot is not mounted properly :
#ls /boot/grub2/
  • Install grub2:
#grub2-install /dev/<disk name>
  • Create grub.cfg file:
#grub2-mkconfig -o /boot/grub2/grub.cfg
  • Create device.map file if missing:
#vi /boot/grub2/device.map

(hd0) /dev/<disk name>
  • Reboot
Now the server or PC  will boot properly. In this article, we have learned the way to recover grub and save it from reinstallation.
]]>
https://www.explinux.com/2021/02/grub2-files-are-missing-from-boot-how-to-recover.html/feed 0
How to reset my MySQL database root password? https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html#respond Sun, 17 Jan 2021 02:02:00 +0000 How to reset my MySQL database root password? Read More »

]]>
How to reset my MySQL database root password?
This is a very common issue if you are working in a big environment or a system where everything is automated. People always forgot their MySQL password. This article will help you recover your password without any data corruption.

Environment

  • Red Hat Enterprise Linux including:

    • Red Hat Enterprise Linux 3
    • Red Hat Enterprise Linux 4
    • Red Hat Enterprise Linux 5
    • Red Hat Enterprise Linux 6
    • Red Hat Enterprise Linux 7
    • Red Hat Enterprise Linux 8
  • MySQL-server

Issue

 Forgot the MySQL root password. And you want to know how to reset your password. How do I reset the mysql-server password?

# mysql -u root'
Access denied for user 'root'@'localhost' (using password: NO)'

Resolution

To reset the MySQL root password We have to follow the below procedure :

  1. The first Step stop the MySQL service:
    # service mysqld stop
    Stopping MySQL: [ OK ]
  2. Use the below command to start MySQL :

    # /usr/bin/mysqld_safe --skip-grant-tables &

    Note: On RHEL 3, mysqld_safe was called safe_mysqld:

    # /usr/bin/safe_mysqld --skip-grant-tables &

    Note: mysql_safe is a shell script this will only invoke mysqld but additionally traps any forceful terminations of the MySQL server and this will avoid any database corruption. 

  3. Change the password of the root user:

    # mysql -u root mysql
    mysql> UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
    mysql> FLUSH PRIVILEGES;
    mysql> exit;
  4.   Now Restart mysqld first use mysqladmin to ensure that the service shutdown successfully to avoid any other issue.

    # mysqladmin -p shutdown

  5. Now restart the MySQL service as per normal:

    # service mysqld start 

Root Cause

  • The root password for mysqld was forgotten or lost.
  • You are a new admin and the old admin did not handover passwords.
  • Other team members reset the password and missed it.
  • Use of file to create a new server but MySQL password is not mentioned in doc.
]]>
https://www.explinux.com/2021/01/how-to-reset-my-mysql-database-root-password.html/feed 0
How To Enable X11 Forwarding in RHEL 8 / Centos 8 https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html#respond Tue, 07 Jul 2020 03:00:00 +0000 https://explinux.online/2020/07/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8/ How To Enable X11 Forwarding in RHEL 8 / Centos 8 Read More »

]]>
How To Enable X11 Forwarding in RHEL 8 / Centos 8

How To Enable X11 Forwarding in RHEL 8 / Centos 8

X11 is very important for a sysadmin because some applications only install or run on GUI. This always happen in case of third party applications. So in this article, we are talking about how to use x11 forwarding.
This is an awesome tool for every sysadmin who is working remotely via putty and need to work or install GUI applications.
Mostly cases we use it on java and KVM applications with the help of x11. 
If you are using it on the remote machine do not set any environment variable. Just enable x11 forwarding in ssh setting in putty and follow the below steps.
Putty Setting for x11

What is X11?

X11 is the final or 11th version of x windows system .Mostly places we see x window and in Linux we see x11. 
In this system, a program or we can say, x client display graphics on our localhost or windows computer and run on the remote machine. And receives its input from the screen for the remote machine. 
In Linux when we are working on the remote machine via putty and we required to work on any graphical application we use x11 forwarding on the Linux machine.

X11 Forwarding is Secure?

 The secure shell has the feature of x11 forwarding. So our all data travel from ssh to localhost. Then we can say x11 forwarding is secure as ssh connection is secure.

How To Enable X11 Forwarding in Linux?

Step-1 Install requires packages 

# yum install xterm xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils -y

Step-2 Change the ssh configuration file for X11

We need to do changes to access the GUI application over ssh. Search Address family and unhash and change it as below:
#Port 22
AddressFamily inet
#ListenAddress 0.0.0.0
#ListenAddress ::
Search X11Forwarding  and unhash it. Do not change any other setting or environment variable.
X11Forwarding yes

Step-3 Restart ssh 

Restart ssh daemon for apply changes 
# systemctl restart sshd

Step-4 You need an Application 

You need to install xming or any application where putty forward x11 requests and display graphics.
You can check by type xterm application.
# xterm 
This will open the application in GUI mode in your x display application 
xterm
Now at this point, you have successfully configured x11 to use the graphical application on putty.
Share the article if found helpful.
]]>
https://www.explinux.com/2020/07/how-to-enable-x11-forwarding-in-rhel-8-centos-8.html/feed 0
How to Use vi Editor in Linux and vi Editor Cheat-Sheet with 38 Shortcut https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html#comments Sun, 05 Jul 2020 04:30:00 +0000 https://explinux.online/2020/07/05/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux/ How to Use vi Editor in Linux and vi Editor Cheat-Sheet with 38 Shortcut Read More »

]]>
How to Use vi Editor in Linux and vi Editor Command in Linux
How to Use vi Editor in Linux and vi Editor Command in Linux

How to Use vi Editor in Linux and vi Editor Command in Linux

vi Editor :

. vi is the symbolic link of vim and this default editor comes with Linux based OS. This is very popular among sysadmins. This a very simple and powerful editor. You can use it to make your rivels list, a letter to your valentine, script, code, and edit any source code. This is your best friend in the Linux system.

vi Editor modes:

vi Editor has 3 modes –

1- Command mode :

                                This is the default mode when we enter in vi editor. In this mode almost every key n keyboard has a function, so use it very carefully.
Command mode
Command mode when enter file using vi <filename>
Command mode when press esc key
Command mode when press esc key from any other mode

2- Insert Mode :

                         You can enter this mode by pressing the “i” key on the keyboard. In this mode, you can write anything your code, list, or edit file.
insert mode

3- Visual mode  or GUI mode :

                                                This is not available in all distro and less used feature of vi editor. You can enter this mode by pressing the “v” key on the keyboard from command mode.
visual mode
Note: By default vi editor mode is Command mode. You can enter any mode from command mode only and escape from that mode to command mode by pressing the “esc” key on the keyboard.
These are the modes of vi editor in Linux. Below you will see some vi editor cheat sheet which you can use in your sysadmin work and give you more understanding of vi editor commands in Linux.

vi Editor Basic Commands :

In this section, we will talk about the basic command of vi editor which has to know by every Linux user for use of the basic function of vi editor.

Create New File or Enter Any Existing File :

To enter any file use command vi <filename>. For example, see below
# vi explinux
enter vi editor
you will enter in command mode as default by this command.

Write or edit in vi editors:

Press lowercase i to enter in edit mode. Now you can write anything or delete and navigate by keyboard navigation arrow key.
insert mode

vi Editor Save and Exit :

When you finished your editing you have to come in command mode for exit or save the file. Please find below the steps to save and exit from the file.
  1. Press esc key on the keyboard to change command mode from insert mode.
  2. write “:wq! ” in lowercase. Press enter key to execute the command to save and exit from file. Please check below pic to understand more.
vi editor save and exit
w – stands for save file 
q – stands for quit from file 
! – do not ask anything just run my command 

vi Editor Cheat Sheet :

Now you have learned how to use vi editor and basic commands of vi editor which every Linux user should have known. Now we will talk about some advance command which should be known by every Linux sysadmin or any advance user.
These commands will run only in command mode as mentioned earlier. By default vi is in command mode if you are in another mode press esc key to enter in command mode.
Linux is a case sensitive so be careful about it.

List of Commands :

Open or edit any file :

# vi <filename>

Enter to Insert mode 

i

Enter in Command Mode:

esc key on the keyboard
Save the file and Continue Editing:
:w
Save and quit vi Editor :
:wq!
Quit from file and do not write change :
:q!

Yank :

Copy or yank line :
yy
Copy X number of lines :
Xyy
for example 3 lines – 3yy
Paste Yanked File Below the Cursor Line :
p
Paste Yanked File Above the Cursor Line :
P    or  shift+p
This is the yank function that can be used to reduce time. This is a very useful command.
Create a New Line below the current line of Cursor :
o
Create a New Line Above the Current Cursor Line:
O  or shift+o
Go To End of Line and Switch To Insert Mode for Write:
A  or shift+a
Switch To Insert Mode At Start Of Line:
a
Switch to Insert Mode at the Beginning of Line :
I   or  shift+ i
Move to Begin of the Word :
b
Move to End of  the Word:
e
 
Go to the Last Line of Open file :
G  or shift+g
Go to the X Number Line of Open file :
XG
for example, we have to go on 3rd line: 3G
Go to the X Number Line of Open file :
gg
Delete a Single Letter or Character:
x
Delete a Single Word in Open File:
dw
Delete X Number of Words in Open File :
Xdw
for example, delete 3 words: 3dw
Change Any Word in vi Editor :
cw
Delete an Entire Current Line :
dd
Delete X Lines in One Command :
Xdd
For example, we have to delete 3 lines then: 3dd
Change or Replace Any Character or Letter :
r
Overwrite All Characters form onwards Cursor Position: 
R  or shift+r
Get the Current Line’s line Number in Open File:
:num  and press enter
Get All Lines’s Line Number in Open File:
:set nu  and press enter key
Undo Last Change in vi Editor :
u
Undo Last Change in entire Line vi Editor :
U  or shift+g

Search in vi Editor :

/<yourstring>
or
?<yourstring>
press n for the next result in an open file in vi editor .

Navigation In vi Editor :

Move left :
h
Move Down:
j
Move up :
k
Move right :
l
At this point, you are familiar with vi editor commands. Practice more to become pro at vi editor.

Summary :

  • The vi editor is most popular and distributed in every Linux distribution to edit almost all types of files.
  • There are 3 modes of vi editor
  • In this article, we covered almost all commands of vi editor
Share Article if you like it or report any bug in comments
]]>
https://www.explinux.com/2020/07/how-to-use-vi-editor-in-linux-and-vi-editor-command-in-linux.html/feed 1
How to Create Network Bridge in RHEL 8 /Centos 8 https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html#respond Thu, 02 Jul 2020 04:55:00 +0000 https://explinux.online/2020/07/02/how-to-create-network-bridge-in-rhel-8-centos-8/ How to Create Network Bridge in RHEL 8 /Centos 8 Read More »

]]>

How to Create Network Bridge in RHEL 8 /Centos 8

How to Create Network Bridge in RHEL 8 / Centos 8


Network Bridge is a link layer device based on mac address that foreword traffic between networks. In Linux, software bridge uses to emulate a hardware bridge that can be used in the virtual applications with one or more virtual application virtual nic. For example, if we are installing KVM we have to create bridge for the internal network. This can not be used in the wi-fi network due to the IEEE 802.11 standard of wi-fi.

There are three methods to create a bridge in RHEL 8. 

1 – Using Command-line nmcli 
2 – Edit eth file and create bridge file using the command line 
3 – Using graphical nmtui 
In this article, we will see how to create a bridge in the existing setup which is already in use. In our setup static IP is assigned to ens192 and we have to create a bridge br0. We will use nmtui and vi editor to create bridge.

Steps To Create Network Bridge 

Step 1 – Check the existing network and mac address 

Check existing network and mac address to avoid mistakes and take backup in case we have to revert back.
# ip a 
ip a
Above pic, you can see one ethernet port ens192 with static ip. save this ip and mac address. The Mac address is not mandatory.

Step 2 – Open Network Manager TUI 

# nmtui
This command will open TUI for the network manager. Here you can edit and create new connections.
nmtui
Here go to “Edit a connection” to add or change the setting of the ethernet port.

Step 3 – Create Bridge and Assign Slave Ethernet Port 

In this step, we will create a bridge with ens192 port slave.
first, perform step 2 you will see pic below :
edit connection
Click on “Add” to add a new connection. Scroll down to Bridge and press tab to move on create.
scroll down to bridge
Press enter on create. Now you will see below options on the screen. Where you need to give a name to bridge and assign IP as per your requirement or you can leave default names.
edit profile
In the above pic, change the highlighted area and click on add to add a physical nic port that will carry bridge network.
add slave
In the above pic, you can see options. Select Ethernet and press tab to jump on create and press enter to move on the next step.
In the below pic, enter the ethernet port name and mac address. Mac address is not mandatory you can leave it also.
Change profile and mac address
Click ok to save the setting.
Now in the next step assign  Ip on the bridge. Make sure to assign the same series IP which your network provider to network team provides you to avoid any network loss. IN our case we will assign the same IP which was assigned to ens192 because it was tested and working.
For that go to IPv4 Configuration and click and select manual.
Add IP manually
Click on “Show” to assign IP 
Add IP
Enter IP in the format of 192.168.11.123/24 gateway 192.168.11.1. 
After that click ok to save the configuration.
Add IP
In the below pic you can see Bridge is created name br0 and now move to ok and press enter 
Bridge is created
Now all bridge configuration has been done use down arrow ket to move to quit and press enter to exit nmtui.
quit nmtui
Now you have created bridge with slave ens192. But now we have to tell ens192 that his master is br0.

Step 4 – Edit Ethernet File For Bridge Communication 

Now we have to edit the ethernet configuration file in my case it is ens192. In your case, it could be eth0, eth1 or ens0, etc. 
use below command to edit :
# vi /etc/sysconfig/network-scripts/ifcfg-ens192
Make the same entry as shown in below 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=ens192
UUID=ceb12aa6-afa5-4365-946b-4b573fe0c43e
DEVICE=ens192
ONBOOT=yes
MASTER=br0
Save configuration. Press esc then:wq!  press enter 
Now restart Network Manager by below command 
# systemctl status NetworkManager

Step 5 – Confirm bridge is configured correctly 

Check this via below command 
# ip a
bridge configured

Now here you can check two-point to verify the bridge is configured correctly.

  1. The IP address will show only on the bridge, not on the ens192 port.
  2. Mac Address will be the same as the bridge and our ethernet port which was the slave of the bridge.
At this point, you have successfully configured the bridge. Now you can use it in any KVM machine or application which required a bridge network.
If this article helps you share it because sharing will motivate us .
]]>
https://www.explinux.com/2020/07/how-to-create-network-bridge-in-rhel-8-centos-8.html/feed 0
How to Check and Disable Selinux in Centos7/8, RHEL 7/8 https://www.explinux.com/2020/06/how-to-check-and-disable-selinux-in-centos7-8-rhel-7-8.html https://www.explinux.com/2020/06/how-to-check-and-disable-selinux-in-centos7-8-rhel-7-8.html#comments Tue, 30 Jun 2020 03:00:00 +0000 https://explinux.online/2020/06/30/how-to-check-and-disable-selinux-in-centos7-8-rhel-7-8/ How to Check and Disable Selinux in Centos7/8, RHEL 7/8 Read More »

]]>
How to Check and Disable Selinux  in Centos7/8, RHEL 7/8

How to check and disable Selinux  in Centos7/8, RHEL 7/8

SELinux – Security-Enhanced Linux

It is a security architecture that gives you more control over the system that others can access. It was integrated into Linux in 2003. SELinux is enabled by default and you can check SELinux status with the command sestaus. SELinux usage on AVC – access vector cache. You can configure SELinux for any subject or object.
Here in this article, we will talk about how to disable SELinux. As recommended do not disable it in the public domain if you do not have a firewall at the network level.
There are three modes of SELinux :
#     enforcing stand for – SELinux security policy is enforced.
#     permissive stands for –  SELinux prints warnings instead of enforcing.
#     disabled stand for – No SELinux policy is loaded.
Related Article:

How To Disable SELinux

Step 1- Check the Status with the below command

#  sestatus
sestatus
Now you can see in the above pic SELinux is in enforcing status. This means SELinux is active.

Step 2- Disable SELinux from the below command and check the status

# setenforce 0
setenforce 0
This will disable SELinux temporarily. For permanent you need to do an entry in the configuration file.

Step 3-  Make changes in the configuration file for permanent SELinux disable

There are two configuration files that we have to change to disable or permissive as per our requirement.

File -1 – Change by the below command

# vi /etc/sysconfig/selinux
/etc/selinux/config
Change permissive to disabled on SELINUX= *. This will disable SELinux permanently.

File -2 – Change by the below command

# vi /etc/selinux/config
/etc/selinux/config
Do the same as done in file -1. Save both files by (pressing the esc key):wq! Press enter.

4- Check now it will show disables in the config file.

# sestatus
SELinux disabled
Now at this point, you have successfully disabled SELinux and now you can check your services that are impacted by SELinux policy. Thanks, you can share this with your colleagues and request new articles in the comment section.
]]>
https://www.explinux.com/2020/06/how-to-check-and-disable-selinux-in-centos7-8-rhel-7-8.html/feed 1
How to Use and Enable/Disable Firewall in Centos7/8, RHEL 7/8 https://www.explinux.com/2020/06/how-to-check-and-disable-firewall-in-centos7-8-rhel-7-8.html https://www.explinux.com/2020/06/how-to-check-and-disable-firewall-in-centos7-8-rhel-7-8.html#respond Sun, 28 Jun 2020 03:00:00 +0000 https://explinux.online/2020/06/28/how-to-check-and-disable-firewall-in-centos7-8-rhel-7-8/ How to Use and Enable/Disable Firewall in Centos7/8, RHEL 7/8 Read More »

]]>
How to Disable firewall in Linux

How to Check and Disable Firewall  in Centos7/8, RHEL 7/8

As we know the firewall is very important for our system or server security. In some cases where you have an external firewall in your network or you are using a different firewall, you need to disable the firewall. Few sysadmins disable the firewall for any application too but we recommend that for a case of application configure the firewall, do not disable it.
In this article, we will see how to check and disable the firewall in Linux.

Disable Firewall :

Step -1 Check firewall status with the below command

 

#  systemctl status firewalld
systemctl status firewalld
This will show the current status of the firewall. Now it is on active showing.

Step -2 Disable the firewall with below command

#  systemctl stop firewalld
This command stops the firewall temporarily but if you reboot or reload it will be active again.

Step – 3 Permanent disable it with the below command

#  systemctl disable firewalld
systemctl disable firewalld
This will disable the firewall permanently. After this, you can manually start firewall.

Step -4 Check firewall status with the below command

#  systemctl status firewalld
systemctl status firewalld dead
Now you have successfully disabled the firewall of your Linux machine.
In case you want to Enable Firewall again. Follow the below procedure :

Enable Firewall

Step -1 Start firewall with below command

#  systemctl start firewalld
This will start firewall temporarily if it is disabled using disable command

Step -2 Enable the firewall permanently with the below command

 #  systemctl enable  firewalld
This will enable the firewall permanently.

Add a Port or Service  in the Firewall

 

# firewall-cmd --zone=public --add-port=8080/tcp --permanent
# firewall-cmd --zone=public --add-service=tomcat --permanent
# firewall-cmd --reload
This will add ports and services to firewall
At this point, you know how to disable and enable the firewall on RHEL 7/8  and Centos 7/8. Share this if it is helpful.
]]>
https://www.explinux.com/2020/06/how-to-check-and-disable-firewall-in-centos7-8-rhel-7-8.html/feed 0
How to configure yum / dnf repo in RHEL 8 server with screenshots and Bonus Tip https://www.explinux.com/2020/05/how-to-configure-yum-dnf-repo-in-rhel-8-server-with-screenshots.html https://www.explinux.com/2020/05/how-to-configure-yum-dnf-repo-in-rhel-8-server-with-screenshots.html#respond Wed, 13 May 2020 09:04:00 +0000 https://explinux.online/2020/05/13/how-to-configure-yum-dnf-repo-in-rhel-8-server-with-screenshots/ How to configure yum / dnf repo in RHEL 8 server with screenshots and Bonus Tip Read More »

]]>
 
DNF or YUM configuration
 
 

In this article, you how to configure yum or dnf in RHEL 8. There are two repositories that have been added one for AppStream and the second is BaseOS. In RHEL 8 both app and base os repositories have been separated from each other.
In RHEL 8 default package manager is dnf and it is symlink with yum.
We will configure yum from the local iso but the procedure is the same from the FTP server too only need to change the baseurl path.

What is yum or dnf

If we want to install any package in Linux we can simply install it with the rpm command. But what will happen if the rpm package has dependencies and dependencies also have a dependency. This means for one package installation we have to install 5 other packages and those 5 packages have other 10 packages. If we use yum or dnf dependency part has been handled by these package managers. We have to just confirm that we want to install dependency with the required package.

Till RHEL 7 yum is the main package manager and in RHEL 8 REDHAT had introduced dnf as a package manager.

Difference Between YUM and DNF

There is some basic difference between yum and dnf.

  • yum is written in only python while dnf in c,c++, and python
  • dnf consume less memory than yum.
  • If any repo is not available yum stop working but dnf skip that repo which is not available
  • The main difference in RHEL 8 dnf or yum is they have separated BaseOS and APPStream which was in the same repo in RHEL 7.
  • If you are a coder the dnf has half code of lines than yum.

These are some basic differences between yum and dnf. There are many more differences but this is a different topic.

How to configure yum(Yellow Dog Update Modifier) or dnf(Dandified Yum) in RHEL 8

1.Mount RHEL 8 DVD or iso to OS

Mount DVD by DVD reader.If you are using ESXi mount from local datastore in settings and In hypervisor mount from local drive.

2. Check mounted devices

  # lsblk

check%2Bmounted%2Biso dnf
           here it is sr0

 

In your case it may be different, you can verify with a new device added or with the size of the disk.
 
     3. Mount iso to /mnt or any other directory. We have mounted here on /mnt
        # mount -o loop /dev/sr0 /mnt
 
 
mount%2B o%2Bloop dnf
As you can see it is mounted on /mnt and this is read-only mode mounted.
 
 
   4. Create a rhel8.repo file in yum directory
       # vi /etc/yum.repos.d/rhel8.repo
 
Make sure there is no entry in this file. If you have any other entry then you can create any new girl with .repo extension.
 
  5. Make below entry in file make sure do add space or special charector in bracket:
 
[AppStream]
name=Appstream
baseurl=file:///mnt/AppStream/
enable=1
gpgcheck=0
 
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS/
enable=1
gpgcheck=0
 
6. Press esc, type-   :wq! enter  to save file
RHEL8.repo dnf
 
 
7. You can replace ftp server link also on baseurl = http://siteaddrss/AppStream . If you are using FTP server.
 
8. Check it is correctly configured or not from the below command.
# yum repolist
#dnf repolist
 
yum%2Brepolist dnf
 
Now you have configured yum and you can start to install packages from yum/dnf.

Bonus Tip :

First Tip:

If you are working in a test environment and dnf is configured more than once or any other issue cause error in repolist or packaged installation. 

Run below command :

# rm -r /var/cache/dnf 

This will remove old cache and then run repolist and install packages. 

Second Tip:

Besides using a mounted DVD you can create a directory for yum or dnf and copy /mnt files to the created folder. This will reduce the risk of DVD unmount or corruption. If all packaged are at local installation will be faster.

Do not confuse if we are using repository in local then why not installed all packaged in OS installation time. For new users keep packaged local, only take your HDD space but install all package will consume CPU and RAM which reduce system or server performance.

 

 
]]>
https://www.explinux.com/2020/05/how-to-configure-yum-dnf-repo-in-rhel-8-server-with-screenshots.html/feed 0