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ü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:
-
python.x86_64
— yeni python paketini indirip kurabilirsiniz. -
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. -
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 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.
Paketleri Listeleme
dnf list ve ilgili komutlar paketler, paket grupları ve depolar hakkında bilgiler sağlar.
DNF’nin tüm listeleme komutları, argüman olarak bir veya daha fazla glob ifadesi ekleyerek sonuçları filtrelemenize olanak tanır. Glob ifadeleri, bir veya daha fazla * (herhangi bir karakterle birden çok kez eşleşir) ve ? (herhangi bir karakterle eşleşir) joker karakterlerini içeren normal karakter dizgeleridir.
Sonuçları glob ifadeleriyle filtreleme
dnf komutuna argüman olarak geçirirken glob ifadelerini kaçırmaya dikkat edin, aksi takdirde Bash kabuğu bu ifadeleri yol adı genişletmeleri olarak yorumlayacak ve geçerli dizindeki globlarla eşleşen tüm dosyaları DNF’ye iletebilecektir. Glob ifadelerinin amaçlandığı gibi DNF’ye iletildiğinden emin olmak için:
DNF, glob ifadeleri kullanırken yalnızca paket adlarını arar. Bir paketin sürümünü aramak için, bir tire ve sürüm numarasının bir kısmını aşağıdaki gibi ekleyin: ~]# dnf search 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 [çıktı yarıda kesildi] Bu yöntemlerin her ikisinin de örnek kullanımı için Tüm ABRT eklerini ve eklentilerini glob ifadeleri kullanarak listeleme ve Kullanılabilir paketleri kaçırılan joker karakterlerle tek bir glob ifadesi kullanarak listeleme kısımlarına bakın. |
- dnf list glob_ifadesi…
-
Tüm glob ifadeleriyle eşleşen kurulu ve kullanılabilir paketlerle ilgili bilgileri listeler.
Örnek 1. Tüm ABRT eklerini ve eklentilerini glob ifadeleri kullanarak listelemeÇeşitli ABRT ekleri ve eklentileri olan paketler ya "abrt-addon-" veya "abrt-plugin-" ile başlar. Bu paketleri listelemek için bir kabuk isteminde aşağıdakini yazın:
~]# 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
-
Tüm kurulu ve kullanılabilir paketleri listeler.
Örnek 2. Tüm kurulu ve kullanılabilir paketleri listeleme~]# 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 [çıktı yarıda kesildi]
- dnf list installed
-
Sisteminizde kurulu tüm paketleri listeler. Çıktıdaki en sağdaki sütun, paketin alındığı depoyu listeler.
Örnek 3. Kurulu paketleri çift tırnak içindeki bir glob ifadesi kullanarak listeleme"krb" ile başlayan ve arkasından tam olarak bir karakter ve bir tire gelen tüm kurulu paketleri listelemek için şunu yazın:
~]# 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
-
Tüm etkin depolardaki kullanılabilir tüm paketleri listeler.
Örnek 4. Kullanılabilir paketleri kaçırılan joker karakterlerle tek bir glob ifadesi kullanarak listelemeAdında "gstreamer" ve ardından "plugin" bulunan kullanılabilir tüm paketleri listelemek için aşağıdaki komutu çalıştırın:
~]# 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 [çıktı yarıda kesildi]
- dnf group list
-
Tüm paket gruplarını listeler.
Örnek 5. Tüm paket gruplarını listeleme~]# 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 [çıktı yarıda kesildi]
- dnf repolist
-
Her etkin depo için depo kimliğini, adını ve sağladığı paket sayısını listeler.
Örnek 6. Etkinleştirilen depoları listeleme~]# 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 depo_kimliği list
-
Belirtilen depodaki paketleri listeler.
Örnek 7. Tek bir depodan paketleri listeleme~]# 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 [çıktı yarıda kesildi]
Öntanımlı eylem, belirtilen depodan tüm kullanılabilir ve kurulu paketleri listelemektir. Belirtilen depodan yalnızca kullanılabilir veya kurulu paketleri listelemek için
available
veyainstalled
seçeneğini ekleyin.
Paket Bilgilerini Görüntüleme
Bir veya daha fazla paket hakkındaki bilgileri görüntülemek için aşağıdaki gibi bir komut kullanın:
dnf info paket_adı…
Örneğin, abrt paketiyle ilgili bilgileri görüntülemek için şunu yazın:
~]# 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.
dnf info paket_adı komutu, rpm -q --info paket_adı komutuna benzerdir, ancak ek bilgi olarak RPM paketinin kurulduğu DNF deposunu belirtir (çıktıda From repo:
satırına bakın). dnf info komutu, kurulu olandan daha yeni bir sürüm varsa yalnızca kullanılabilir en yeni paketi gösterir. dnf repoquery komutu tüm kurulu ve kullanılabilir paketleri gösterebilir.
Hem kurulu hem de bir depodan kullanılabilir tüm paketler hakkındaki bilgileri görüntülemek için aşağıdaki gibi bir komut kullanın:
dnf repoquery paket_adı --info
Örneğin, abrt paketiyle ilgili bilgileri görüntülemek için şunu yazın:
~]# 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.
Daha fazla seçenek için dnf repoquery kullanım ifadesine bakın:
~]$ dnf repoquery -h
usage: dnf [options] COMMAND
çıktı yarıda kesildi
Installing Packages
DNF allows you to install both a single package and multiple packages, as well as a package group of your choice.
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 ~]# 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. |
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.
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. |
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.
To display a list of all transactions, as root
, either run dnf history with no additional arguments, or enter the following command:
dnfhistory
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 theFull 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.
[options="header"] |
Action |
Abbreviation |
Description |
|
|
At least one package has been downgraded to an older version. |
|
|
At least one package has been removed. |
|
|
At least one new package has been installed. |
|
|
At least one package has been marked as obsolete. |
|
|
At least one package has been reinstalled. |
|
|
At least one package has been updated to a newer version. |
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
:
dnfhistory
undo
id
To repeat a particular transaction, as root
, run the following command:
dnfhistory
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
and10
. Setting a higherdebuglevel
value causes dnf to display more detailed debugging output.debuglevel=0
disables debugging output, anddebuglevel=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 setgpgcheck=value
for individual repositories instead; you can enable GPG-checking on one repository while disabling it on another. Settinggpgcheck=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 theinstallonlypkgs
section of dnf.conf(5). In particular, kernel packages should always be listed ininstallonlypkgs
(as they are by default), andinstallonly_limit
should always be set to a value greater than2
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 ofinstallonly_limit
will also affect the maximum number of installed versions of any single kernel package. The default value listed in/etc/dnf/dnf.conf
isinstallonly_limit=3
, and it is not recommended to decrease this value, particularly below2
. 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
, ormirrorlist
;…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 thebaseurl
link could be specified ashttp://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 theAdd/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
andx86_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 ofx86_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.
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.
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
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.
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.
- http://dnf.readthedocs.org/en/latest/index.html
-
The DNF wiki contains more documentation.
Want to help? Learn how to contribute to Fedora Docs ›