The Yum package manager has been replaced by DNF.

Usage[edit | edit source]

Task Command
Clean and update repository metadata
# yum clean all
# yum update
Install a package by name
# yum install <package>
Remove a package by name
# yum remove <package>
Upgrade a package
# yum update <package>
Search for a package
# yum search <package>
Search for a package by provided file
## To find any package that provides *bin/netcat as a file
# yum whatprovides \*bin/netcat
List installed packages
# rpm -qa
Determine which package provided a file
# rpm -qf <path to file>

Yum repositories are placed in /etc/yum.repos.d. Typically, yum logs will show all actions taken by yum at /var/log/yum.rpm.log.

Excluding Packages[edit | edit source]

To exclude a package from being installed, use the -x option or add to the exclude attribute in the /etc/yum.conf file.

The list is separated by a space and supports wildcards. For example:

exclude=cpsc-uml pack* package3
DNF Specific
If you are using dnf such as on CentOS 8, or a recent version of Fedora, you need to add the exclude line in the /etc/dnf/dnf.conf file under the [main] section.

For example:



Troubleshooting[edit | edit source]

thread.error: can't start new thread[edit | edit source]

While attempting to install a package on a VPS, I encountered:

[root@drache ~]# yum install php-mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/", line 178, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/", line 345, in doCommands
  File "/usr/lib/python2.4/site-packages/yum/", line 101, in _getTs
  File "/usr/lib/python2.4/site-packages/yum/", line 112, in _getTsInfo
    pkgSack = self.pkgSack
  File "/usr/lib/python2.4/site-packages/yum/", line 661, in 
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.4/site-packages/yum/", line 501, in _getSacks
  File "/usr/lib/python2.4/site-packages/yum/", line 232, in populateSack
  File "/usr/lib/python2.4/site-packages/yum/", line 79, in doSetup'postreposetup')
  File "/usr/lib/python2.4/site-packages/yum/", line 179, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/", line 181, in postreposetup_hook
    all_urls = FastestMirror(all_urls).get_mirrorlist()
  File "/usr/lib/yum-plugins/", line 333, in get_mirrorlist
  File "/usr/lib/yum-plugins/", line 376, in _poll_mirrors
  File "/usr/lib64/python2.4/", line 416, in start
    _start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread

The solution was to disable the fastest mirror plugin by editing /etc/yum/pluginconf.d/fastestmirror.conf and setting enable=0

maxthreads=15, facebook

Bad id for repo: My Repo, byte = N[edit | edit source]

After adding a custom repository, running yum or dnf resulted in this error:

Bad id for repo: Local EPEL - Everything, byte =   5
Bad id for repo: Local EPEL - Modular, byte =   5

The issue here is the space. Replace the spaces with dashes or underscores and try again.

Cannot install packages because of an unimported repo key[edit | edit source]

If you had installed a repo via kickstart without importing the necessary keys, you will see the following message:

# dnf -y install docker-ce docker-ce-cli

You have enabled checking of packages via GPG keys. This is a good thing.
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key

Alternatively you can specify the url to the key you would like to use
for a repository in the 'gpgkey' option in a repository section and DNF
will install it for you.

For more information contact your distribution or package provider.

You will need to import the keys for this repo via rpm --import. Check the repo file for the appropriate gpg key to import.

In the case above, I was missing the docker keys, so the fix was to run rpm --import