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.
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> o conf tar /bin/tar tar [/bin/tar] Please use 'o conf commit' to make the config permanent! cpan> o conf bzip2 /bin/bzip2 bzip2 [/bin/bzip2] Please use 'o conf commit' to make the config permanent! cpan> o conf gzip /bin/gzip gzip [/bin/gzip] Please use 'o conf commit' to make the config permanent! cpan> o conf commit commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm' cpan> quit No history written (no histfile specified). Lockfile removed.
Make sure to perform commit to save the configuration changes as shown above.