我有一台未连接到互联网的机器。我还想yum
不时地执行一些命令。
YUM 确实喜欢每隔一段时间更新镜像列表,从而导致如下错误:
无法从 yum-dump.py检索镜像列表http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os错误是'!请检查您的 yum 配置。
是否有参数在yum.conf
或其他地方使 yum 停止更新镜像列表?
小智 7
您可以-C
在yum
. 根据 YUM 的手册页:
-C, --cacheonly
Tells yum to run entirely from system cache - does not
download or update any headers unless it has to to perform the
requested action. If you’re using this as a user yum will not
use the tempcache for the user but will only use the system cache in
the system cachedir.
Run Code Online (Sandbox Code Playgroud)
也请检查这个问题
我相信这种行为是由这个参数控制的:
元数据_过期
元数据将过期的持续时间(以秒为单位)。因此,如果当前下载的元数据比当前的元数据少几秒钟,那么 yum 将不会更新存储库元数据。如果您认为 yum 没有按您希望的频率下载更新信息,请减小此参数的值。您还可以将秒的默认格式更改为天、小时或分钟,将 d、h 或 m 添加到指定值。默认为 1.5 小时,用于每小时运行 yum-updatesd。您还可以使用 never 一词表示元数据永远不会过期。
因此,我会尝试使用 0d、-1,或者将值设置为非常长的值,即 1000d(1000 天)。
metadata_expire=99999999
Run Code Online (Sandbox Code Playgroud)
当您可以访问互联网时,您可以更新缓存:
$ sudo yum makecache
Run Code Online (Sandbox Code Playgroud)