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

/etc/yum.repos.d

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 " >RPM-GPG-KEY-example.org [thomas@host ~]$ cat RPM-GPG-KEY-example.org -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.5 (G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/Leb6f4tjlRJfyyWaqQ F50bupAdVhgsjBA7awADBQgAjRZ11CODlZTboW/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 RPM-GPG-KEY-example.org [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.

Kickstart

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

About the Author...

Slides from LISA 2019 Linux systems troubleshooting #LISA2019 https://t.co/D4dMKflK6R Tue Oct 29 05:59:30 +0000 2019

https://t.co/AGeihMALAv configuring grub2 with EFI Fri Sep 13 05:20:01 +0000 2019

I published a Thing on @thingiverse! https://t.co/IYpRyEb7Hz #thingalert Tue Jul 23 19:27:57 +0000 2019

Nokogiri install on MacOSX https://t.co/v3An0miW9L Fri Jul 12 15:06:49 +0000 2019

HTML email with plain mailer plugin on Jenkins https://t.co/Z6FSDMDjy8 Thu Jul 11 21:07:25 +0000 2019