From Mageia wiki
Revision as of 07:41, 16 October 2018 by Cmoifp (talk | contribs)
Jump to: navigation, search


Drakconf multiflag.png
Other languages
Deutsch ; English ; Français ; 简体中文


Now that Feature:Add DNF as Alternate Repository Manager is done, it is possible to start using it.

Install and Setup

  • install dnf:
 urpmi dnf
  • 32-bit repositories are turned off by default on 64-bit x86. They can be turned on with dnf config-manager as shown with this example:
 dnf config-manager --set-enabled mageia-i586 updates-i586
  • If nonfree or tainted repositories are desired, they can be turned on with dnf config-manager as shown with this example:
 dnf config-manager --set-enabled mageia-x86_64-nonfree updates-x86_64-nonfree
  • For Cauldron, replace "mageia" with "cauldron" and "updates", "backports", etc. with "cauldron-updates", "cauldron-backports", etc respectively in the above commands.
  • If you wish to override the mirror selection with your preferred mirror, you can do so by editing the repository config files in /etc/yum.repos.d. Uncomment the "baseurl=" line and change the URL to point to your preferred mirror. This will automatically override the "metalink" and "mirrorlist" properties so that it will use the designated mirror. If you want, you can comment out the "metalink=" and "mirrorlist=" entries if you want, but that will eliminate the failover mechanism that occurs when the "primary" mirror isn't functioning.

Some commands to get started

As root:

  • dnf install ri-li installs ri-li
  • dnf reinstall ri-li reinstalls ri-li
  • dnf remove ri-li removes ri-li
  • dnf makecache refreshes the metadata (what is available on the repos)
  • dnf check-update --refresh refreshes the metadata and checks for new updates
  • dnf upgrade --refresh refreshes metadata and does all available updates
  • dnf upgrade --best forces attempts to select best available versions, which can help in determining dependency errors
  • dnf distro-sync --refresh refreshes the metadata and synchronizes the package set installed on the computer with versions in the repositories
  • dnf distro-sync --allowerasing --best will help to upgrade a package with changed major, like e.g. lib64clang3.8 to lib64clang3.9
  • dnf history list shows the install/remove/upgrade history list
  • dnf history info 12 shows what happened during item 12 from the history list)
  • dnf downgrade ri-li downgrades ri-li
  • dnf shell invokes the interactive shell for doing multiple actions as one transaction

As user (or root):

  • dnf help shows a help page
  • dnf search fax returns all packages with "fax" in the name or summary
  • dnf repolist shows the enabled repos and last metadata check

Short command variants of common commands

Starting with DNF 2.6.2, there are now short abbreviations for commonly used commands:
As root:

  • dnf in ri-li installs ri-li
  • dnf ri ri-li reinstalls ri-li
  • dnf rm ri-li removes ri-li
  • dnf mc refreshes the metadata (what is available on the repos)
  • dnf up does all available updates
  • dnf dsync synchronizes the package set installed on the computer with versions in the repositories
  • dnf dg ri-li downgrade ri-li
  • dnf sh invokes the interactive shell for doing multiple actions as one transaction

As user (or root):

  • dnf se fax returns all packages with "fax" in the name or summary

If you have a non-English system and need the output in English, then put LANGUAGE=C on the same line before the command.

Setting up a container for a non-native architecture

Starting with DNF 2.6.2, it is now possible to build chroots or containers for foreign architectures.

The procedure for creating an ARMv7 chroot on an x86_64 system is as follows:

  1. Install qemu-user-static on the host system
  2. Restart systemd-binfmt.service to have new binary format information to take effect
  3. Create the directory of your foreign arch chroot. For example /var/lib/machines/mga6armv7hl
  4. Run DNF as root to create the installroot:

dnf --installroot=/var/lib/machines/mga6armv7hl --releasever=6 --forcearch=armv7hl --repofrompath=mga6rel,http://mirrors.kernel.org/mageia/distrib/6/armv7hl/media/core/release/ --repofrompath=mga6up,http://mirrors.kernel.org/mageia/distrib/6/armv7hl/media/core/updates/ --disablerepo=* --enablerepo=mga6rel --enablerepo=mga6up --setopt=install_weak_deps=False install basesystem-minimal dnf

Finally, test the chroot to see if a program runs. Here's a suggested command (run as root): chroot /var/lib/machines/mga6armv7hl /usr/bin/uname -r -m

Documentation