Creating a yum repository (repo) and Creating a yum group to install + kickstart

Creating a yum repository is fairly easy, the only command you need is createrepo and some rpms. This is a quick guide to making a repo, I have a more complete example in my howto make an install server.

Make a directory to contain your rpms, it's nice to name the directory the same as the repo name. Even better, segregate the rpms by architecture, i386, i686, noarch, SRPMS, etc. Copy the rpms into the appropriate directories and run create repo on that directory. Ensure you sign your rpms with your gpg key.
Example: [user@machine] mkdir -p MyRepo/i386 MyRepo/noarch MyRepo/i686 MyRepo/SRPMS [user@machine] mv myrpm.noarch.rpm MyRepo/noarch [user@machine] mv myrpm.src.rpm MyRepo/SRPMS [user@machine] mv mybinrpm.i386.rpm MyRepo/i386 [user@machine] createrepo MyRepo

Groups File (comps.xml)

Now, if you want to install all the rpms in your repo, or a specific subset, you'll need to create a groups file otherwise known as comps.xml. For our example, if we wanted myrpm.noarch.rpm to be installed by default and mybinrpm.i386.rpm to be an optional install, we would create a comps.xml file like this: mygroupMyGrouptrueDefault RPMS from MyRepotruemyrpmmybinrpm Now we need to rerun createrepo so that clients will know our group assignments. [user@machine] createrepo -g comps.xml MyRepo


Now, if we want to install this group on a machine, we create a .repo file in /etc/yum.repos.d like this: [MyRepo] name=My Repository baseurl=http://path/to/MyRepo gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-MyRepo If you didn't sign your rpms and do not wish to verify signatures, set gpgcheck=0 in your .repo file. If you did sign your rpms, then you'll need to export your gpg key into a file so yum can import the file into the rpm database.

Exporting your GPG-Key for RPM/YUM

First, find the name of your key if you don't already know it.
[thomas@host ~] gpg --list-keys /home/thomas/.gnupg/pubring.gpg ------------------------------------------- pub 1024D/79E7E0DB 2007-10-08 uid Repository Owner sub 2048g/04F5FDBA 2007-10-08
Then export the key into a file:
[thomas@host ~]$ gpg --export -a "Repository Owner " > [thomas@host ~]$ cat -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.5 (GNU/Linux) mQGiBEcKQlgRBACLKP/FOWmTf75UjfShH84YkbL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RZ11CODlZTboW/r1mdxnW9oMJvqq6xGBQ9/3PPf WnGY6pxGNR5uuhgwl1gb2882u4ynL7DTkwuK1rg0febulpbNgqqx7sdKDSy7Xiwz TAYE+8Q2Z1A7jlblU0I5srFz20LMCW4xCYg5DmPqPY8BVxYGyGowBtTcO2skkyjX BW5UWGLRxM6b5kt53jUQlTC2z88BK+E2RLeZE9/Ln9fVFG1aRf9McXaQcj8jRiuR 8D30E927RosyUJ9t/IBOlkfIyYqP6sYOsnrZhyWAh4iDVrB5nSdruDYHawme72We b6UggUonKXWmra6XuGKLV8Q5pCharQzJ7nBKWK4NrbvFIIhJBBgRAgAJBQJHCkJe AhsMAAoJEOC722t55+DbTHkAn3Hjp5XTfcdEPVMnbPrmdQVwRjhJAJ400WMsJD1E BJSAdiyou23Z2seraQ== =+H8a -----END PGP PUBLIC KEY BLOCK-----
Then move this file to the location specified in the .repo file. Yum will install the key into the rpm database for you. To install the key manually, you can do the following:
[root@host thomas]# rpm --import [root@host thomas]# rpm -q gpg-pubkey gpg-pubkey-b2980b13-3c1d0597 gpg-pubkey-f51839ac-46362566 gpg-pubkey-79e7e0db-470a4258
We can see that our key (gpg-pubkey-79e7e0db-470a4258) was installed into the rpm database).

Now, to install this group. [user@machine] yum groupinstall mygroup This will install any default or mandatory rpms as listed in comps.xml, any optional rpms will not be installed.


To install our packages via kickstart, we'll need to add the repo to our kickstart file repo --name=MyRepo --baseurl=http://path/to/MyRepo
Wordpress category: 


In your comps.xml file you define a custom group called `MyGroup'. Given that, shouldn't the command to install the RPMs in that group be `yum groupinstall MyGroup' instead of `yum groupinstall myrepo' (`myrepo' being the repository name)?

Yes, you are right, Thanks! I'll fix it for the capitalization, it would be mygroup instead of MyGroup, mygroup is the id of the group and MyGroup is the name of the group. You use the id when issuing a groupinstall.

Thanks for the quick reply! As for the argument to a `yum groupinstall' (or any group* sub-command for that matter), that can actually be the name or the id of a defined package group. At least that is the case with YUM 3.2.8 on Fedora 8. It's quite possible though that the YUM version / distro combination you used when writing your article did indeed suffer from that limitation.

Thanks for this and the previous rpm/gpg-related post. You saved me the agony of looking through man pages all morning ;-)

[...] The comps.xml file isn’t built by fairies, but is powered by Dark Elf magic. [...]

You can use the following syntax on your mkdir command, to accomplish the same:
mkdir -p MyRepo/{i386,noarch,i686,SRPMS}

Is it possible to disable the gpgcheck when using the repo command in kickstart?

Maybe skip the packages install section and install everything via yum groupinstall in %post?

[user@machine] mkdir -p MyRepo/i386 MyRepo/noarch MyRepo/i686 MyRepo/SRPMS
[user@machine] createrepo MyRepo
[user@machine] createrepo -g comps.xml MyRepo
Does the MyRepo in the both createrepo commands refer to the directiory creted in the first line?

Yes, correct.

Add new comment


  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.