Build your own Yum repository
One of the challenges we’ve had over the years is installing packages on RHEL and CentOS that either go away or are removed from major repos (EPEL/REMI/IUS), or, for things where we want to tie to a specific version of a package and maintain easy upgrade ability.
There are many ways to skin this cat, but, this is the way we chose. No cats were harmed in the making of this repository.
Create
First off, you’ll need to create some directories for your repo and packages to live in. You’ll need to do this for each version and architecture you’re going to support. In this case it’s RHEL/CentOS only and versions 5 and 6.
If you had multiple architectures & OS’ you might have:
Directories are up to you really depending on what you want to store.
You’ll also need the createrepo
package, and repoview
if you want
an HTML setup as well:
We’ve got a script that’s specific to our install and as I said assumes only one architecture, but, you can tweak as you need. The advantage of the script in this format is you can run it from wherever, say you have a common shared bin directory for instance.
Once you’ve run it, you’ll have your repo.
Add packages & update
Now it’s built, you can add packages. Put simply, chuck an RPM in the right folder and rebuild.
Use it
Once you’ve create the repository it’s easy to then go ahead an grab a package from it.
On each server you want it to be available on, create a new repo file. We use puppet to ensure this exists where it needs to. Note that this example is only for RHEL/CentOS 6.
Once you’ve added that, update Yum:
Then, go ahead and search for your package. We’ll use ImageMagick as an example:
What we’re doing in the above is ensuring only our repo responds. After this point you can install or do whatever you need to.
Orginally published at dev.venntro.com