dnf-install
Install software packages
TLDR
Install packages by name
Install a package from a local file
Install a package from the internet
Add the Extra Packages for Enterprise Linux (EPEL) repositories
Add Remi's RPM repository
SYNOPSIS
dnf [OPTIONS] install [PACKAGE_SPEC...]
PACKAGE_SPEC can be a package name, a file path to an RPM, a group name, or a glob expression.
PARAMETERS
--assumeyes, -y
Automatically answer yes to all questions during the installation process.
--downloadonly
Download packages but do not install them. They are saved in the DNF cache.
--nogpgcheck
Disable GPG signature checking for packages. Use with caution as it bypasses security checks.
--installroot=
Install packages into an alternative root directory, useful for chroot environments.
--exclude=
Exclude specific packages or package groups from the installation process.
--enablerepo=
Enable specific repositories for this command instance, even if they are normally disabled.
--disablerepo=
Disable specific repositories for this command instance, even if they are normally enabled.
--allowerasing
Allow erasing of installed packages to resolve dependencies. Useful during upgrades or complex dependency changes.
--best
Try to install the best candidate package from all enabled repositories, typically the highest version available.
--setopt=
Set a specific DNF configuration option for this command, overriding default or system-wide settings.
--releasever=
Set the value of the $releasever variable in DNF configuration, affecting repository paths.
DESCRIPTION
dnf install
is a subcommand of the DNF (Dandified YUM) package manager, used primarily on Fedora, RHEL, CentOS, and other RPM-based Linux distributions. It is the primary tool for installing new software packages on these systems. When a package name is provided, DNF automatically resolves and installs all necessary dependencies, ensuring the software functions correctly. It fetches packages from configured software repositories, verifies their integrity, and integrates them into the system.
This command replaced the older YUM package manager due to improvements in performance, dependency resolution, and API design. dnf install
can handle multiple packages at once and provides various options to control the installation process, such as installing only if dependencies are met, checking GPG signatures, or downloading packages without installing them.
While the request refers to "dnf-install", the correct command usage is dnf install
.
CAVEATS
Requires root privileges (e.g., using sudo
) to perform installations.
An active internet connection is typically needed to download packages from online repositories.
While DNF is robust, complex dependency conflicts can occasionally arise, especially when mixing repositories or installing packages from unofficial sources.
Ensure sufficient disk space is available for the packages and their dependencies before initiating an installation.
USAGE EXAMPLES
Install a single package:sudo dnf install httpd
Install multiple packages:sudo dnf install firefox thunderbird
Install a package and automatically confirm:sudo dnf install -y mariadb-server
Download packages without installing:sudo dnf install --downloadonly nginx
Install an RPM file directly:sudo dnf install /path/to/my_app.rpm
Install a package from a specific enabled repository:sudo dnf install --enablerepo=epel-testing mypackage
EXIT STATUS
DNF commands, including install
, typically return a status of 0 on success. A non-zero exit status indicates an error, such as a package not found, a dependency resolution failure, or insufficient permissions. This allows for scripting and error checking.
HISTORY
DNF (Dandified YUM) was designed as a next-generation package manager to replace YUM (Yellowdog Updater, Modified). Development on DNF began around 2012, aiming to address several limitations of YUM, including performance issues, complex dependency resolution, and a desire for a more robust API for programmatic interaction. DNF uses a different dependency resolver called libsolv, which is known for its speed and accuracy. It first became the default package manager in Fedora 18 and later formally replaced YUM in Fedora 22. It was subsequently adopted by Red Hat Enterprise Linux 8 and its derivatives (like CentOS 8 and Rocky Linux). The dnf install
command effectively carries on the core function of yum install
.