Q:

rpm -i says already installed, but rpm -e says not installed

I'm trying to test out an RPM I wrote for Jmeter on CentOS. I followed some guides online and when I do 'sudo rpm --install jmeter.i386.rpm' it says the package is already installed. However when I do 'sudo rpm --erase jmeter.i386.rpm' it says the package is not installed. How can I resolve this issue?

A:

By using rpm --erase correctly.
--install takes an RPM.
--erase takes a package name.
So rpm -Uvh jmeter.i386.rpm is paired with rpm -e jmeter or jmeter.i386.
As an aside, generally avoid using -i/--install in favor of -U/--upgrade as it has saner behavior in many cases (and will install a package that isn't already installed just fine). Alternatively, stop using rpm entirely and just start using yum instead yum install jmeter.i386.rpm. (Yes, install works for localinstall.)
yum takes RPMs or package names (that are in the configured repositories) for installation and takes package names for removal.

