HostOnNet Blog

rpm – Package Manager for RedHat Linux

rpm manage software packages in distros like Fedora, RedHat, CentOS.

To list all installed software packages, run

rpm -qa

To see if a package is installed, run

rpm -qa | grep PACKAGE_NAME

Example

root@server2 [~]# rpm -qa | grep exim
exim-4.89-3.cp1162.x86_64
root@server2 [~]# 

List all Files in a package

rpm -q --filesbypkg PKG_NAME

Example

root@server2 [~]# rpm -q --filesbypkg exim
exim                      /etc/antivirus.exim
exim                      /etc/exim.conf.dist
exim                      /etc/exim.conf.mailman2.dist
exim                      /etc/exim.conf.mailman2.exiscan.dist
exim                      /etc/exim.pl
exim                      /etc/eximrejects
exim                      /etc/init.d/exim
exim                      /etc/localaliases
exim                      /etc/localdomains
exim                      /etc/logrotate.d/exim
exim                      /etc/pam.d/exim
exim                      /etc/secondarymx
exim                      /etc/spammers
exim                      /etc/valiases
exim                      /etc/vfilters
exim                      /usr/lib/exim/bin/spf_example
exim                      /usr/lib/exim/bin/spfd
exim                      /usr/lib/exim/bin/spfquery
exim                      /usr/lib/exim/bin/spftest
exim                      /usr/lib/exim/bin/srs
exim                      /usr/lib/sendmail
exim                      /usr/local/cpanel/3rdparty/share/exim/NOTICE
exim                      /usr/local/cpanel/3rdparty/share/exim/copyright
exim                      /usr/sbin/exicyclog
exim                      /usr/sbin/exigrep
exim                      /usr/sbin/exim
exim                      /usr/sbin/exim_checkaccess
exim                      /usr/sbin/exim_dbmbuild
exim                      /usr/sbin/exim_dumpdb
exim                      /usr/sbin/exim_fixdb
exim                      /usr/sbin/exim_lock
exim                      /usr/sbin/exim_tidydb
exim                      /usr/sbin/eximstats
exim                      /usr/sbin/exinext
exim                      /usr/sbin/exiqgrep
exim                      /usr/sbin/exiqsumm
exim                      /usr/sbin/exiwhat
exim                      /usr/sbin/runq
exim                      /usr/sbin/sendmail
exim                      /usr/share/doc/exim-4.89
exim                      /usr/share/doc/exim-4.89/README
root@server2 [~]# 

Install an RPM file

rpm -ivh file.rpm

To uninstall a package

rpm -e PKG_NAME

If you just want to remove a package, but keep all dependency, run

rpm -e --nodeps PKG_NAME

Posted in CentOS