2

I my CentOS 7.2:

I mount my virtual cdrom (/dev/sr0) on my /mnt/cdrom:

I use mount command check my mount list there has the information:

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

But when I ls /mnt/cdrom, there have the repo data in it:

[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

I created a local repo:

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

add my below configuration in it:

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

but when I make cache the yum repo:

[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
    Do you have an internet connection? You are getting this error because 'base/7/x86_64' repo is apparently configured to use a remote repository only accessible via the internet. – fpmurphy Jul 23 at 3:35
0

If you only wish to use this repo which you have created using the DVD then you can disable all other repos and only use the provided repo

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

But if you wish to create a cache of all the available online repositories then you would need an active internet connection. From the error snippet it looks like your node does not has internet connection or is may be behind proxy and is unable to reach CentOS repo server.

To retain the cache of packages after a successful installation, add the following text to the [main] section of /etc/yum.conf.

keepcache = 1

Once you enabled caching, every yum operation may download package data from the configured repositories.

To download and make usable all the metadata for the currently enabled yum repositories, type:

# yum makecache

To carry out a yum command without a network connection, add the -C command-line option. With this option, yum proceeds without checking any network repositories, and uses only cached files. In this mode, yum may only install packages that have been downloaded and cached by a previous operation.

# yum -C list glibc

From "How to use yum locally without internet connection using cache?"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.