版本: 红帽企业Linux5和以后版本
可以使用yumdownloader命令的--source参数下载RPM源码包。
要使用yumdownloader工具,需要确认系统已经安装了yum-utils软件包。
# rpm -q -yum-utils
如果系统没有安装这个软件包,可以使用下面命令来安装:
# yum install yum-utils
下一步,设置一个源码包的软件仓库。编辑/etc/yum.repos.d/rhel-src.repo文件,在这个文件内添加下面内容:
[rhel-src]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
这样,源码软件仓库就设置好了,下面是一个下载RPM源码包的示例:
# yumdownloader --source openldap