Introduction
If you are using CentOS, you may need to uninstall or remove packages from time to time. Uninstalling packages can help you free up disk space, remove unnecessary applications, and keep your system up to date. In this guide, we will show you how to uninstall or remove packages from CentOS. We will cover both the command line and graphical user interface (GUI) methods for uninstalling packages. We will also discuss how to remove packages that are no longer needed.
How to Uninstall or Remove Packages from CentOS
1. Use the yum command to remove a package:
sudo yum remove 2. Use the rpm command to remove a package: sudo rpm -e 3. Use the dnf command to remove a package: sudo dnf remove 4. Use the rpm command to remove a package and its dependencies: sudo rpm -e –nodeps Introduction Uncesscerary packages slow down system performance and take up storage space. If specific software isn’t being used, then it’s best to remove it, and doing so is easy. In this tutorial, learn how to remove packages and uninstall dependencies from CentOS 7. Prerequisites CentOS is an RHEL (Red Hat Enterprise Linux) distribution. Users rely on the RPM (Red-hat Package Manager) and YUM (The Yellowdog Updater, Modified) package manager. To remove a package from CentOS, use the following yum commands: OR In the following example, we deleted the Apache web server package, filed under the name httpd.x86_64, using the Before removing, the command prompt asks for the root (or sudo user) password, and confirmation that you want the software deleted. Type in y (for yes) and press Enter. If you have changed your mind, press n (for no) and then Enter. Finally, the output informs you that the process is complete and shows you which package has been deleted. Note: Only root users and users added to the sudousers group have permission to install and remove packages in CentOS. Package dependencies are binaries, libraries, and modules on which software rely on. When installing software, it will automatically download and store the required dependencies. In most cases, deleting software from the local package manager will also erase its dependencies (unless other programs require them). Still, there are instances in which these dependencies have to be removed manually. To remove a package and erase all the unneeded dependencies use the following command: Note: When a user installs a package, YUM downloads and stores it in /var/cache/yum. However, packages remain in cache even after they’ve been installed and removed. In time, the stored cache may take up too much disk space or cause issues due to corrupt metadata. To reclaim disk space, be sure to clean the YUM cache. Alternatively, you can alter the yum configuration file to automatically remove package dependencies when deleting a package with the Start by opening the yum.conf file with a text editor of your choice: Then, add the following line to the file: Save and exit the file. In case you need to delete a package but are unsure of its exact file name, you can use one of the following two commands: OR The output will list all installed packages with the specified phrase found in the file name. As you can see in the image below, httpd appears in the following packages (and dependencies): After you have the exact name of the package you want to erase, you can uninstall it from your CentOS system. For more options on listing packages on CentOS read our detailed tutorial. Conclusion After reading this tutorial, you should now know how to remove packages and dependencies to free up space taken up by redundant programs. You also know how quickly find specific packages or files you want to delete.
Uninstall Package from CentOS with Yum
yum remove [package_name]
yum erase [package_name]
yum
command.How to Remove Packages with Dependencies Using Yum
yum autoremove [package_name]
yum remove
or yum erase
commands.vi /etc/yum.conf
directive clean_requirements_on_remove=1
How to Find Specific File in CentOS
yum list- | grep [package_name]
rpm -qa | grep [package_name]