cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:command:rpm.html



Linux Command#Software

How to use RPM Command in RHEL/CentOS

Help

# rpm --help

Help options:
  -?, --help                       Show this help message

Query options (with -q or --query):
  -l, --list                       list files in package

Install/Upgrade/Erase options:
  -i, --install                    install package(s)
  -e, --erase=<package>+           erase (uninstall) package
  -h, --hash                       print hash marks as package installs (good with -v)
  --test                           don't install, but tell if it would work or not
  -U, --upgrade=<packagefile>+     upgrade package(s)

Common options for all rpm modes and executables:
  -v, --verbose                    provide more detailed output


Command Lists

Command Objective Note
rpm --help Help
rpm -ivh PACKAGE.rpm
rpm -ivh --test PACKAGE.rpm
Install
rpm -Uvh PACAGE.rpm
rpm --test -Uvh xxxx.rpm
Upgrade
rpm -e PACAGE.rpm
rpm -e --nodeps PACAGE.rpm
Uninstall


Check RPM Package before installing

Command Objective Note
rpm -qip PACKAGE.rpm Check the Package informations
rpm -qlp PACKAGE.rpm Check installed files
rpm -qRp PACKAGE.rpm Check the dependenced files


Check RPM Package after installing

Command Objective Note
rpm -q APPLICATION Check the Package name rpm -q bind
rpm -qa
rpm -qa --last |head -10
rpm -qa --qf '%{name}\n' |sort
Check instelled all packages rpm -qa |grep bind
rpm -qi PACKAGE Check PACKAGE's detail information rpm -qi bind
rpm -qi httpd
rpm -ql PACKAGE Check instelled files after install with PACAGE rpm -ql bind
rpm -ql httpd
rpm -qf FILE Check package related to FILE rpm -qf /etc/rndc.conf
rpm -qR PACKAGE Check dependenced files with PACAGE rpm -qR bind
rpm -qR httpd
rpm -q -scripts PACKAGE Check install script files.
Check User's UID, GID
rpm -q -scripts bind
rpm -q -scripts httpd
rpm -q --changelog PACKAGE Check the chenge note rpm -q --changelog httpd
rpm -q --changelog httpd
$ rpm -q --changelog httpd
* Thu Oct 19 2017 CentOS Sources <bugs@centos.org> - 2.4.6-67.el7.centos.6
- Remove index.html, add centos-noindex.tar.gz
- change vstring
- change symlink for poweredby.png
- update welcome.conf with proper aliases

* Tue Oct 03 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-67.6
- Resolves: #1498020 - rotatelogs: creation of zombie processes when -p is used

* Tue Sep 19 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-67.5
- Resolves: #1493064 - CVE-2017-9798 httpd: Use-after-free by limiting
  unregistered HTTP method

* Wed Jul 26 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-67.2
- Resolves: #1463194 - CVE-2017-3167 httpd: ap_get_basic_auth_pw()
  authentication bypass
- Resolves: #1463197 - CVE-2017-3169 httpd: mod_ssl NULL pointer dereference
- Resolves: #1463207 - CVE-2017-7679 httpd: mod_mime buffer overread
- Resolves: #1463205 - CVE-2017-7668 httpd: ap_find_token() buffer overread
- Resolves: #1470748 - CVE-2017-9788 httpd: Uninitialized memory reflection
  in mod_auth_digest

* Tue May 09 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-67
- Related: #1332242 - Explicitly disallow the '#' character in allow,deny
  directives

* Tue May 09 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-66
- Related: #1332242 - Explicitly disallow the '#' character in allow,deny
  directives

* Thu Apr 27 2017 Lubo? Uhliarik <luhliari@redhat.com> - 2.4.6-65
- Resolves: #1445885 - define _RH_HAS_HTTPPROTOCOLOPTIONS
...
...


man rpm

NAME
       rpm - RPM Package Manager

SYNOPSIS
   QUERYING AND VERIFYING PACKAGES:
       rpm {-q|--query} [select-options] [query-options]

   INSTALLING, UPGRADING, AND REMOVING PACKAGES:
       rpm {-i|--install} [install-options] PACKAGE_FILE ...

       rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

       rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

       rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts]



   INSTALL AND UPGRADE OPTIONS

       --test Don't  really  uninstall anything, just go through the motions.  Useful in conjunction with the -vv option for debug-ging.


   PACKAGE QUERY OPTIONS:
       -a, --all
              Query all installed packages.

       -f, --file FILE
              Query package owning FILE.

       -i, --info
              Display package information, including name, version, and description.  This uses the --queryformat if one was speci-
              fied.

       -R, --requires
              List packages on which this package depends.




Example

Check RPM Package before installing

rpm -qlp

$ rpm -qlp nginx-1.12.2-1.el7_4.ngx.x86_64.rpm
warning: nginx-1.12.2-1.el7_4.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
/etc/logrotate.d/nginx
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/modules
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/usr/lib64/nginx
/usr/lib64/nginx/modules
/usr/libexec/initscripts/legacy-actions/nginx
/usr/libexec/initscripts/legacy-actions/nginx/check-reload
/usr/libexec/initscripts/legacy-actions/nginx/upgrade
/usr/sbin/nginx
/usr/sbin/nginx-debug
/usr/share/doc/nginx-1.12.2
/usr/share/doc/nginx-1.12.2/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/var/cache/nginx
/var/log/nginx


Check RPM Package after installing

rpm -q

# rpm -qi libstdc++-4.1.2-51.el5
Name        : libstdc++                    Relocations: (not relocatable)
Version     : 4.1.2                             Vendor: CentOS
Release     : 51.el5                        Build Date: Fri Jul 22 09:08:01 2011
Install Date: Wed Apr 23 12:30:08 2014         Build Host: builder10.centos.org
Group       : System Environment/Libraries   Source RPM: gcc-4.1.2-51.el5.src.rpm
Size        : 973680                           License: GPL
Signature   : DSA/SHA1, Fri Aug 12 21:26:44 2011, Key ID a8a447dce8562897
URL         : http://gcc.gnu.org
Summary     : GNU Standard C++ Library
Description :
The libstdc++ package contains a rewritten standard compliant GCC Standard C++ Library.
# rpm -ql libstdc++-4.1.2-51.el5
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.8
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.8
# rpm -qR libstdc++-4.1.2-51.el5
/sbin/ldconfig
/sbin/ldconfig
ld-linux-x86-64.so.2()(64bit)
ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.2)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libgcc_s.so.1()(64bit)
libgcc_s.so.1(GCC_3.0)(64bit)
libgcc_s.so.1(GCC_3.3)(64bit)
libgcc_s.so.1(GCC_4.2.0)(64bit)
libm.so.6()(64bit)
(abbr)


TIPS

ls *.rpm | xargs ls -lh
ls *.rpm | xargs rpm -ivh

find . -name "*.rpm"  | xargs ls -lh
find . -name "*.rpm"  | xargs rpm -ivh







os/linux/command/rpm.html.txt ยท Last modified: 2021/03/28 by admin

Page Tools