Installing mod_perl on Apache 24 Ubuntu 18.04

Posted by on Jan 20 2020, in kraxn

This is quite old school, but if you want to try mod_perl on Apache2.4 on Ubuntu, here’s how I did it:

First get the modules for Ubuntu server. If you were like me and trying to read the [installation process on the mod_perl website][1] , you probably were scratching your head. Luckily its trivial to install with just a couple of commands:

sudo apt-get update -y
sudo apt-get install -y libapache2-mod-perl2

Once that is done, just set up the virtual hosts, here is an example, just replace <yoursite.com> with your domain as well as any other directives. For the below, you can easily search and find the meanings of the directives:

<VirtualHost *:80>
         ServerAdmin webmaster@<yoursite.com>
         DocumentRoot /var/www/<yoursite.com>/public_html
        Servername <yoursite.com>
        Serveralias www.<yoursite.com>
       <Directory /var/www/<yoursite.com/public_html>
               AddHandler perl-script .pl .cgi
                PerlResponseHandler ModPerl::Registry
                Options +ExecCGI +FollowSymLinks +MultiViews
                 PerlOptions +ParseHeaders
                 AllowOverride All
               Order allow,deny
                Allow from all 
         </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
         CustomLog ${APACHE_LOG_DIR}/access.log combined
 </VirtualHost>

As for why, I happen to like Perl. The webstuff is just for fun, but I’ve used to on my system to parse through large amount of text files, and it works great.

I know there is doom and gloom about the future of this language. I first heard of Perl’s demise in 2002, when I wanted to try to learn a scripting language outside of ASP. My Java programming mates thought it was horrible decision: Perl was considered old even then! However, not long after I started digging into Perl when I learned about PHP, and that became what I used for years. So I revisited Perl again, and wow, there is a very, very deep community. A google site:cpan.org yields over 400,000 pages, though I suspect more. Even that archaic [mod_perl][2] was updated just a few months ago.

The Java guys? Not sure what happened to them. But its certainly fun to horse around with “Perl again before it disappears completely” 🙂

https://thehftguy.com/2019/10/07/perl-is-dying-quick-could-be-extinct-by-2023/