If you need to get package source code only, and you don’t want to install it, you can use Downloadonly plugin for yum.
Install the package including “downloadonly” plugin:
(RHEL5)
# yum install yum-downloadonly
(RHEL6)
# yum install yum-plugin-downloadonly
Run yum command with “–downloadonly” option as follows:
# yum install --downloadonly --downloaddir=<directory> <package>
Confirm the RPM files are available in the specified download directory.