# Paketmanager in Fedora DNF

# Using the DNF software package manager

<div class="is-before-toc text-xs text-gray-400 border-b border-gray-300 mb-6 pb-1" id="bkmrk-">  
</div>DNF is a software package manager that installs, updates, and removes packages on Fedora and is the successor to YUM (Yellow-Dog Updater Modified). DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages. This method eliminates the need to manually install or update the package, and its dependencies, using the `rpm` command. DNF is now the default software package management tool in Fedora.

## Usage

`dnf` can be used exactly as `yum` to search, install or remove packages.

To search the repositories for a package type:

<div class="sect1" id="bkmrk--1"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
# dnf search packagename
```

<div class="sect1" id="bkmrk--2"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div>To install the package:

<div class="sect1" id="bkmrk--3"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
# dnf install packagename
```

<div class="sect1" id="bkmrk--4"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div>To remove a package:

<div class="sect1" id="bkmrk--5"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
# dnf remove packagename
```

<div class="sect1" id="bkmrk--6"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div>Other common DNF commands include:

<div class="sect1" id="bkmrk-autoremove---removes"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="ulist">- `autoremove` - removes packages installed as dependencies that are no longer required by currently installed programs.
- `check-update` - checks for updates, but does not download or install the packages.
- `downgrade` - reverts to the previous version of a package.
- `info` - provides basic information about the package including name, version, release, and description.
- `reinstall` - reinstalls the currently installed package.
- `upgrade` - checks the repositories for newer packages and updates them.
- `exclude` - exclude a package from the transaction.

</div><div class="paragraph">  
</div></div></div></div>For more DNF commands refer to the man pages by typing `man dnf` at the command-line, or [DNF Read The Docs](https://dnf.readthedocs.io/en/latest/command_ref.html)

## Automatic Updates

The `dnf-automatic` package is a component that allows automatic download and installation of updates. It can automatically monitor and report, via e-mail, the availability of updates or send a log about downloaded packages and installed updates.

For more information, refer to the [Read the Docs: DNF-Automatic](https://dnf.readthedocs.org/en/latest/automatic.html) page.

## System Upgrades

To update your Fedora Linux release from the command-line do:

```bash
sudo dnf upgrade --refresh
```

<div class="listingblock" id="bkmrk--7"><div class="content"><div class="source-toolbox">  
</div></div></div>- and reboot your computer.
    
    **Important:** Do not skip this step. System updates are required to receive signing keys of higher-versioned releases, and they often fix problems related to the upgrade process.
- Download the updated packages:
    
    ```bash
    sudo dnf system-upgrade download --releasever=43
    ```
    
    <div class="listingblock"><div class="content"><div class="source-toolbox">  
    </div></div></div>

Change the `--releasever=` number if you want to upgrade to a different release. Most people will want to upgrade to the latest stable release, which is `43`, but in some cases, such as when you’re currently running an older release than `42`, you may want to upgrade just to Fedora Linux `42`. System upgrade is only officially supported and tested over 2 releases at most (e.g. from `41` to `43`). If you need to upgrade over more releases, it is recommended to do it in several smaller steps ([read more](https://docs.fedoraproject.org/en-US/quick-docs/upgrading-fedora-offline/#sect-how-many-releases-can-i-upgrade-across-at-once)).

## Language Support Using DNF

DNF can be used to install or remove Language Support. A detailed description with a list of available languages can be found on [Language Support Using Dnf](https://fedoraproject.org/wiki/I18N/Language_Support_Using_Dnf) page.

## Plugins

The core DNF functionality can be extended with plugins. There are officially supported [Core DNF plugins](https://dnf-plugins-core.readthedocs.io) and also third-party [Extras DNF Plugins](https://dnf-plugins-extras.readthedocs.io). To install them, run

<div class="sect1" id="bkmrk--8"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
# dnf install dnf-plugins-core-PLUGIN_NAME
```

<div class="sect1" id="bkmrk--9"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div>or

<div class="sect1" id="bkmrk--10"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div>```
# dnf install dnf-plugins-extras-PLUGIN_NAME
```

## Excluding Packages From Transactions

Sometimes it is useful to ignore specific packages from transactions, such as updates. One such case, for example, could be when an update includes a regression or a bug. DNF allows you to exclude a package from the transaction:

<div class="sect1" id="bkmrk-using-the-command-li"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="ulist">- using the command line

</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
sudo dnf upgrade --exclude=packagename
```

<div class="sect1" id="bkmrk-using-its-configurat"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="ulist">- using its configuration files

</div><div class="paragraph">  
</div></div></div></div>You can add a line to `/etc/dnf/dnf.conf` to exclude packages:

<div class="sect1" id="bkmrk--11"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div>```
excludepkgs=packagename
```

<div class="sect1" id="bkmrk--12"><div class="sect1"><div class="sectionbody"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div>This can also be added to the specific repository configuration files in `/etc/yum.repos.d/`. [Globs](https://en.wikipedia.org/wiki/Glob_(programming)) may be used here to list multiple packages, and each specification must be separated by a comma. If you have used this configuration, you can disable it in individual DNF commands using using the `--disableexcludes` command line switch.

If you use a GUI update application which does not allow you to specify packages to exclude when they run, this method can be used.

### Using the DNF Versionlock plugin

You can also use the DNF `versionlock` plugin to limit the packages that are included in a transaction. It allows you to list what versions of particular packages should be considered in a transaction. All other versions of the specified packages will be ignored. The plugin is part of `dnf-plugins-core` package and can be installed using the command below:

<div class="sect1" id="bkmrk--13"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div></div>```
sudo dnf install 'dnf-command(versionlock)'
```

<div class="sect1" id="bkmrk--14"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div></div>To lock the currently installed version of a package, use:

<div class="sect1" id="bkmrk--15"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div></div>```
sudo dnf versionlock add package
```

<div class="sect1" id="bkmrk--16"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div></div>To remove the version lock, use:

<div class="sect1" id="bkmrk--17"><div class="sect1"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="paragraph">  
</div><div class="listingblock"><div class="content">  
</div></div></div></div></div></div></div>```
sudo dnf versionlock delete package
```

<div class="sect1" id="bkmrk--18"><div class="sect1"><div class="sectionbody"><div class="sect2"><div class="listingblock"><div class="content">  
</div></div><div class="paragraph">  
</div></div></div></div></div>The `list` command can be used to list all locked packages, while the `clear` command will delete all locked entries.

## References

<div class="sect1" id="bkmrk-dnf-command-referenc"><div class="sectionbody"><div class="olist arabic">1. [DNF Command Reference](https://dnf.readthedocs.io/en/latest/command_ref.html)
2. [DNF wiki](https://github.com/rpm-software-management/dnf/wiki)
3. [DNF VersionLock](https://dnf-plugins-core.readthedocs.io/en/latest/versionlock.html)

</div></div></div>