wiki/distribution/guides/software-management/DNF.md

114 lines
3.9 KiB
Markdown
Raw Normal View History

2020-03-06 18:48:36 +00:00
---
title: Using dnf in OpenMandriva Lx
description:
published: true
2022-08-27 23:45:30 +01:00
date: 2022-03-02T03:40:30.651Z
tags: documentation, dnf, user-guide
editor: markdown
2020-12-23 12:41:18 +00:00
dateCreated: 2020-03-06T18:48:34.373Z
2020-03-06 18:48:36 +00:00
---
# Using dnf in OpenMandriva Lx
2020-03-06 18:52:32 +00:00
> For full documentation and more commands see [DNF Command Reference](https://dnf.readthedocs.io/en/latest/command_ref.html)
2020-03-06 18:48:36 +00:00
{.is-success}
## Some basic commands
- install a package:
`$ sudo dnf --refresh install <package_name>`
- remove a package:
`$ sudo dnf remove <package_name>`
- search repositories for a package:
`$ sudo dnf search <package_name>`
Note: 'dnf search' will work with partial names as well
- cleanup any files and packages left in cache and to remove repository metadata:
`$ sudo dnf clean all ; dnf clean all`
- update your Rock system:
2020-03-06 18:48:36 +00:00
`$ sudo dnf --refresh upgrade `
- update your Rolling system:
`$ sudo dnf --refresh distro-sync `
2020-03-06 18:48:36 +00:00
## Some other common dnf commands
`autoremove`
removes packages installed as dependencies that are no longer required by currently installed programs.
2020-03-06 18:53:40 +00:00
> Be careful and pay attention when using `dnf autoremove`. It is absolutely possible that this may remove something you don't want to remove. It is a good idea to keep a list of packages that were autoremoved so you know what to re-install if this happens.
Note: You can find autoremoved packages in `/var/log/dnf.log`
2020-03-06 18:48:36 +00:00
{.is-warning}
`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
`repolist`
list enabled repositories
## Some commands may be abbreviated
`dnf in=dnf install`
`dnf ri=dnf reinstall`
`dnf dg=dnf downgrade`
`dnf rm=dnf remove`
`dnf up=dnf upgrade`
`dnf dsync=dnf distro-sync`
2020-03-06 18:48:36 +00:00
## Some common dnf options
`--allowerasing`
Allow erasing of installed packages to resolve dependencies. This option could be used as an alternative to the yum swap command where packages to remove are not explicitly defined. Use carefully, know what you are doing or you can break your system.
`-b, --best`
Try the best available package versions in transactions. Specifically during dnf upgrade, which by default skips over updates that can not be installed for dependency reasons, the switch forces DNF to only consider the latest packages. When running into packages with broken dependencies, DNF will fail giving a reason why the latest version can not be installed
`--disable, --set-disabled`
Disable specified repositories (automatically saves). The option has to be used together with the config-manager command (dnf-plugins-core)
`--disablerepo=<repoid>`
Disable specific repositories by an id or a glob. This option is mutually exclusive with `--repo`.
`--downloadonly`
Download the resolved package set without performing any rpm transaction (install/upgrade/erase).
`--enable, --set-enabled`
Enable specified repositories (automatically saves). The option has to be used together with the config-manager command (dnf-plugins-core)
`--enablerepo=<repoid>`
Enable additional repositories by an id or a glob
`--exclude=<package_name>`
Exclude certain packages from transaction
`--nobest`
Set best option to False, so that transactions are not limited to best candidates only
`-y, --assumeyes`
Automatically answer yes for all questions
2020-03-06 19:13:32 +00:00
## More
`$ dnf --help`
and
`$ man dnf`
The help menu takes about a minute to a minute and a half to read. The man page takes about 3-5 minutes.
Both are meant to be available for users to refer to as they use their system and need to find quickly how to do something.
There are also wiki pages and docs about dnf: [Using the DNF software package manager](https://docs.fedoraproject.org/en-US/quick-docs/dnf/), [Fedora wiki page](https://fedoraproject.org/wiki/DNF?rd=Dnf), and [DNF Command Reference](https://dnf.readthedocs.io/en/latest/command_ref.html).