While building Flashcache on one of my servers for a client and needed to download the kernel’s source RPM. I searched everywhere for the correct repository, and came to the conclusion it doesn’t exist for CentOS 6 anymore.
So if you still need it there is a workaround, you can use the CentOS Vault, which according to the CentOS-Vault.repo file which may be pre-installed in your OS says:
CentOS Vault holds packages from previous releases within the same CentOS Version these are packages obsoleted by the current release and should usually not be used in production.
So with that small warning I shall continue to show you the steps to add the source part of the CentOS Vault into the repo. Just copy and paste the following, if you can’t copy and paste it then just use a text editor of your choice and append the text. The command is just to make it easier.
cat >> /etc/yum.repos.d/CentOS-Vault.repo <<END[base-SRPMS-6.4]name=CentOS-$releasever – Base SRPMSbaseurl=http://vault.centos.org/6.4/os/Sourcegpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1enabled=1[updates-SRPMS-6.4]name=CentOS-$releasever – Base SRPMSbaseurl=http://vault.centos.org/6.4/updates/Sourcegpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1enabled=1END
This should be easy to modify for future versions of CentOS 6, all you have to do after you’ve run the command above is to update yum’s repository cache.
yum -y update
Then you can go ahead and download whatever source RPM you want, using the yumdownloader command which if you don’t have it is available in the yum-utils package. In my case for an example I used:
yumdownloader --source kernel.x86_64
That’s it really, it will just download the source RPM to the current directory which you can rebuilt or do whatever with.
联系客服