If you want to forcefully remove any package without its dependencies then you are in the right place. In this article, I will show you how to force remove a package without dependencies using yum. Yellowdog Updater Modified (yum) is a reputed package manager generally used in Red-hat-based Linux distros like RHEL, Fedora, and CentOS. It has the potential to handle dependencies automatically. Hence, it is not recommended to forcibly remove any package without dependencies, it may create an unexpected broken system. However, if it is required, you can do it easily by just following this article carefully.
Process flow chart to force remove a package without dependencies using Yum:
[Distro Used Throughout the Tutorial: RHEL 9.2]
2 Easy Methods to Forcefully Remove a Package Without Dependencies Using Yum
While uninstalling any software package with yum, it removes the software package with all its unused dependencies which really great to some extent. However, if you want to keep those dependencies in your system, stick to this content to know the procedures in detail.
Method 01: Forcefully Removing a Package Without Dependencies Using Yum Command With the “–setopt” Flag
To remove packages without dependencies, you first need to disable the clean_requirements_on_remove option. In this case, you can use the ‘–setopt’ command with yum. Also, you can use the latest version of yum (dnf) to get a better performance. Here, I will describe two cases to do it.
Case 01: Force Remove a Package Without Dependencies Using Yum
In this case, the yum command is used to remove the Google Chrome package without dependencies. Follow the procedure step by step:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ Write this command to remove the package without dependencies:
sudo yum --setopt=clean_requirements_on_remove=0 remove google-chrome-stable
- sudo: Provides administrative privileges.
- yum: Manages packages in Red-hat-based Linux.
- –setopt=clean_requirements_on_remove=0: Sets the built-in command to disable the option clean_requirements_on_remove.
- remove: Removes software packages.
- google-chrome-stable: Package name.
After writing your Red-hat Linux password, type ‘y’ to complete the removal of Google Chrome without its dependencies.
Finally, you are done with your uninstallation procedure.
➌ Now you can check the dependency list by running this command:
sudo yum deplist google-chrome-stable
- deplist: Displays the dependencies of the requested packages.
In this picture, you can see that all the dependencies still exist after removing the software package.
Case 02: Force Remove a Package Without Dependencies Using Updated Yum (dnf)
dnf is the updated version of yum offering more benefits than yum. You can use it to get better results. Now, check the steps mentioned below to remove the package without dependencies:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ To remove the package without dependencies using dnf, write the following code:
sudo dnf --setopt=clean_requirements_on_remove=0 remove google-chrome-stable
- dnf: The latest version of yum that manages software packages in Red-hat-based Linux.
In this image, you can notice the removal of the Google Chrome package without its dependencies. Type ‘y’ there as shown in the picture to complete this procedure.
➌ After that, you can run this command to check all the dependencies of the package using dnf:
sudo dnf deplist google-chrome-stable
- deplist: Shows the dependencies of the requested packages.
Now, you can check all the unused as well as necessary dependencies are still here.
Method 02: Forcefully Removing a Package Without Dependencies Using Yum Command With the “–noautoremove” Flag
yum autoremove command basically removes all the unnecessary dependencies from the Linux system. In the same way, the noautoremove option just does the opposite task. In this section, I will explain two cases of removing a package without dependencies.
Case 01: Force Remove a Package Without Dependencies Using Yum
Yum is the popular package manager used to install, remove, or manage packages in Red-hat Linux. Adding the noautoremove option with yum will allow you to remove any packages without their dependencies. To know how to do that, follow the procedure step by step:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ Run the next command to remove the Google Chrome package without dependencies:
sudo yum remove google-chrome-stable --noautoremove
- –noautoremove: Command option used to remove packages without dependencies.
The command will start removing the package as soon as you give your Red-hat password. Afterward, it will ask for your permission. In this case, if you still wish to remove the package, you can proceed by typing ‘y’.
Case 02: Force Remove a Package Without Dependencies Using Modern Yum (dnf)
With the same command option (noautoremove), you can utilize the latest version of yum (dnf) which has promising dependency-resolving capacity. Check every step carefully to complete your job successfully:
Steps to Follow >
➊ Open the Red-hat terminal.
➋ Write the command to remove the Google Chrome without dependencies using dnf package manager:
sudo dnf remove google-chrome-stable --noautoremove
- dnf: A powerful package manager and the next-generation version of yum.
After running the command, you will be asked to write your Red-hat password. Type that password to initiate the process. Afterward, a prompt will appear to take your final permission to complete this action. Write ‘y’ there and get your job done.
Comparative Analysis of Methods to Force Remove a Package Without Dependencies Using Yum
As I have covered two methods in this article, you may get confused about which one to use. To clear up your confusion, read the pros and cons of each method and choose whatever you prefer.
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
If you want to save disk space, you can opt for method 1 otherwise pick method 2 to ignore unwanted issues.
Conclusion
In this article, I have gone through two different methods to force remove packages without dependencies. Moreover, I have explained two cases under method 1 and method 2. Yum and dnf package managers are used here with two different options to remove the Google Chrome package without its dependencies. However, it is not appreciable to force remove any package. Still, if you need this follow this article and don’t forget to have a backup before proceeding.
People Also Ask
Related Articles
- How to Uninstall RPM in Linux [2 Simple Cases]
- How to Uninstall a YUM Package [2 User-Friendly Cases]
- How to Remove a Specific Version Using YUM [2 Easy Methods]
- How to Remove and Purge a Package Using apt-get [4 Methods]
- How to Remove Apt-key in Linux [3 Practical Methods]
- How to Remove Package and Dependencies Using dpkg [4 Cases]
<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics
FUNDAMENTALS A Complete Guide for Beginners