1. Installing source package with YUM
To install source package with YUM you have to install yum-utils
yum install yum-utils
then, just use yumdownloader:
yumdownloader --source packagename
example: use '$ sudo yum install net-tools' to download
net-tools-2.0-0.2.20121106git.fc18.src.rpm
2. Uncompressing / unpacking of source
Source RPM archives (.src.rpm)
SRPM archives usually don't need to be unpacked before using
them (see Section 6>). In the rare case that you really want
to unpack an RPM (regardless whether it is a source or binary
RPM), you could do it as follows (note that you need the
utilities rpm2cpio and cpio):
rpm2cpio foo.rpm | cpio -idmv --no-absolute-filenames
In the case of a source RPM, the content will likely turn out
to be two files — a .spec file and a tarball (see above).
Tip TIP
If you simply want to list the contents of an RPM package file, you can do that with
rpm --query --list -p foo.rpm
转载于:https://blog.51cto.com/chenhj/1329425