Issue: You have tar, gzip and bzip2 working properly on your server. However, you are getting “CPAN.pm needs either the external programs tar, gzip and bzip2 installed. Can’t continue.” error message while installing a perl module using cpan. This article explains how to solve this problem.
Also, please refer to our previous article on How To Install Perl Modules using manual and cpan method.
Solution:
The error happens because CPAN is not aware of tar, bzip2 and gzip file location. Configure these locations as shown below.
# perl -MCPAN -eshell cpan shell -- CPAN exploration and modules installation (v1.9205) ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?) cpan[1]> o conf tar /bin/tar tar [/bin/tar] Please use 'o conf commit' to make the config permanent! cpan[2]> o conf bzip2 /bin/bzip2 bzip2 [/bin/bzip2] Please use 'o conf commit' to make the config permanent! cpan[3]> o conf gzip /bin/gzip gzip [/bin/gzip] Please use 'o conf commit' to make the config permanent! cpan[4]> o conf commit commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm' cpan[5]> quit No history written (no histfile specified). Lockfile removed.
Make sure to perform commit to save the configuration changes as shown above.