Fedora 22 dnf 僅使用緩存

Fedora 22 dnf 僅使用緩存

在 Fedora 22 上運行,任何時候我想安裝軟體包,例如:

$ sudo dnf install lshw
RPM Fusion for Fedora 22 - Free - Updates                                855 kB/s | 224 kB     00:00    
RPM Fusion for Fedora 22 - Nonfree - Updates                             504 kB/s |  52 kB     00:00
...    

dnf 從儲存庫下載更新。可以使用此開關來停止它:

-C, --cacheonly       run entirely from system cache, don't update cache

可以以某種方式將其設為預設選項嗎?即我想根據需要通過dnf check-update和手動更新快取dnf upgrade

這是我到目前為止所擁有的:

  • 我嘗試更改看起來與元資料/快取更新相關的選項http://dnf.readthedocs.org/en/latest/conf_ref.html- metadata_expire=never,metadata_timer_sync=0
  • 停用 dnf-makecache 計時器 ( systemctl disable dnf-makecache.service)
  • 我沒有dnf-automatic安裝

我找不到其他有幫助的東西。有任何想法嗎?

答案1

大約2022年,有一個等效的配置項: /etc/dnf/dnf.conf 參考:https://dnf.readthedocs.io/en/latest/conf_ref.html#main-options cacheonly: boolean If set to True DNF will run entirely from system cache, will not update the cache and will use it even in case it is expired. Default is False.

dnf 設定檔所需的確切格式是: cacheonly=True

請注意,這也會導致dnf install packagename失敗,因為它不會嘗試下載快取中尚未存在的任何 rpm 文件,即使快取的元資料告訴它需要下載的確切文件。

相關內容