Bootstrap FreeKB - DNF - Install a package
DNF - Install a package

Updated:   |  DNF articles

The dnf install command is used to install a package from one of the repositories you have installed. The repositories you have installed will be listed at the beginning of the output. It is very common to install the EPEL (Extra Packages for Enterprise Linux) repository.

~]$ dnf list | head
 * base: centos.mirrors.tds.net
 * centos-sclo-rh: mirror.den01.meanservers.net
 * centos-sclo-sclo: mirror.den01.meanservers.net
 * epel: mirror.team-cymru.com
 * extras: centos.mirrors.tds.net
 * updates: mirror.genesishosting.com

 

Let's say you try to install a package that is not found in any of the repositories you have installed.

dnf install foo

 

Something like this should be returned.

base                                                                                                                                                                  | 3.6 kB  00:00:00
centos-sclo-rh                                                                                                                                                        | 3.0 kB  00:00:00
centos-sclo-sclo                                                                                                                                                      | 3.0 kB  00:00:00
extras                                                                                                                                                                | 2.9 kB  00:00:00
updates                                                                                                                                                               | 2.9 kB  00:00:00
No package foo available.
Error: Nothing to do

 

On the other hand, let's try to install a package that is found in one of the repositories you have installed.

dnf install wget

 

If you want to install a specific version, you will use a syntax like this.

dnf install <name>-<version>

 

For example.

dnf install wget.x86_64-0:1.14-18.el7_6.1

 

Something like this should be returned. Notice in this example the the wget package is found in the "base" repository.

Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================
 Package                                            Arch                                                 Version                                                        Repository                                          Size
=================================================================================================================================================================================================================================
Installing:
 wget                                               x86_64                                               1.14-18.el7_6.1                                                base                                               547 k

Transaction Summary
=================================================================================================================================================================================================================================
Install  1 Package

Total download size: 547 k
Installed size: 2.0 M
Is this ok [y/d/N]: 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f55286 in the box below so that we can be sure you are a human.