Linux – How to install Perl module Crypt::OpenSSL::AES

linuxopenssl

It's been a couple of days I am pulling my hair trying to get a legacy Perl script working as cgi within an apache2 server. It requires Crypt::OpenSSL::AES. From the Apache error logs:

Can't locate Crypt/OpenSSL/AES.pm in @INC

The easiest would have been if a ubuntu package could install it with me, but I am unable to locate any package with the proper files. The following returns nothing:

apt-file search AES.pm

As a regular user, I have installed cpan and used it to install perl modules, so that Crypt::OpenSSL::AES is installed under my user directory at /home/user/.cpan/build/Crypt-OpenSSL-AES-0.02-H74J64/lib. Unfortunately, whether I manually copy AES.pm to its proper location (/usr/local/lib/perl/5.10.1/... as per @INC) or I add the PERL5LIB env variable within the apache2 configuration files (SetEnv PERL5LIB /home/user/.cpan/build/Crypt-OpenSSL-AES-0.02-H74J64/lib), the error logs now show that there is a missing shared object:

Can't locate loadable object for module Crypt::OpenSSL::AES in @INC 

The error mesage is subtly different from the first one (I didn't notice it at first): now it does find AES.pm, but there is another dependency on an unspecified "loadable object" and I have no clue which one. Openssl is installed on my system.

So:

Generally, what is the proper way (on a Linux-ubuntu system) to install perl modules to work with an apache2 server? (I searched and there are many answers to this question, but it still doesn't work).

Specifically, how can I properly satisfy my cgi perl application's dependency on Crypt::OpenSSL::AES?

Best Answer

I solved my problem:

  1. Installing the package

    Debian and Ubuntu

    aptitude install libssl-dev
    

    CentOS or Fedora

    yum install -y openssl-devel`
    
  2. Compiling the module manually

    sudo cpan Crypt/OpenSSL/AES.pm