Other languages Deutsch ; English ; Français ; 简体中文 |
Contents
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-lidnf reinstall ri-li
reinstalls ri-lidnf remove ri-li
removes ri-lidnf makecache
refreshes the metadata (what is available on the repos)dnf check-update --refresh
refreshes the metadata and checks for new updatesdnf upgrade --refresh
refreshes metadata and does all available updatesdnf upgrade --best
forces attempts to select best available versions, which can help in determining dependency errorsdnf distro-sync --refresh
refreshes the metadata and synchronizes the package set installed on the computer with versions in the repositoriesdnf distro-sync --allowerasing --best
will help to upgrade a package with changed major, like e.g. lib64clang3.8 to lib64clang3.9dnf history list
shows the install/remove/upgrade history listdnf history info 12
shows what happened during item 12 from the history list)dnf downgrade ri-li
downgrades ri-lidnf shell
invokes the interactive shell for doing multiple actions as one transaction
As user (or root):
dnf help
shows a help pagednf search fax
returns all packages with "fax" in the name or summarydnf 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-lidnf ri ri-li
reinstalls ri-lidnf rm ri-li
removes ri-lidnf mc
refreshes the metadata (what is available on the repos)dnf up
does all available updatesdnf dsync
synchronizes the package set installed on the computer with versions in the repositoriesdnf dg ri-li
downgrade ri-lidnf 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:
- Install
qemu-user-static
on the host system - Restart
systemd-binfmt.service
to have new binary format information to take effect - Create the directory of your foreign arch chroot. For example
/var/lib/machines/mga6armv7hl
- 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