How to build Perl module rpm file with cpanspec on RHEL/CentOS Linux

To build a Perl module RPM file using cpanspec on RHEL/CentOS Linux, you can follow the steps below:

  1. Install cpanspec:
# yum install cpanspec
  1. Download the Perl module from CPAN:
# cpan <Module-Name>
  1. Convert the Perl module to an RPM package:
# cpanspec <Module-Name>
  1. Build the RPM package:
# rpmbuild --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" -ba <Module-Name>.spec
  1. Install the RPM package:
# yum install <Module-Name>-<Version>.<Arch>.rpm

Note: Replace <Module-Name> with the name of the Perl module, <Version> with the version number, and <Arch> with the architecture of your system (e.g., x86_64).

Leave a Comment