How to use yum without downloading or updating metadata

Use yum without downloading or updating its metadata.

By default yum will download and update its metadata.

$ yum list vim-enhanced
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos2.hti.pl
 * extras: centos1.hti.pl
 * updates: centos2.hti.pl
base                                                                    | 3.6 kB  00:00:00
extras                                                                  | 2.9 kB  00:00:00
updates                                                                 | 2.9 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                           | 165 kB  00:00:00
(2/4): extras/7/x86_64/primary_db                                       | 152 kB  00:00:00
(3/4): updates/7/x86_64/primary_db                                      | 1.9 MB  00:00:00
(4/4): base/7/x86_64/primary_db                                         | 6.0 MB  00:00:06
Available Packages
vim-enhanced.x86_64                    2:7.4.629-6.el7                                base

Next time define --cacheonly option to skip that part and run completely from system cache.

$ yum --cacheonly list vim-enhanced
Loaded plugins: fastestmirror
Installed Packages
vim-enhanced.x86_64                    2:7.4.629-6.el7                               @base

To quickly update cache by hand execute the following command.

$ sudo yum makecache fast
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.wcss.pl
 * extras: mirror.mijn.host
 * updates: tux.rainside.sk
base                                                                    | 3.6 kB  00:00:00
extras                                                                  | 2.9 kB  00:00:00
updates                                                                 | 2.9 kB  00:00:00
Metadata Cache Created

Read yum manual page for more information.