Fix “Error: No group data available for configured repositories“ in YUM

Sometimes on your RHEL-like system you may encounter the following error:

$ sudo yum grouplist
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
You can use up2date --register to register.
ULN support will be disabled.
Setting up Group Process
Error: No group data available for configured repositories

This may happen when you're hosting your own YUM package repository and the group metadata in the repository is missing. This error is easily fixable on the YUM repo with createrepo command.

Log onto your repository server and go to your repo directory that contains repodata directory. Then run createrepo -g:

$ cd /repo/CentOS/6/os/x86_64
$ createrepo -g repodata/comps.xml .

This will create the groups listing for your repository.

If you do not have the repodata/comps.xml file, try looking at the mirror that you're mirroring from. It should have this file. Sometimes it may not be copied correctly, especially if you use reposync command to sync your repos.

Check the createrepo manpages for more goodness.

Environment

  • Red Hat Enterprise Linux 5 and later
  • Installation of packages from a custom yum repository

Issue

  • How to define a package group and add individual packages to it?
  • One use case is to create rpm groups for third party packages to ease installation and generate cleaner kickstart files.

Resolution

Note: Creating custom yum repository groups is outside the scope of support and support regarding this information may be limited. This article is provided as a courtesy to our customers.

  • The group data is stored in a file called "comps.xml"  under the repodata folder.

  • First create the custom repository :

1. Create the RPM repository, and copy all the RPMs you want to use into that directory:

Raw

# mkdir -p /usr/share/repository
# cp *.rpm  /usr/share/repository

2. Run createrepo command to create the repodata folder :

Raw

# cd /usr/share/repository
# createrepo .

Note: The createrepo package needs to be installed on the system

  • Now to create the Groups file :

3. Create the following comps.xml file under repodata folder :

Raw

<comps>
<!--  <meta> -->
<!-- Meta information will go here eventually -->
<!--  </meta> -->
  <group>
    <id>mygroup</id>
    <name>MyGroup</name>
    <default>true</default>
    <description>Description of group goes here</description>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="mandatory">package1</packagereq>
      <packagereq type="default">package2</packagereq>
      <packagereq type="optional">pacakge3</packagereq>
    </packagelist>
  </group>
</comps>

Each group has an id, user visibility value, name, description, and package list. In the package list, there are three types package:

  • mandatory: the packages marked as mandatory are always installed if the group is selected.
  • default: the packages marked default are selected by default if the group is selected.
  • optional: the packages marked optional must be specifically selected even if the group is selected.

4. Rerun createrepo so that group assignments are taken into account :

Raw

# createrepo -g repodata/comps.xml .

5.  Create the file /etc/yum.repos.d/file.repo as follows:

Raw

# cat /etc/yum.repos.d/file.repo
[myrepo]
name=My Repo
baseurl=file:///usr/share/repository
enabled=1

6. To test :

Raw

#yum clean all
# yum --noplugins groupinfo mygroup

猜你喜欢

转载自blog.csdn.net/weixin_39833509/article/details/120171119
今日推荐