rpm command is good for more than just installing and upgrading software packages. Many times, you will need to remove packages as well.
-e option to the rpm command, short for erase. The basic syntax follows:
rpm -e package_nameUse Package Names, Not File Names
rpm -e jikes-1.16-1jikes-1.16-1 package used in previous examples.
root Access is Required
root account, or super user, to remove most packages. This is because the package files themselves are protected. In addition, the RPM database is protected.
rpm command first checks that no other packages depend on the package you intend to remove. This is very important, since you otherwise can damage your Linux system by inadvertently removing packages needed by the rest of the system.
rpm command supports the --test option for removing packages as well as when installing. As with installing, the --test option tells the rpm command to test to see whether it can remove the given package but not to force the removal.
syslinux-1.75-3 package, you can use the --test option to see if this works.
rpm -e --test syslinux-1.75-3
error: Failed dependencies: syslinux is needed by (installed) mkbootdisk-1.4.8-1Alternative Option Name
--erase, in place of –e.
rpm –q command to query whether a package is installed. After running the rpm –e command, you can run the rpm –q command to check whether the package has been removed. If the rpm –q command shows that the package is not installed, that tells you the erase operation has worked.
# rpm -q jikes
jikes-1.16-1
# rpm -e jikes-1.16-1 # rpm -q jikes
package jikes is not installed