CentOS Local Repo with Grouping




This post will cover howto configure local yum repo with group.
by default when you run createrepo it does not creates group repo. Group is not required unless you have specific requirement.

If you have created repo using createrepo RPM_PATH, while running yum grouplist, you’ll get following error.
Error: No group data available for configured repositories

By the time of writing this article centos 6.2 was the latest version, here we have used centos 6.2 i386 version to demonstrate how grouping can be configured locally. You’ll need to change url for different version.
In repodata all you need to look for is comps.xml, this file contains all grouping info.

To Enable group on local yum repo.
here /storage/yum/cent62 is the parent folder of following two dvd mount points
/storage/yum/cent62/dvd1
/storage/yum/cent62/dvd2


cd /storage/yum/cent62
Download group file from centos mirror for centos 6.2

wget http://mirror.centos.org/centos/6.2/os/i386/repodata/cffddde71947e5fe5a7ce5b77b36decb71afe14b09e3160eba4b4acdd90daa9f-c6-i386-comps.xml.gz

Extract & rename as comps.xml

gunzip cffddde71947e5fe5a7ce5b77b36decb71afe14b09e3160eba4b4acdd90daa9f-c6-i386-comps.xml.gz
mv cffddde71947e5fe5a7ce5b77b36decb71afe14b09e3160eba4b4acdd90daa9f-c6-i386-comps.xml comps.xml

Run createrepo with -g option to create repo with group

createrepo -g comps.xml /storage/yum/cent62/

This is all, now with running yum grouplist on client machine, you’ll not get any error.

Sample
centos-local.repo

[base]
baseurl=http://192.168.3.2/yum/cent62
enabled=1
gpgcheck=0


if you find any missing point in here, please let us know in comment section or tweet us at @linuxreaders. To get more articles like this, subscribe to our RSS feeds / Mails.
Read 240 articles by
  • Khandaker shahi

    I have tested it in Virtual Box.   First put the dvd in to the cdrom. If the dvd do not automatically mounted then we need to create a directory to mount the dvd. Then make a directory like this: #[root@localhost ~] mkdir /media/CentOS_6.2_Final Then mount the dvd with this command: #[root@localhost ~] mount /dev/cdrom /media/CentOS_6.2_Final Then go to the Package directory by typing the command: #[root@localhost ~] cd /media/CentOS_6.2_Final/Package Now we need to install some rpm packages. Like this: #[root@localhost Package] rpm -ivh vsftpd-2.2.2-6.el6_0.1.i686.rpm #[root@localhost Package] rpm -ivh deltarpm-3.5-0.5.20090923git.el6.i686.rpm #[root@localhost Package] rpm -ivh python-deltarpm-3.5-0.5.20090923git.el6.i686.rpm #[root@localhost Package] rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm Now we need to copy the directory CentOS_6.2_Final to /var/ftp/pub, so let’s do it. Note:  you must have 18GB virtual hard drive for that. #[root@localhost Package] cp -r -f /media/CentOS_6.2_Final /var/ftp/pub/ Now we need to edit the repository file. Now we will go to the yum.repos.d directory using this command: #[root@localhost Package] cd /etc/yum.repos.d/ #[root@localhost yum.repos.d] ll Now you will see three repo files. We need to change them. #[root@localhost yum.repos.d] mv CentOS-Base.repo CentOS-Base.repo.dis #[root@localhost yum.repos.d] mv CentOS-Debuginfo.repo CentOS- Debuginfo.repo.dis Now we need to edit the CentOS-Media.repo file with this command: #[root@localhost yum.repos.d] vi CentOS-Media.repo Press i from the keyboard to edit the file. Now you will see like this:   [c6-media] Name=CentOS-$releasever – Media Baseurl=file:///media/CentOS         file:///media/cdrom/        file:///media/cdrecoder/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/RPM-GPG-KEY-CentOS-6   Now we going to change this like this: [c6-media] Name=CentOS-$releasever – Media Baseurl=file:///var/ftp/pub/CentOS_6.2_Final #       file:///media/cdrom/ #       file:///media/cdrecoder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/RPM-GPG-KEY-CentOS-6        file:/// var/ftp/pub/CentOS_6.2_Final/RPM-GPG-KEY-CentOS-6   Now press Esc and type :wq to save the file. Now we need to create a repository file. To do that we will go “CentOS_6.2_Final” directory. And create a repository file. It will take a few minutes. Type this command: #[root@localhost yum.repos.d] cd /var/ftp/pub/CentOS_6.2_Final #[root@localhost CentOS_6.2_Final] createrepo . Note.The last command is “createrepo  .” After creating the repo file we need to update the yum. Type this commands: [root@localhost CentOS_6.2_Final] yum clean all [root@localhost CentOS_6.2_Final] yum update [root@localhost CentOS_6.2_Final] yum list To test type the following commands: [root@localhost CentOS_6.2_Final] yum install httpd* It will ask your permission to import the gpgkey file: y/n Type: y It will ask your permission to install the rpm packages: y/n Type : y If it runs successfully then everything is ok.    now i put the file comps.xml to /var/ftp/pub and usged this command #[root@localhost CentOS_6.2_Final] craterepo . -g comps.xml /var/ftp/pub/CentOS_6.2_Final but when i type #[root@localhost CentOS_6.2_Final] yum grouplist it says like that Error: No group data available for configured repositories. now can you tell me what is worng. and please visit this link https://www.centos.org/modules/newbb/viewtopic.php?post_id=162082&topic_id=37116&forum=56#forumpost162082  

    • dpthakar

       try http based repo. e.g [base] baseurl=http://192.168.3.2/yum/cent62 enabled=1 gpgcheck=0

  • http://verniercalipersguide.blogspot.com Vernier Calipers

    Though I couldn’t understand what it is, it looks informative.

    • http://www.linuxreaders.com/ Dhaval Thakar

      My friend, this is to get yum grouplist / groupinstall support when using local repository.

Trending Posts