The RPM package information stored in the below location
/var/lib/rpm
[root@hostrpm]# ls
Basenames __db.000 __db.002 Dirnames Group Name Providename Pubkeys Requireversion Sigmd5
Conflictname __db.001 __db.003 Filemd5s Installtid Packages Provideversion Requirename Sha1header Triggername
The RPM database is used to keep track of all files that are changed and created when a user installs a package. If the database gets corrupted, the index databases can be recreated with the rpm --rebuilddb command.
If you issues the rpm- qa ( query ) command then, it will read from the DB and list out the package names.
If you delete the installation directory directly, it won’t delete the record from the RPM DB. For that you need to execute the rpm –ivh (uninstall ) command , otherwise you can’t install the same package.