每次运行 dnf 命令时 Fedora 都会更新

发布于 2025-01-19 12:52:11 字数 1559 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

场罚期间 2025-01-26 12:52:11

您可以使用dnf -C从缓存运行,这将防止这种情况发生——或者在DNF配置文件中设置cacheonly。您还可以将 metadata_expire 设置为更高的值 - 默认值为 48 小时,或者当 dnf 配置或存储库文件更改时(选中 check_config_file_age 将其关闭)。

这些选项在 man dnf.conf 中有详细说明。

You can use dnf -C to run from the cache, which will prevent this — or set cacheonly in the DNF configuration file. You can also set metadata_expire to a higher value — the default is 48 hours, or when a dnf configuation or repo file changes (check check_config_file_age to turn this off).

These options are detailed in man dnf.conf.

反话 2025-01-26 12:52:11

如果您在这里遇到相同的问题,那么解决方案很容易,基本上对于大多数基于RedHat的发行版,所提取的元数据都将到期约一个小时。您可以简单地通过延长所有回购获取的元数据持续存在的时期来解决此问题,而不是针对生产环境的推荐,而是本地设置可以节省一天的时间。

只需运行命令

sed -i "s/=1h/=24h/g" /etc/yum.repos.d/reponame.repo

即可尝试根据分发来调整回购文件上的时间,可能会有所不同。

If you're here with the same problem the solution is easy, basically for most RedHat based distros the fetched metadata is set to expire for about a hour. You can simply solve this by extending the period that the metadata for all repo fetched remains persistent, its not recomended for prod environments but for a local setup may save the day.

Just run the command

sed -i "s/=1h/=24h/g" /etc/yum.repos.d/reponame.repo

Try to tweak out the time on the repo file, may vary based on distribution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文