安装工具
# yum install yum-utils
设置源:
[base-src]
name=CentOS-5.4 - Base src -
baseurl=http://vault.centos.org/5.4/os/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=os
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
[updates-src]
name=CentOS-5.4 - Updates src-centos
baseurl=http://vault.centos.org/5.4/updates/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=updates
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons-src]
name=CentOS-5.4 - Addons src -
baseurl=http://vault.centos.org/5.4/addons/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=addons
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras-src]
name=CentOS-5.4 - Extras src-centos
baseurl=http://vault.centos.org/5.4/extras/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=extras
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus-src]
name=CentOS-5.4 - Plus src-centos
baseurl=http://vault.centos.org/5.4/centosplus/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib-src]
name=CentOS-5.4 - Contrib src-centos
baseurl=http://vault.centos.org/5.4/contrib/SRPMS/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=SRPMS&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
下载命令对应的源码:
# rpm -qf `which mkdir`
coreutils-5.97-23.el5
# yumdownloader --source coreutils
# rpm2cpio coreutils-5.97-23.el5_4.2.src.rpm | cpio -id
这样就得到了源码包coreutils-5.97.tar.bz2