Thursday, October 20, 2011

Install perl modules

To install mod_perl in ubuntu :

root@ubuntu:/etc/apache2# apt-get install libapache2-mod-perl2

Add below directives in /etc/apache2/httpd.conf

root@ubuntu:/etc/apache2# cat httpd.conf
<Directory /var/www/perl>
Options +ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>
root@ubuntu:/etc/apache2#

Create directory inside /var/www as perl 


cd /var/www
mkdir perl

Permission can be set as below
drwxr-xr-x  2 www-data www-data 4096 2011-10-20 15:33 perl


refer your apache.conf file what user directive is given there ,
by default it is www-data




After installing any perl module restart apache2

root@ubuntu:/etc/apache2# /etc/init.d/apache2 restart



To Check all Perl modules install :

root@ubuntu:/etc/apache2# perl -MCPAN -e 'CPAN::Shell->r'


Apache2::SizeLimit             0.05      0.95  PHRED/Apache-SizeLimit-0.95.tar.gz
B                              1.22      1.31  RJBS/perl-5.15.2.tar.bz2
CGI                            3.43      3.55  MARKSTOS/CGI.pm-3.55.tar.gz
Compress::Zlib                2.020     2.037  PMQS/IO-Compress-2.037.tar.gz
Cwd                            3.30      3.33  SMUELLER/PathTools-3.33.tar.gz
File::MimeInfo::Rox            0.15       0.2  PARDUS/File-MimeInfo/File-MimeInfo-0.14.tar.gz
Filter::Util::Call             1.08      1.39  PMQS/Filter-1.39.tar.gz
HTML::FormatPS                 2.04      2.10  NIGELM/HTML-Format-2.10.tar.gz
I18N::LangTags::Detect         1.03      1.04  LBROCARD/perl-5.12.4.tar.gz
I18N::Langinfo                 0.02      0.07  JESSE/perl-5.13.9.tar.gz
LWP                           5.837      6.03  GAAS/libwww-perl-6.03.tar.gz
List::Util                     1.21      1.23  GBARR/Scalar-List-Utils-1.23.tar.gz
Locale::Constants              2.07      3.16  SBECK/Locale-Codes-3.16.tar.gz
Locale::Country                2.07      3.18  SBECK/Locale-Codes-3.18.tar.gz
Mail::Address                  2.06      2.08  MARKOV/MailTools-2.08.tar.gz
Pod::Man                       2.22      2.25  RRA/podlators-2.4.0.tar.gz
Socket                         1.82      1.94  FLORA/perl-5.13.11.tar.gz
mod_perl2                  2.000004  2.000005  PHRED/mod_perl-2.0.5.tar.gz
233 installed modules have no parsable version number
(use 'o conf show_unparsable_versions 1' to show them)



Also try :

root@ubuntu:/etc/apache2# instmodsh
Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd? l
Installed modules are:
   Perl
cmd? 1


Place all your perl scripts in /var/www/perl

and test in browser as http://localhost/test/first.pl

No comments:

Post a Comment