How to FIND, REMOVE and INSTALL A PACKAGE in RHEL8
Tags: linux, redhat, software, package
Published: 2023-05-01 19:05:00

95% of the commands we use in any OS are created by the software's/Packages. For Example, if we talk about Red Hat Linux Operating System: below we can see **_`which date`_** **_`which cal `_**
![date command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaslr4h5nup5r3koqt1x.png)Here we run **_`rpm -q -f /usr/bin/date`_**
In simple words the command means red hat package management i have a query who created this file **_`/usr/bin/date`_**
and in return it will provide you with a software name.![rpm query command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cayyauyx5omfu6ncnf9.png)So let's start our demo by 1st finding Firefox package, let's run and check if it exists or not.![check package exist or not ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3aryzlzl8gmx73pmj5o1.png)Now,
1. Find Firefox package **_`rpm -q firefox `_**![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z2lvephhjrmdapeiz9t.png)
2. Remove the package using **_`rpm -e firefox `_**![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5fy6s9a4sa1ga7jbs0w.png)
check if firefox is installed ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo50wkm2nmch4cra1ei4.png)
3. try to install  firefox **_`rpm -i firefox `_** ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1mm5ejigvhtz2xoh9mrv.png)
OOPS! WE ENCOUNTER AN ERROR No such file this means we cannot install Firefox like this. When we downloaded RHEL8 we had one DVD or iso file downloaded with us which is basically a bootable image. We will use this image as it already has 5k+ software in it. 
So, **_add the image in the optical drive_**. for that 1st soft shut down the system using **_`init 0`_**. ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2b9lksgya47ex7px9wm.png)
now go to **_`Settings ->Storage->Add Optical drive -->Add the pre installed iso image `_**as shown below ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvwbpl2ke7rklccwqkym.png)![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efvehmgs6ffqx1t5uy08.png)
After Inserting DVD, you will face 2 options regarding reinstalling the OS. but as you already have OS installed so to avoid this go to **_Settings ->System ->Boot Order_**  and change it to hard drive and then optical drive. So, from now onwards if according to boot order if OS already exist in Hard Disk no option to reinstall will be shown and if OS do not exist in Hard Disk, then only install from DVD option will be shown. 
Now you can find DVD in GUI after going to _**Activities**_. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa38z8wojfsfene1dsu5.png)
 All the Packages are stored in AppStream and BaseOs . 
NOTE: they all have extension as **_.rpm _**
Right click in white space: click on **_`open in Terminal`_** option you will be landed directly in DVD folder. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xayrp38qdrwzv7ip1dk1.png)
Now our plan is to **_install Firefox_**. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8thovzub02b72umods1d.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6b0ijqyvtspitx6vhpjn.png)
lets install Firefox using **_`rpm -i firefox...`_**(click TAB to get the full name at your terminal ) 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhxivkjjr4ymb6mx1qr4.png)
let's **_check if software is installed_** using **_`rpm -q firefox`_**.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2eeuvg64voyo758cmgr.png)
_Thank You._