In many ways, yum is simply a front end to a lower-level package management tool called rpm, similar to apt-get’s relationship with dpkg. One key distinction to understand between the two utilities is that rpm does not perform dependency resolution.
The following commands should be run as root. The flags are expanded here in the pursuit of clarity, but the more conventional terse syntax is also included.
Command | Description |
---|---|
rpm --install --verbose --hash [local-rpm-file-name].rpm rpm -ivh [filename].rpm |
Install an rpm from the file. rpm is also capable of installing RPM files from http and ftp sources as well as local files. |
rpm --erase [package-name] rpm -e |
Remove the given package. Usually will not complete if [package-name] matches more than one package, but will remove more than one match if used with the --allmatches flag. |
rpm --query --all rpm -qa |
Lists the name of all packages currently installed. |
rpm --query [package-name] rpm -q |
Confirm or deny if a given package is installed in your system. |
rpm --query --info rpm -qi |
Display the information about an installed package. |
rpm --query --list [package-name] rpm -ql |
Generate a list of files installed by a given package. |
rpm --query --file rpm -q qf [file-name] |
Check to see what installed package "owns" a given file. |
Example Installing Software Agent using RPM (Puppet)
root@n9k-sw-1# rpm -qa | grep puppet
root@n9k-sw-1# rpm -ivh /bootflash/puppet-enterprise-3.7.1.rc2.6.g6cdc186-1.pe.nxos.x86_64.rpm
Preparing... ########################################### [100%]
1:puppet-enterprise ########################################### [100%]
root@n9k-sw-1# rpm -qa | grep puppet
puppet-enterprise-3.7.1.rc2.6.g6cdc186-1.pe.nxos.x86_64
Example Removing Software Agent using RPM (Puppet)
root@n9k-sw-1# rpm -qa | grep puppet
puppet-enterprise-3.7.1.rc2.6.g6cdc186-1.pe.nxos.x86_64
root@n9k-sw-1# rpm -e puppet-enterprise-3.7.1.rc2.6.g6cdc186-1.pe.nxos.x86_64
root@n9k-sw-1# rpm -qa | grep puppet
root@n9k-sw-1#