Don’t be lazy, make your own local yum repo…

So I often log into CentOS/RHEL servers and discover that there are tons of custom RPMs installed that were just downloaded from random places. While I understand that sometimes you just need to get things done, please just create your yum repo somewhere and install from there. You’ll thank me later when you need to update said packages on 20+ servers.

Here’s the basic gist.

On what you plan to be your yum repo server:

1. Copy all your custom/cool RPMs over to some web accessible directory on a server. (optional: maybe create some cool vhost in Apache or whatever to have a name like imnotlazyandmakemyownyumrepos.mydomain.com)

2. Make sure yum-utils is installed (available via default Cent/RHEL repost) “yum install yum-utils”

3. Use the createrepo command to do all the cool yum directory structure magic and such “createrepo /var/www/my_yum_packages”

On your yum clients:

1. Subscribe to your new/cool repo by creating a file in /etc/yum.repos.d/ “vi /etc/yum.repos.d/cooldude.repo” (must end in .repo)

2. That file should have contents like this (note, you can do all gpg/arch stuff if you want but my repo is secured internal and it automatically figures out which arch works for what machines, so I don’t see the need currently):


[MY COOL REPO]
name=My Cool Repo
baseurl=http://imnotlazyandmakemyownyumrepos.mydomain.com/my_yum_packages
enabled=1
gpgcheck=0

3. You should be all set to use your own cool yum packages. Try a search to verify it worked “yum search mycoolpackage”

4. If you don’t see your cool new stuff, yum’s caching mechanism is sometimes a tad overzelous. Go ahead and run “yum clean all” to get a nice fresh start.

Next time you need to update php to your cool/custom build on like 20 servers, just dump it your repo server, re-run the creatrepo command, and do a “yum update php” on all your servers. If there are new dependencies required, just throw a copy of it in your repo as well.

Much better, right?
Need help with making your own Yum repo ? Atlantic Metro offers system administration services, contact us today – sales@atlanticmetro.net

This entry was posted in Atlantic Metro Labs, How-to and tagged , , , , , . Bookmark the permalink.

3 Responses to Don’t be lazy, make your own local yum repo…

  1. atlanticmetro says:

    wow, this is pretty cool. Thanks for sharing. I am going to try this when I get home tonight.

  2. 30char says:

    Thanks for the great how-to

  3. 30char says:

    Thanks for the great how-to