cdrom 存储库无法 makecache

cdrom 存储库无法 makecache

我的 CentOS 7.2:

我将虚拟 CDROM ( /dev/sr0) 安装在我的/mnt/cdrom

我使用mount命令检查我的安装列表,其中包含信息:

...
/dev/sr0 on /mnt/cdrom type iso9660 (ro,relatime)
...

但是当我ls /mnt/cdrom,里面有回购数据:

[root@localhost cdrom]# ls
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

我创建了一个本地存储库:

vi /etc/yum.repos.d/redhat_cdrom.repo

在其中添加我的以下配置:

[redhat_cdrom]
name=red hat cdrom yum source
baseurl=file:///mnt/cdrom/
gpgcheck=0
enable=1

但是当我缓存 yum 存储库时:

[root@localhost cdrom]# yum clean all
[root@localhost cdrom]# yum makecache


Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

答案1

如果您只想使用使用 DVD 创建的此存储库,则可以禁用所有其他存储库并仅使用提供的存储库

# yum --disablerepo="*" --enablerepo="redhat_cdrom" makecache

但是,如果您希望创建所有可用在线存储库的缓存,那么您将需要有效的互联网连接。从错误片段来看,您的节点似乎没有互联网连接,或者可能位于代理后面,无法访问 CentOS 存储库服务器。

要在成功安装后保留包的缓存,请将以下文本添加[main]/etc/yum.conf.

keepcache = 1

启用缓存后,每个 yum 操作都可以从配置的存储库下载包数据。

要下载当前启用的 yum 存储库的所有元数据并使其可用,请键入:

# yum makecache

要在没有网络连接的情况下执行 yum 命令,请添加-C命令行选项。使用此选项,yum 将继续执行而不检查任何网络存储库,并且仅使用缓存的文件。在此模式下,yum 只能安装先前操作已下载并缓存的软件包。

# yum -C list glibc

从 ”如何在没有互联网连接的情况下使用缓存在本地使用 yum?

相关内容