How to List installed packages on CentOS / RHEL / Fedora

0

The package is nothing but a software package, a collection of executables, libraries, manuals, etc., packaged in a single file. In Fedora, CentOS 5, RHEL 5 and above, Scientific Linux, Yellow Dog Linux, and Oracle Linux packages are formatted in a .rpm file.

This post is very simple yet useful for the system admin who is very new to CentOS / RHEL / Fedora system and their software package management.

List Installed packages on CentOS / RHEL / Fedora:

You can use the rpm command with -qa option to get the list of installed packages.

rpm -qa

Output:

gnutls-3.3.24-1.el7.x86_64
filesystem-3.2-21.el7.x86_64
fxload-2002_04_11-16.el7.x86_64
virt-what-1.13-8.el7.x86_64
nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64
json-c-0.11-4.el7_0.x86_64
linux-firmware-20160830-49.git7534e19.el7.noarch
.  .  .

Another way to get a list installed packages with its detailed information.

yum list installed
For Fedora 22 and above, you can also use dnf utility instead of yum.

Output:

Installed Packages
GeoIP.x86_64                                         1.5.0-11.el7                             @anaconda            
NetworkManager.x86_64                                1:1.4.0-20.el7_3                         @updates             
NetworkManager-libnm.x86_64                          1:1.4.0-20.el7_3                         @updates             
NetworkManager-team.x86_64                           1:1.4.0-20.el7_3                         @updates             
NetworkManager-tui.x86_64                            1:1.4.0-20.el7_3                         @updates             
NetworkManager-wifi.x86_64                           1:1.4.0-20.el7_3                         @updates             
acl.x86_64                                           2.2.51-12.el7                            @anaconda            
acpid.x86_64                                         2.0.19-6.el7                             @anaconda            
alsa-firmware.noarch                                 1.0.28-2.el7                             @anaconda            
alsa-lib.x86_64                                      1.1.1-1.el7                              @anaconda            
alsa-tools-firmware.x86_64                           1.1.0-1.el7                              @anaconda

List installed Packages with time on CentOS / RHEL / Fedora:

You can use the below command get the list of packages with its time of installation.

rpm -qa --last

Output:

net-tools-2.0-0.17.20131004git.el7.x86_64     Tue 25 Jul 2017 01:10:39 PM UTC
yum-cron-3.4.3-150.el7.centos.noarch          Wed 19 Jul 2017 10:16:08 PM UTC
xfsprogs-4.5.0-10.el7_3.x86_64                Wed 19 Jul 2017 10:15:48 PM UTC
nss-tools-3.28.4-1.2.el7_3.x86_64             Wed 19 Jul 2017 10:15:48 PM UTC
libpciaccess-0.13.4-3.el7_3.x86_64            Wed 19 Jul 2017 10:15:48 PM UTC
libnetfilter_conntrack-1.0.6-1.el7_3.x86_64   Wed 19 Jul 2017 10:15:48 PM UTC
epel-release-7-10.noarch                      Wed 19 Jul 2017 10:15:48 PM UTC
dmidecode-3.0-2.1.el7_3.x86_64                Wed 19 Jul 2017 10:15:48 PM UTC
libnl3-cli-3.2.28-3.el7_3.x86_64              Wed 19 Jul 2017 10:15:47 PM UTC
chrony-2.1.1-4.el7.centos.x86_64              Wed 19 Jul 2017 10:15:47 PM UTC

Search for installed packages on CentOS / RHEL / Fedora:

Use the below command to see whether the particular package is installed on your system or not.

rpm -qa | grep -i wget

Output:

wget-1.14-13.el7.x86_64

Alternate way,

yum list installed wget

Output:

Installed Packages
wget.x86_64                                            1.14-13.el7                                            @base

Get details of Installed Package on CentOS / RHEL / Fedora:

Use the below command to get detailed information about a particular package.

rpm -qi wget

Output:

Name        : wget
Version     : 1.14
Release     : 13.el7
Architecture: x86_64
Install Date: Wed 09 Aug 2017 04:23:51 PM UTC
Group       : Applications/Internet
Size        : 2055469
License     : GPLv3+
Signature   : RSA/SHA256, Sun 20 Nov 2016 08:59:56 PM UTC, Key ID 24c6a8a7f4a80eb5
Source RPM  : wget-1.14-13.el7.src.rpm
Build Date  : Sat 05 Nov 2016 07:19:44 PM UTC
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.gnu.org/software/wget/
Summary     : A utility for retrieving files using the HTTP or FTP protocols
Description :
GNU Wget is a file retrieval utility which can use either the HTTP or
FTP protocols. Wget features include the ability to work in the
background while you are logged out, recursive retrieval of
directories, file name wildcard matching, remote file timestamp
storage and comparison, use of Rest with FTP servers and Range with
HTTP servers to retrieve files over slow or unstable connections,
support for Proxy servers, and configurability.

OR

yum info wget

Output:

Installed Packages
Name        : wget
Arch        : x86_64
Version     : 1.14
Release     : 13.el7
Size        : 2.0 M
Repo        : installed
From repo   : base
Summary     : A utility for retrieving files using the HTTP or FTP protocols
URL         : http://www.gnu.org/software/wget/
License     : GPLv3+
Description : GNU Wget is a file retrieval utility which can use either the HTTP or
            : FTP protocols. Wget features include the ability to work in the
            : background while you are logged out, recursive retrieval of
            : directories, file name wildcard matching, remote file timestamp
            : storage and comparison, use of Rest with FTP servers and Range with
            : HTTP servers to retrieve files over slow or unstable connections,
            : support for Proxy servers, and configurability.

Get a list of created files from the package on CentOS / RHEL / Fedora:

Sometimes, you need to know what are the files created at the time of package installation.

rpm -ql wget

Output:

/etc/wgetrc
/usr/bin/wget
/usr/share/doc/wget-1.14
/usr/share/doc/wget-1.14/AUTHORS
/usr/share/doc/wget-1.14/COPYING
/usr/share/doc/wget-1.14/MAILING-LIST
/usr/share/doc/wget-1.14/NEWS
/usr/share/doc/wget-1.14/README
/usr/share/doc/wget-1.14/sample.wgetrc
/usr/share/info/wget.info.gz
/usr/share/locale/be/LC_MESSAGES/wget.mo
/usr/share/locale/bg/LC_MESSAGES/wget.mo
/usr/share/locale/ca/LC_MESSAGES/wget.mo
/usr/share/locale/cs/LC_MESSAGES/wget.mo
/usr/share/locale/da/LC_MESSAGES/wget.mo
/usr/share/locale/de/LC_MESSAGES/wget.mo
/usr/share/locale/el/LC_MESSAGES/wget.mo
/usr/share/locale/en_GB/LC_MESSAGES/wget.mo
/usr/share/locale/eo/LC_MESSAGES/wget.mo
/usr/share/locale/es/LC_MESSAGES/wget.mo
/usr/share/locale/et/LC_MESSAGES/wget.mo
.   .   .

Export Installed Packages list on CentOS / RHEL / Fedora:

Exporting packages could be useful when you want a similar set of packages to be installed on another machine.

rpm -qa > mypackagelist.txt
cat mypackagelist.txt

OR

yum list installed | awk 'FNR > 2{print $1}' > mypackagelist.txt
cat mypackagelist.txt

Restore installed packages on CentOS / RHEL / Fedora:

If you have a backup of the list of installed packages then simply use the following command on another machine to make it identical.

yum install $(cat mypackagelist.txt)

That’s All.

You might also like