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:
# yum install yum-downloadonly
# 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.