DNF

DNF, paketler hakkında bilgi sorgulayabilen, depolardan paketleri alabilen, otomatik bağımlılık çözümlemeyi kullanarak paketleri kurabilen ve kaldırabilen ve tüm sistemi kullanılabilir en son paketlere güncelleyebilen The Fedora Project paket yöneticisidir. DNF güncellediğiniz, kurduğunuz veya kaldırdığınız paketler üzerinde otomatik bağımlılık çözümlemesi gerçekleştirir ve böylece kullanılabilir tüm bağımlı paketleri otomatik olarak belirleyebilir, alabilir ve kurabilir. DNF yeni, ek depolar veya paket kaynakları ile yapılandırılabilir ve ayrıca yapabildiklerini geliştiren ve genişleten birçok eklenti sağlar. DNF, RPM ile aynı görevlerin çoğunu gerçekleştirebilir; ayrıca, komut satırı seçeneklerinin çoğu benzerdir. DNF, tek bir makinede veya makine gruplarında kolay ve basit paket yönetimi sağlar.

GPG imzalı paketlerle güvenli paket yönetimi

DNF, tüm paket depoları (paket kaynakları) veya bireysel depolar için GPG imzalı paketlerde GPG (Gnu Privacy Guard; GnuPG olarak da bilinir) imza doğrulamasını etkinleştirerek güvenli paket yönetimi sağlar. İmza doğrulama etkinleştirildiğinde DNF, o depo için doğru anahtarla GPG imzalı olmayan paketleri kurmayı reddedecektir. Bu, sisteminize indirip kurduğunuz RPM paketlerinin The Fedora Project gibi güvenilir bir kaynaktan geldiğine ve aktarım sırasında değiştirilmediğine güvenebileceğiniz anlamına gelir. DNF ile imza denetimini etkinleştirmeyle ilgili ayrıntılar için DNF ve DNF Depolarını Yapılandırma kısmına, genel olarak GPG imzalı RPM paketleriyle çalışma ve bunları doğrulama hakkında bilgi için Paket İmzalarını Denetleme kısmına bakın.

DNF ayrıca, diğer makinelere indirmek ve kurmak için kendi RPM paket depolarınızı kolayca ayarlamanıza olanak tanır.

DNF’yi öğrenmek değerli bir yatırımdır çünkü genellikle sistem yönetimi görevlerini gerçekleştirmenin en hızlı yoludur ve yapabilecekleri PackageKit grafiksel paket yönetim araçları tarafından sağlananların ötesindedir.

DNF ve süper kullanıcı ayrıcalıkları

Paketleri sisteminize kurmak, güncellemek veya kaldırmak üzere dnf komutunu kullanmak için süper kullanıcı ayrıcalıklarına sahip olmanız gerekir. Bu bölümdeki tüm örnekler, su veya sudo komutunu kullanarak süper kullanıcı ayrıcalıkları elde etmiş olduğunuzu varsaymaktadır.

Paketleri Denetleme ve Güncelleme

Güncellemeleri Denetleme

Güncellemeleri denetlemenin en hızlı yolu, aşağıdaki gibi dnf upgrade komutunu kullanarak kullanılabilir güncellemeleri kurmaya çalışmaktır:

~]# dnf upgrade
Last metadata expiration check performed 1:24:32 ago on Thu May 14 23:23:51 2015.
Dependencies resolved.
Nothing to do.
Complete!

dnf upgrade komutunun yalnızca kurulabilen güncellemeleri kurduğunu unutmayın. Bir paket, örneğin bağımlılık sorunları nedeniyle güncellenemiyorsa, atlanır.

dnf check-update komutu sisteminizde kurulu paketlerden hangilerinin yeni sürümlerinin var olduğunu görmek için kullanılabilir, ancak bu, başarıyla kurulabilecekleri anlamına gelmez. Bu nedenle bu komut, çoğunlukla betiklerde ve dnf upgrade çalıştırıldıktan sonra kurulmayan güncellenen paketleri denetlemek için kullanışlıdır.

Örneğin:

~]# dnf check-update
Using metadata from Mon Apr 20 16:34:10 2015 (2:42:10 hours old)

python.x86_64                     2.7.9-6.fc22          updates
python-cryptography.x86_64        0.8.2-1.fc22          updates
python-libs.x86_64                2.7.9-6.fc22          updates

Yukarıdaki çıktıdaki paketler, güncellenen sürümlere sahip olarak listelenmiştir. Örnek çıktıdaki satır bize şunu söylemektedir:

  • python — paketin adı,

  • x86_64 — paketin oluşturulduğu CPU mimarisi,

  • 2.7.9 — güncellenen paketin sürümü,

  • 6.fc22 — güncellenen paketin yayın numarası,

  • updates-testing — güncellenen paketin bulunduğu depo.

Paketleri Güncelleme

Tek bir paketi, birden çok paketi veya tüm paketleri bir kerede güncellemeyi seçebilirsiniz. Güncellediğiniz paketin veya paketlerin herhangi bir bağımlılığının güncellemeleri varsa, onlar da güncellenir.

Tek Bir Paketi Güncelleme

Tek bir paketi güncellemek için root olarak şu komutu çalıştırın:

dnf upgrade paket_adı

Örneğin, python paketini güncellemek için şunu yazın:

~]# dnf upgrade python
Using metadata from Mon Apr 20 16:38:16 2015 (2:42:14 hours old)
Dependencies resolved.
==================================================================
 Package       Arch       Version       Repository       Size
==================================================================
Upgrading:
 python        x86_64     2.7.9-6.fc22  updates           92 k
 python-libs   x86_64     2.7.9-6.fc22  updates          5.8 M

Transaction Summary
==================================================================
Upgrade  2 Packages

Total download size: 5.9 M
Is this ok [y/N]:

Bu çıktı şunları içerir:

  1. python.x86_64 — yeni python paketini indirip kurabilirsiniz.

  2. python-libs.x86_64 — DNF, python-libs-2.7.9-6.fc22.x86_64 paketinin python paketinin gerekli bir bağımlılığı olduğunu çözümledi.

  3. DNF, güncelleme bilgilerini gösterir ve ardından güncellemenin gerçekleştirilmesini isteyip istemediğinizi sorar; DNF öntanımlı olarak etkileşimli çalışır. DNF’nin hangi işlemleri gerçekleştirmeyi planladığını zaten biliyorsanız, DNF’nin sorabileceği tüm sorulara otomatik olarak yes yanıtı vermek için -y seçeneğini kullanabilirsiniz (bu durumda etkileşimsiz bir şekilde çalışır). Ancak, ortaya çıkabilecek sorunları kolayca giderebilmeniz için DNF’nin sistemde hangi değişiklikleri yapmayı planladığını her zaman incelemelisiniz.

    Bir işlem ters giderse, İşlem Geçmişiyle Çalışma kısmında açıklandığı gibi dnf history komutunu kullanarak DNF’nin işlem geçmişini görüntüleyebilirsiniz.

DNF ile çekirdekleri güncelleme ve kurma

rpm -i kernel komutunu kullandığınızda RPM'nin yeni bir çekirdek kurmasıyla aynı şekilde DNF her zaman yeni bir çekirdek kurar. Bu nedenle, dnf komutunu kullandığınızda bir çekirdek paketini kurma ve yükseltme arasındaki fark konusunda endişelenmenize gerek yoktur: dnf upgrade veya dnf install komutlarından hangisini kullanırsanız kullanın doğru olanı yapacaktır.

Öte yandan RPM kullanılırken, (geçerli çekirdeği değiştiren) rpm -u kernel yerine (yeni bir çekirdek kuran) rpm -i kernel komutunun kullanılması önemlidir. RPM ile çekirdek kurma ve güncelleme hakkında daha fazla bilgi için Paketleri Kurma ve Yükseltme kısmına bakın.

Tüm Paketleri ve Bağımlılıklarını Güncelleme

Tüm paketleri ve bunların bağımlılıklarını güncellemek için, herhangi bir argüman olmadan dnf upgrade komutunu çalıştırın:

dnf upgrade

Yapılandırma Dosyası Değişikliklerini Koruma

Fedora sisteminizi kullanırken paketler tarafından kurulan yapılandırma dosyalarında kaçınılmaz olarak değişiklikler yapacaksınız. DNF’nin sistemde değişiklik yapmak için kullandığı RPM, onların bütünlüklerini korumak için bir mekanizma sağlar. Paket yükseltmelerinde yapılandırma dosyalarındaki değişikliklerin nasıl yönetileceğine ilişkin ayrıntılar için Paketleri Kurma ve Yükseltme kısmına bakın.

Paketler ve Paket Grupları

Paketleri Arama

Aşağıdaki komutu kullanarak tüm RPM paket adlarını ve özetlerini arayabilirsiniz:

dnf search terim

Açıklamalar ve URL’lerle eşleştirmek için all ekleyin.

dnf search all terim

Bu komut, her terim için eşleşmelerin listesini görüntüler. Örneğin, "meld" veya "kompare" ile eşleşen tüm paketleri listelemek için şunu yazın:

~]# dnf search meld kompare
Loaded plugins: langpacks, presto, refresh-packagekit
============================ N/S Matched: meld ===============================
meld.noarch : Visual diff and merge tool
python-meld3.x86_64 : HTML/XML templating system for Python

=========================== N/S Matched: kompare =============================
komparator.x86_64 : Kompare and merge two folders

  Name and summary matches only, use "search all" for everything.

Listing Packages

dnf list and related commands provide information about packages, package groups, and repositories.

All of DNF’s list commands allow you to filter the results by appending one or more glob expressions as arguments. Glob expressions are normal strings of characters which contain one or more of the wildcard characters * (which expands to match any character multiple times) and ? (which expands to match any one character).

Filtering results with glob expressions

Be careful to escape the glob expressions when passing them as arguments to a dnf command, otherwise the Bash shell will interpret these expressions as pathname expansions, and potentially pass all files in the current directory that match the globs to DNF. To make sure the glob expressions are passed to DNF as intended, either:

  • escape the wildcard characters by preceding them with a backslash character; or,

  • double-quote or single-quote the entire glob expression.

DNF searches only package names when using glob expressions. To search for a version of a package, include a dash and part of the version number as follows:

~]# dnf list kernel*-4*
Last metadata expiration check performed 2:46:09 ago on Thu May 14 23:23:51 2015.
Installed Packages
kernel.x86_64                        4.0.0-1.fc22                     @System
kernel.x86_64                        4.0.2-300.fc22                   @System
kernel-core.x86_64                   4.0.0-1.fc22                     @System
kernel-core.x86_64                   4.0.2-300.fc22                   @System
[output truncated]
dnf list glob_expression

Lists information on installed and available packages matching all glob expressions.

Example 1. Listing all ABRT addons and plug-ins using glob expressions

Packages with various ABRT addons and plug-ins either begin with "abrt-addon-", or "abrt-plugin-". To list these packages, type the following at a shell prompt:

~]# dnf list abrt-addon\* abrt-plugin\*
Last metadata expiration check performed 0:14:36 ago on Mon May 25 23:38:13 2015.
Installed Packages
abrt-addon-ccpp.x86_64                  2.5.1-2.fc22               @System
abrt-addon-coredump-helper.x86_64       2.5.1-2.fc22               @System
abrt-addon-kerneloops.x86_64            2.5.1-2.fc22               @System
abrt-addon-pstoreoops.x86_64            2.5.1-2.fc22               @System
abrt-addon-python.x86_64                2.5.1-2.fc22               @System
abrt-addon-python3.x86_64               2.5.1-2.fc22               @System
abrt-addon-vmcore.x86_64                2.5.1-2.fc22               @System
abrt-addon-xorg.x86_64                  2.5.1-2.fc22               @System
abrt-plugin-bodhi.x86_64                2.5.1-2.fc22               @System
Available Packages
abrt-addon-upload-watch.x86_64          2.5.1-2.fc22               fedora
dnf list all

Lists all installed and available packages.

Example 2. Listing all installed and available packages
~]# dnf list all
Last metadata expiration check performed 0:21:11 ago on Mon May 25 23:38:13 2015.
Installed Packages
NetworkManager.x86_64                   1:1.0.2-1.fc22             @System
NetworkManager-libnm.x86_64             1:1.0.2-1.fc22             @System
PackageKit.x86_64                       1.0.6-4.fc22               @System
PackageKit-glib.x86_64                  1.0.6-4.fc22               @System
aajohan-comfortaa-fonts.noarch          2.004-4.fc22               @System
abrt.x86_64                             2.5.1-2.fc22               @System
[output truncated]
dnf list installed

Lists all packages installed on your system. The rightmost column in the output lists the repository from which the package was retrieved.

Example 3. Listing installed packages using a double-quoted glob expression

To list all installed packages that begin with "krb" followed by exactly one character and a hyphen, type:

~]# dnf list installed "krb?-*"
Last metadata expiration check performed 0:34:45 ago on Mon May 25 23:38:13 2015.
Installed Packages
krb5-libs.x86_64                        1.13.1-3.fc22              @System
krb5-workstation.x86_64                 1.13.1-3.fc22              @System
dnf list available

Lists all available packages in all enabled repositories.

Example 4. Listing available packages using a single glob expression with escaped wildcard characters

To list all available packages with names that contain "gstreamer" and then "plugin", run the following command:

~]# dnf list available gstreamer\*plugin\*
Last metadata expiration check performed 0:42:15 ago on Mon May 25 23:38:13 2015.
Available Packages
gstreamer-plugin-crystalhd.i686              3.10.0-8.fc22          fedora
gstreamer-plugin-crystalhd.x86_64            3.10.0-8.fc22          fedora
gstreamer-plugins-bad-free.i686              0.10.23-24.fc22        fedora
gstreamer-plugins-bad-free.x86_64            0.10.23-24.fc22        fedora
gstreamer-plugins-bad-free-devel.i686        0.10.23-24.fc22        fedora
gstreamer-plugins-bad-free-devel.x86_64      0.10.23-24.fc22        fedora
 [output truncated]
dnf group list

Lists all package groups.

Example 5. Listing all package groups
~]# dnf group list
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Group Process
Installed Groups:
   Administration Tools
   Design Suite
   Dial-up Networking Support
   Fonts
   GNOME Desktop Environment
[output truncated]
dnf repolist

Lists the repository ID, name, and number of packages it provides for each enabled repository.

Example 6. Listing enabled repositories
~]# dnf repolist
Last metadata expiration check performed 0:48:29 ago on Mon May 25 23:38:13 2015.
repo id                             repo name                           status
*fedora                             Fedora 22 - x86_64                  44,762
*updates                            Fedora 22 - x86_64 - Updates             0
dnf repository-packages repo_id list

Lists the packages from the specified repository.

Example 7. Listing packages from a single repository
~]# dnf repository-packages fedora list [option]
Last metadata expiration check performed 1:38:25 ago on Wed May 20 22:16:16 2015.
Installed Packages
PackageKit.x86_64                        1.0.6-3.fc22                    @System
PackageKit-glib.x86_64                   1.0.6-3.fc22                    @System
aajohan-comfortaa-fonts.noarch           2.004-4.fc22                    @System
[output truncated]

The default action is to list all packages available and installed from the repository specified. Add the available or installed option to list only those packages available or installed from the specified repository.

Displaying Package Information

To display information about one or more packages, use a command as follows:

dnf info package_name

For example, to display information about the abrt package, type:

~]# dnf info abrt
Last metadata expiration check: 1:09:44 ago on Tue May 31 06:51:51 2016.
Installed Packages
Name        : abrt
Arch        : x86_64
Epoch       : 0
Version     : 2.8.1
Release     : 1.fc24
Size        : 2.2 M
Repo        : @System
From repo   : updates-testing
Summary     : Automatic bug detection and reporting tool
URL         : https://abrt.readthedocs.org/
License     : GPLv2+
Description : abrt is a tool to help users to detect defects in applications and
            : to create a bug report with all information needed by maintainer to fix it.
            : It uses plugin system to extend its functionality.

The dnf info package_name command is similar to the rpm -q --info package_name command, but provides as additional information the name of the DNF repository the RPM package was installed from (look for the From repo: line in the output). The dnf info command shows only the newest available package if there is a newer version available than the one installed. The dnf repoquery command can show all installed and available packages.

To display information about all available packages, both installed and available from a repository, use a command as follows:

dnf repoquery package_name --info

For example, to display information about the abrt package, type:

~]# dnf repoquery abrt  --info
Last metadata expiration check: 1:01:44 ago on Tue May 31 06:51:51 2016.
Name        : abrt
Version     : 2.8.1
Release     : 1.fc24
Architecture: x86_64
Size        : 2318452
License     : GPLv2+
Source RPM  : abrt-2.8.1-1.fc24.src.rpm
Build Date  : 2016-05-25 08:54
Packager    : Fedora Project
URL         : https://abrt.readthedocs.org/
Summary     : Automatic bug detection and reporting tool
Description :
abrt is a tool to help users to detect defects in applications and
to create a bug report with all information needed by maintainer to fix it.
It uses plugin system to extend its functionality.

See the dnf repoquery usage statement for more options:

~]$ dnf repoquery -h
usage: dnf [options] COMMAND
output truncated

Installing Packages

DNF allows you to install both a single package and multiple packages, as well as a package group of your choice.

Installing Individual Packages

To install a single package and all of its non-installed dependencies, enter a command in the following form:

dnf install package_name

You can also install multiple packages simultaneously by appending their names as arguments:

dnf install package_name package_name

If you are installing packages on a multilib system, such as an AMD64 or Intel64 machine, you can specify the architecture of the package, as long as it is available in an enabled repository, by appending .arch to the package name. For example, to install the sqlite2 package for i586, type:

~]# dnf install sqlite2.i586

You can use glob expressions to quickly install multiple similarly-named packages:

~]# dnf install audacious-plugins-\*

In addition to package names and glob expressions, you can also provide file names to dnf install. If you know the name of the binary you want to install, but not its package name, you can give dnf install the path name:

~]# dnf install /usr/sbin/named

dnf then searches through its package lists, finds the package which provides /usr/sbin/named, if any, and prompts you as to whether you want to install it.

Finding which package owns a file

If you know you want to install the package that contains the named binary, but you do not know in which /usr/bin or /usr/sbin directory the file is installed, use the dnf provides command with a glob expression:

~]# dnf provides "*bin/named"
Using metadata from Thu Apr 16 13:41:45 2015 (4:23:50 hours old)
bind-32:9.10.2-1.fc22.x86_64 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
Repo        : @System

dnf provides "*/file_name" will find all the packages that contain file_name.

Installing a Package Group

A package group is similar to a package: it is not useful by itself, but installing one pulls a group of dependent packages that serve a common purpose. A package group has a name and a groupid (GID). The dnf group list -v command lists the names of all package groups, and, next to each of them, their groupid in parentheses. The groupid is always the term in the last pair of parentheses, such as kde-desktop-environment in the following example:

~]# dnf -v group list kde\*
cachedir: /var/cache/dnf/x86_64/22
Loaded plugins: builddep, config-manager, copr, playground, debuginfo-install, download, generate_completion_cache, kickstart, needs-restarting, noroot, protected_packages, Query, reposync, langpacks
initialized Langpacks plugin
DNF version: 0.6.5
repo: using cache for: fedora
not found deltainfo for: Fedora 22 - x86_64
not found updateinfo for: Fedora 22 - x86_64
repo: using cache for: updates-testing
repo: using cache for: updates
not found updateinfo for: Fedora 22 - x86_64 - Updates
Using metadata from Thu Apr 16 13:41:45 2015 (4:37:51 hours old)
Available environment groups:
   KDE Plasma Workspaces (kde-desktop-environment)

You can install a package group by passing its full group name (without the groupid part) to group install:

dnf group install group_name

Multi-word names must be quoted.

You can also install by groupid:

dnf group install groupid

You can even pass the groupid, or quoted name, to the install command if you prepend it with an @-symbol (which tells dnf that you want to perform a group install):

dnf install @group

For example, the following are alternative but equivalent ways of installing the KDE Plasma Workspaces group:

~]# dnf group install "KDE Plasma Workspaces"
~]# dnf group install kde-desktop-environment
~]# dnf install @kde-desktop-environment

Removing Packages

Similarly to package installation, DNF allows you to uninstall (remove in RPM and DNF terminology) both individual packages and a package group.

Removing Individual Packages

To uninstall a particular package, as well as any packages that depend on it, run the following command as root:

dnf remove package_name

As when you install multiple packages, you can remove several at once by adding more package names to the command. For example, to remove totem, rhythmbox, and sound-juicer, type the following at a shell prompt:

~]# dnf remove totem rhythmbox sound-juicer

Similar to install, remove can take these arguments:

  • package names

  • glob expressions

  • file lists

  • package provides

Removing a package when other packages depend on it

DNF is not able to remove a package without also removing packages which depend on it. This type of operation can only be performed by RPM, is not advised, and can potentially leave your system in a non-functioning state or cause applications to misbehave and terminate unexpectedly. For further information, refer to Uninstalling Packages in the RPM chapter.

Removing a Package Group

You can remove a package group using syntax congruent with the install syntax:

dnf group remove group
dnf remove @group

The following are alternative but equivalent ways of removing the KDE Plasma Workspaces group:

~]# dnf group remove "KDE Plasma Workspaces"
~]# dnf group remove kde-desktop-environment
~]# dnf remove @kde-desktop-environment

Working with Transaction History

The dnf history command allows users to review information about a timeline of DNF transactions, the dates and times on when they occurred, the number of packages affected, whether transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions.

Listing Transactions

To display a list of all transactions, as root, either run dnf history with no additional arguments, or enter the following command:

dnf history list

To display only transactions in a given range, use the command in the following form:

dnf history list start_id..end_id

You can also list only transactions regarding a particular package or packages. To do so, use the command with a package name or a glob expression:

dnf history list glob_expression

For example, the list of first five transactions may look as follows:

~]# dnf history list 1..4
Using metadata from Thu Apr 16 13:41:45 2015 (5:47:31 hours old)
ID     | Login user               | Date a | Action | Altere
-------------------------------------------------------------------------------
     4 | root <root>              | 2015-04-16 18:35 | Erase          |    1
     3 | root <root>              | 2015-04-16 18:34 | Install        |    1
     2 | root <root>              | 2015-04-16 17:53 | Install        |    1
     1 | System <unset>           | 2015-04-16 14:14 | Install        |  668 E

The dnf history list command produces tabular output with each row consisting of the following columns:

  • ID — an integer value that identifies a particular transaction.

  • Login user — the name of the user whose login session was used to initiate a transaction. This information is typically presented in the Full Name <username> form, however sometimes the command used to perform the transaction is displayed. For transactions that were not issued by a user (such as an automatic system update), System <unset> is used instead.

  • Date and time — the date and time when a transaction was issued.

  • Action(s) — a list of actions that were performed during a transaction as described in Possible values of the Action(s) field.

  • Altered — the number of packages that were affected by a transaction, possibly followed by additional information.

Table 1. Possible values of the Action(s) field

[options="header"]

Action

Abbreviation

Description

Downgrade

D

At least one package has been downgraded to an older version.

Erase

E

At least one package has been removed.

Install

I

At least one new package has been installed.

Obsoleting

O

At least one package has been marked as obsolete.

Reinstall

R

At least one package has been reinstalled.

Update

U

At least one package has been updated to a newer version.

Reverting and Repeating Transactions

Apart from reviewing the transaction history, the dnf history command provides means to revert or repeat a selected transaction. To revert a transaction, type the following at a shell prompt as root:

dnf history undo id

To repeat a particular transaction, as root, run the following command:

dnf history redo id

Both commands also accept the last keyword to undo or repeat the latest transaction.

Note that both dnf history undo and dnf history redo commands merely revert or repeat the steps that were performed during a transaction, and will fail if the required packages are not available. For example, if the transaction installed a new package, the dnf history undo command will uninstall it and also attempt to downgrade all updated packages to their previous version, but the command will fail if the required packages are not available.

Configuring DNF and DNF Repositories

The configuration file for DNF and related utilities is located at /etc/dnf/dnf.conf. This file contains one mandatory [main] section, which allows you to set DNF options that have global effect, and may also contain one or more [repository] sections, which allow you to set repository-specific options. However, it is recommended to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/ directory. The values you define in individual [repository] sections of the /etc/dnf/dnf.conf file override values set in the [main] section.

This section shows you how to:

  • set global DNF options by editing the [main] section of the /etc/dnf/dnf.conf configuration file;

  • set options for individual repositories by editing the [repository] sections in /etc/dnf/dnf.conf and .repo files in the /etc/yum.repos.d/ directory;

  • use DNF variables in /etc/dnf/dnf.conf and files in the /etc/yum.repos.d/ directory so that dynamic version and architecture values are handled correctly;

  • add, enable, and disable DNF repositories on the command line; and,

  • set up your own custom DNF repository.

Setting [main] Options

options] The /etc/dnf/dnf.conf configuration file contains exactly one [main] section, and while some of the key-value pairs in this section affect how dnf operates, others affect how DNF treats repositories.

You can add many additional options under the [main] section heading in /etc/dnf/dnf.conf.

A sample /etc/dnf/dnf.conf configuration file can look like this:

[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=true

The following are the most commonly-used options in the [main] section:

debuglevel=value

…where value is an integer between 0 and 10. Setting a higher debuglevel value causes dnf to display more detailed debugging output. debuglevel=0 disables debugging output, and debuglevel=2 is the default.

exclude=package_name more_package_names

This option allows you to exclude packages by keyword during installation and updates. Listing multiple packages for exclusion can be accomplished by quoting a space-delimited list of packages. Shell globs using wildcards (for example, * and ?) are allowed.

gpgcheck=value

…where value is one of:

0 — Disable GPG signature-checking on packages in all repositories, including local package installation.

1 — Enable GPG signature-checking on all packages in all repositories, including local package installation. gpgcheck=1 is the default, and thus all packages' signatures are checked.

If this option is set in the [main] section of the /etc/dnf/dnf.conf file, it sets the GPG-checking rule for all repositories. However, you can also set gpgcheck=value for individual repositories instead; you can enable GPG-checking on one repository while disabling it on another. Setting gpgcheck=value for an individual repository in its corresponding .repo file overrides the default if it is present in /etc/dnf/dnf.conf.

For more information on GPG signature-checking, refer to Checking Package Signatures.

installonlypkgs=space separated list of packages

Here you can provide a space-separated list of packages which dnf can install, but will never update. See the dnf.conf(5) manual page for the list of packages which are install-only by default.

If you add the installonlypkgs directive to /etc/dnf/dnf.conf, you should ensure that you list all of the packages that should be install-only, including any of those listed under the installonlypkgs section of dnf.conf(5). In particular, kernel packages should always be listed in installonlypkgs (as they are by default), and installonly_limit should always be set to a value greater than 2 so that a backup kernel is always available in case the default one fails to boot.

installonly_limit=value

…where value is an integer representing the maximum number of versions that can be installed simultaneously for any single package listed in the installonlypkgs directive.

The defaults for the installonlypkgs directive include several different kernel packages, so be aware that changing the value of installonly_limit will also affect the maximum number of installed versions of any single kernel package. The default value listed in /etc/dnf/dnf.conf is installonly_limit=3, and it is not recommended to decrease this value, particularly below 2.

keepcache=value

…where value is one of:

0 — Do not retain the cache of headers and packages after a successful installation. This is the default.

1 — Retain the cache after a successful installation.

For a complete list of available [main] options, refer to the [MAIN] OPTIONS section of the dnf.conf(5) manual page.

Setting [repository] Options

options] The [repository] sections, where repository is a unique repository ID such as my_personal_repo (spaces are not permitted), allow you to define individual DNF repositories.

The following is a bare-minimum example of the form a [repository] section takes:

[repository]
name=repository_name
baseurl=repository_url

Every [repository] section must contain the following directives:

name=repository_name

…where repository_name is a human-readable string describing the repository.

parameter=repository_url

…where parameter is one of the following: baseurl, metalink, or mirrorlist;

…where repository_url is a URL to a directory containing a repodata directory of a repository, a metalink file, or a mirror list file.

  • If the repository is available over HTTP, use: http://path/to/repo

  • If the repository is available over FTP, use: ftp://path/to/repo

  • If the repository is local to the machine, use: file:///path/to/local/repo

  • If a specific online repository requires basic HTTP authentication, you can specify your user name and password by prepending it to the URL as username:password@link. For example, if a repository on http://www.example.com/repo/ requires a username of "user" and a password of "password", then the baseurl link could be specified as http://user:password@www.example.com/repo/.

    Usually this URL is an HTTP link, such as:

    baseurl=http://path/to/repo/releases/$releasever/server/$basearch/os/

    Note that DNF always expands the $releasever, $arch, and $basearch variables in URLs. For more information about DNF variables, refer to Using DNF Variables.

To configure the default set of repositories, use the enabled option as follows:

enabled=value

…where value is one of:

0 — Do not include this repository as a package source when performing updates and installs.

1 — Include this repository as a package source.

Turning repositories on and off can also be performed by passing either the --set-enabled repo_name or --set-disabled repo_name option to the dnf command, or through the Add/Remove Software window of the PackageKit utility.

Many more [repository] options exist. For a complete list, refer to the [repository] OPTIONS section of the dnf.conf(5) manual page.

Using DNF Variables

Variables can be used only in the appropriate sections of the DNF configuration files, namely the /etc/dnf/dnf.conf file and all .repo files in the /etc/yum.repos.d/ directory. Repository variables include:

$releasever

Refers to the release version of operating system which DNF derives from information available in RPMDB.

$arch

Refers to the system’s CPU architecture. Valid values for $arch include: i586, i686 and x86_64.

$basearch

Refers to the base architecture of the system. For example, i686 and i586 machines both have a base architecture of i386, and AMD64 and Intel64 machines have a base architecture of x86_64.

Viewing the Current Configuration

To list all configuration options and their corresponding values, and the repositories, execute the dnf config-manager command with the --dump option:

~]$ dnf config-manager --dump
============================= main ======================================
[main]
alwaysprompt = True
assumeno = False
assumeyes = False
bandwidth = 0
best = False
bugtracker_url = https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=dnf
cachedir = /var/cache/dnf/x86_64/22
[output truncated]

Adding, Enabling, and Disabling a DNF Repository

Setting [repository Options] describes various options you can use to define a DNF repository. This section explains how to add, enable, and disable a repository by using the dnf config-manager command.

Adding a DNF Repository

To define a new repository, you can either add a [repository] section to the /etc/dnf/dnf.conf file, or to a .repo file in the /etc/yum.repos.d/ directory. All files with the .repo file extension in this directory are read by DNF, and it is recommended to define your repositories here instead of in /etc/dnf/dnf.conf.

DNF repositories commonly provide their own .repo file. To add such a repository to your system and enable it, run the following command as root:

dnf config-manager --add-repo repository_url

…where repository_url is a link to the .repo file.

Example 8. Adding example.repo

To add a repository located at http://www.example.com/example.repo, type the following at a shell prompt:

~]# dnf config-manager --add-repo http://www.example.com/example.repo
adding repo from: http://www.example.com/example.repo
Enabling a DNF Repository

To enable a particular repository or repositories, type the following at a shell prompt as root:

dnf config-manager --set-enabled repository

…where repository is the unique repository ID. To display the current configuration, add the --dump option.

Disabling a DNF Repository

To disable a DNF repository, run the following command as root:

dnf config-manager --set-disabled repository

…where repository is the unique repository ID. To display the current configuration, add the --dump option.

Ek Kaynaklar

.Kurulu Belgeler

  • dnf(8) — The DNF command reference manual page.

  • dnf.conf(8) — DNF Configuration Reference manual page.

Çevrim İçi Belgelendirme
https://dnf.readthedocs.org/en/latest/index.html

The DNF wiki contains more documentation.