Install cpan and cpanminus.

Add to bash profile:

alias cpan="cpan -j $XDG_CONFIG_HOME/cpan/config.pm"
export PATH="${PATH}:$HOME/.local/bin"
export PERL_CPANM_OPT="-l $HOME/.local"
export PERL5LIB="$HOME/.local/lib/perl5${PERL5LIB+:}${PERL5LIB}"
export PERL_LOCAL_LIB_ROOT="$HOME/.local${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"
export PERL_MB_OPT="--install_base \"$HOME/.local\""
export PERL_MM_OPT="INSTALL_BASE=$HOME/.local"

Re-login to your terminal and try to install a package:

cpanm local::lib
Last Updated: 12/27/2018, 12:33:49 AM