I know this is an old post but this information is not readily available.
On a packaged managed system like CentOS, please do not use cpan to install packages. It is not an enterprise solution since most companies will not let you install software from the Internet for production systems and you will just have to figure out some other way to package your software anyway. The correct method is to build your own RPMs with `cpanspec`.
$ wget https://cpan.metacpan.org/authors/id/J/JM/JMCNAMARA/Excel-Write
+r-XLSX-1.03.tar.gz
$ cpanspec -b Excel-Writer-XLSX-1.03.tar.gz
Unfortunately, for Excel-Writer-XLSX, cpanspec did not pick up the installed man page and script in /usr/bin.
> error: Installed (but unpackaged) file(s) found:
> /usr/bin/extract_vba
> /usr/share/man/man1/extract_vba.1.gz
So, I had to manually add those paths to the SPEC %files section and try again.
%files
%{_mandir}/man1/*
%{_bindir}/*
Then rebuild it
$ rpmbuild -ba perl-Excel-Writer-XLSX.spec --define "_sourcedir $PWD"
At this point you now have an RPM that you could put on your yum repository and it will be available for all of your systems.
> Wrote: ~/rpmbuild/SRPMS/perl-Excel-Writer-XLSX-1.03-1.el7.stopllc.sr
+c.rpm
> Wrote: ~/rpmbuild/RPMS/noarch/perl-Excel-Writer-XLSX-1.03-1.el7.stop
+llc.noarch.rpm
Or install it with yum from the command line
sudo yum install ~/rpmbuild/RPMS/noarch/perl-Excel-Writer-XLSX-1.03-
+1.el7.stopllc.noarch.rpm #only command that needs root permissions
Bonus points
Sign your rpms
rpm --addsign ~/rpmbuild/RPMS/noarch/perl-Excel-Writer-XLSX-1.03-1.e
+l7.stopllc.noarch.rpm
Build your own yumrepo with createrepo. If your path is /var/www/html/yumrepo then your yumrepo will be at http://127.0.0.1/yumrepo/ requires `yum install httpd`
sudo mkdir -p /var/www/html/yumrepo/ #only first time
sudo mv ~/rpmbuild/RPMS/noarch/perl-Excel-Writer-XLSX-1.03-1.el7.sto
+pllc.noarch.rpm /var/www/html/yumrepo/
sudo createrepo /var/www/html/yumrepo # new or deleting rpm
+s
sudo createrepo --update /var/www/html/yumrepo # if only adding rpms
Configure your yum repo on the client systems (change 127.0.0.1 to your host name)
/etc/yum.repos.d/my.repo
[my-repo]
name=My Repo
baseurl=http://127.0.0.1/yumrepo/
enabled=1
gpgcheck=0
Clean up your older rpm repo versions with repomanage
repomanage --keep=2 --old /var/www/html/yumrepo | xargs -P4 -I'{}' /
+bin/rm '{}` # delete versions older than the last two versions
createrepo /var/www/html/yumrepo
+ # rebuild the yum index
|