Can’t locate LWP/UserAgent.pm in @INC? We can help you.
We often come across this error while installing applications such as CSF in the DirectAdmin server or any other Linux distros like CentOS or Ubuntu.
As part of our Server Management Services, we assist our customers with several Linux queries.
Today, let us see how to fix this error in a few steps.
Can’t locate LWP/UserAgent.pm in @INC
./install.sh Can’t locate LWP/UserAgent.pm in @INC (@INC contains: /usr/local/cpanel /etc/csf /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /etc/csf/csf.pl line 1798. BEGIN failed–compilation aborted at /etc/csf/csf.pl line 1798.
Generally, this error trigger when applications such as CSF require Perl to compile and Perl is not installed on the server.
What is Perl?
Perl is a programming language to perform tasks that would be difficult or cumbersome on the command line.
Most of the GNU/Linux distributions include Perl by default. Usually, we can invoke Perl using a text editor to write a file and then pass it to the Perl program.
Practical Extraction and Report Language was a language to scan arbitrary text files, extract, and print reports based on that information. Being a good language for many system management tasks, Perl has grown into a general-purpose programming language.
We can locate Perl wherever we choose. However, it’s best for both
/usr/local/bin/perl to be symlinks to the actual binary.
Being popular in demand, Perl has several advantages, which includes:
- Easy to start: It is closer to programming languages like C, C++ and thus, easy to learn.
- Text-Processing: Perl has high text manipulation abilities by which it can generate reports from different text files easily.
- Contains best Features: It contains features of different languages making it more useful and productive.
- System Administration: Since it has different scripting language capabilities Perl makes the task of system administration very easy.
Solution for Can’t locate LWP/UserAgent.pm in @INC
Initially, we can install Perl by running:
# perl -MCPAN -e ‘install Bundle::LWP’
However, in CentOS/RHEL, we run:
# yum install perl-libwww-perl
Similarly, in Ubuntu/Debian, we run:
# apt-get install libwww-perl
We can compile Perl from the source:
# wget http://www.cpan.org/modules/by-module/LWP/libwww-perl-6.06.tar.gz # tar xvzf libwww-perl-6.06.tar.gz # cd libwww-perl-6.06 # perl Makefile.PL # make # make install
[Couldn’t perform the installation? We are here for you]
To conclude, the error, Can’t locate LWP/UserAgent.pm in @INC trigger while we install applications like CSF in the DirectAdmin server or any other Linux distros. Today, we saw an effective method our Support Tech finds the best fit.