My first post here, but I googled around and cannot find a simple way to do this.
I have a program which automatically configures new CentOS Linux servers as they come online. As part of the process it installs the latest version of epel-release rpm.
The command I use looks like this:
$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm && \
yum clean all
This works great... until they change the rpm file to epel-release-6-8.noarch, then epel-release-6-9.noarch, and so on. They seem to update the version every 3-4 months. This is a problem, because if the repository updates the epel-release version number, my scripts will fail because it has no idea what that version should be.
I failed to find a link that might redirect to the latest epel rpm file, so I have no choice but to hard-code the version into my install scripts, and change it when they fail.
Anyone know a simple (non-hard-coded) way to download the latest epel rpm without knowing the version number? I'm hoping for a way that does not involve dong a curl on the repo file list and grep'ing the url, but curious what anyone might suggest?
To verify that the EPEL repository is enabled run the yum repolist command that will list all available repositories. The command will display the repo ID, name and the number of packages for the enabled repositories. The output should include a line for the EPEL repository. That's it.
EPEL has an 'epel-release' package that includes GPG keys for package signing and repository information. Installing this package for your Enterprise Linux version should allow you to use normal tools such as yum to install packages and their dependencies.
The following script will do the trick:
cat <<EOM >/etc/yum.repos.d/epel-bootstrap.repo
[epel]
name=Bootstrap EPEL
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-\$releasever&arch=\$basearch
failovermethod=priority
enabled=0
gpgcheck=0
EOM
yum --enablerepo=epel -y install epel-release
rm -f /etc/yum.repos.d/epel-bootstrap.repo
It should work on RHEL/CentOS 5 and 6. I didn't test version 4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With