To eliminate packages in Linux we could do them in several ways: through the YUM or RPM command, we will see how to uninstall packages with dependencies, we will see what each of them means, their functions and how we could use them:
What is YUM command?
YUM is a free and open source command line package management utility for computers running the Linux operating system using the RPM Package Manager. Although YUM has a command line interface, several other tools provide graphical user interfaces for YUM functionality.
YUM allows automatic updates and management of packages and dependencies in distributions based on RPM. Like the Debian Advanced Package Tool (APT), YUM works with software repositories (package collections), which can be accessed locally or via a network connection.
YUM depends on RPM, it is a packaging standard for the digital distribution of software that automatically uses hashes and digisigs to verify the authorship and integrity of such software unlike some application stores that fulfill a similar function neither YUM nor RPM provide integrated support for ownership restrictions on copying of packages by end users. YUM is implemented as libraries in the Python programming language, with a small set of programs that provide a command line interface. There are also GUI based wrappers such as YUM Extender (yumex).
A rewriting of YUM called DNF replaced YUM as the default package manager in Fedora 22. DNF was created to improve YUM in several ways: better performance, better resolution of dependency conflicts and easier integration with other software applications.
1. To remove a Linux package, it is necessary to initiate a session with the privileges of the root user, we could do it through the PuTTY application and the IP address, we start section with the root user and password.
2. We check the installed version of the package that we wish to uninstall with the following rpm -qa | grep (package name) command:
#rpm -qa|grep curl
We could also use: yum info (package name)
#yum info curl
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirror.ehv.weppel.nl
* epel: mirrors.ukfast.co.uk
* extras: mirror.serverius.net
* remi-php56: mirrors.ukfast.co.uk
* remi-php70: mirrors.ukfast.co.uk
* remi-php71: mirrors.ukfast.co.uk
* remi-php72: mirrors.ukfast.co.uk
* remi-safe: mirrors.ukfast.co.uk
* updates: mirror.ehv.weppel.nl
Name : curl
Arch : x86_64
Version : 7.29.0
Release : 54.el7
Size : 528 k
Repo : installed
From repo : base
Summary : A utility for getting files from remote servers (FTP, HTTP, and
URL : http://curl.haxx.se/
Licence : MIT
Description : curl is a command line tool for transferring data with URL syntax,
: supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT,
: LDAP, LDAPS, FILE, IMAP, SMTP, POP3 and RTSP. curl supports SSL
: certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based
: upload, proxies, cookies, user+password authentication (Basic,
: Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy
: tunneling and a busload of other useful tricks.
We already know the version of the package now we can uninstall it with the following command:
yum rease [nombre de paquete]
We could also use the (remove) command:
yum remove [nombre_paquete]
How to remove packages with dependencies using Yum
Package dependencies are binary libraries and modules on which the software is based. When you install the software, you will automatically download and store the required dependencies.
In most cases, removing the software from the local package manager will also erase its dependencies (unless other programs require it). Even so there are cases in which these dependencies must be removed manually.
To remove a package and delete all unnecessary dependencies we execute the following command:
yum autoremove [nombre_paquete]
Alternatively, we could edit the yum configuration file to automatically remove package dependencies when removing a package with the yum remove or yum erase commands.
so it is necessary to edit the configuration file /etc/yum.conf with the text editor of your choice:
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
We add the following directive to the configuration file of the yum command:
clean_requirements_on_remove = 1
What is the RPM command?
RPM Package Manager (RPM) (Red Hat Package Manager) is a free and open source package management system. The name RPM refers to the .rpm file format and the package manager program. RPM was primarily intended for Linux distributions The file format is the Linux Standard baseline package format.
Although it was created for use in Red Hat Linux, RPM is now used in many Linux distributions. It has also been ported to other operating systems such as Novell NetWare (as of version 6.5 SP3), IBM AIX (as of version 4), CentOS, Fedora (from the Fedora Project, also sponsored by Red Hat) and Oracle Linux All versions or variants of these Linux operating systems use the RPM Package Manager.
An RPM package can contain an arbitrary set of files. Most RPM files are "binary RPM / BRPM" that contain the compiled version of some software. There are also "source RPM" (or SRPM) that contain the source code used to build a binary package. These have an appropriate label in the header of the file that distinguishes them from normal RPM (B), which causes / usr / src to be extracted in the installation. SRPMs usually carry the file extension ".src.rpm" .spm on file systems limited to 3 characters in length.
Uninstall a package with RPM
We can use the rpm command to remove the packages in our system. When we delete an RPM package it does not affect the directories or files of our system, but it can affect any other application that is using the RPM package that we intend to delete. It is very important to make a backup before removing any package from our system.
First we execute the following command to obtain the version installed in our system of the package that we are interested in uninstalling.
rpm -qa|grep nombre_paquete
#rpm -qa|grep curl
Include the -e option in the rpm command to remove the installed packages the syntax of the command is:
rpm -e nombre_paquete
rpm -e curl-7.29.0-54.el7.x86_64
Note: RPM will not remove a package required by another package or with dependency.