Document contain most frequently used command and troubleshooting.
Yum will install all the dependencies for rpm.
$ rpm -i package.rpm
or
$ yum install package
Yum will upgrade the dependencies based on dependency of package.
$ rpm -U packagename.rpm
or
$ yum upgrade packagename
We need old version rpm to downgrade. if we are downgrade using yum then it will pickup rpm from repo.
$ rpm -U --oldpackage packagename-old-version.rpm
or
$ yum downgrade package
rpm command will not remove if it is required for another package. Yum will remove package allog with dependencies.
$ rpm -e packagename
or
$ yum earse packagename
-qa option list all installed packages. command will give you only the name of rpm installed. To get details about the rpm we have to use the --queryformat option. query format contained the tags. we will get the list of tags using rpm --querytags command. if we wanto query rpm file then use -p option.
- Query Expression: %|TAGNAME?{present}:{missing}|
### Get list of installed package
$ rpm -qa
### Get list of installed package with pattern e.g for "shad*"
$ rpm -qa "sha*"
shadow-utils-4.1.4.2-19.el6_6.1.x86_64
shared-mime-info-0.70-6.el6.x86_64
Get Details using --queryformat Following command will give you version size of rpm. we can use diffrent tag in below command e.g.
$ rpm -qa "sha*" --queryformat "[%{NAME} %{SIZE} %{VERSION}\n]"
shadow-utils 2777820 4.1.4.2
shared-mime-info 1411396 0.70
Option: -ql or --queryformat
$ rpm -ql packagename
## list file in rpm file.
$ rpm -qpl /path-to/package.rpm
#### or
$ rpm -qa packagename --queryformat "[%{=NAME} %{FILENAMES}\n] "
Option: -qf
$ rpm -qf <file>
### e.g.
$ rpm -qf /bin/ls
coreutils-8.4-37.el6.x86_64
Options: -qi , -p for rpm file.
$ rpm -qi packagename
### for rpm file
$ rpm -qpi /path-to/package.rpm
Option: -q --scripts , -p for rpm file
$ rpm -q --scripts packagename
#### for rpm file
$ rpm -qp --scripts /path-to/package.rpm
Option: -q --changelog , -p for rpm file
$ rpm -q --changelog packagename
#### for rpm file
$ rpm -qp --changelog /path-to/package.rpm
Option: -qR , -p for rpm file
$ rpm -qR packagename
#### for rpm file
$ rpm -qpR /path-to/package.rpm
Option: -q --provides , -p for rpm file
$ rpm -q --provides packagename
#### for rpm file
$ rpm -qp --provides /path-to/package.rpm
Command will extract the content of the rpm in current dir.
rpm2cpio package.rpm | cpio -idmv