Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing latest version of Dancer2 on Debian

OK, got myself a clean virtual machine running Debian 9 (Stretch). I installed Dancer2 from the Debian package system. It's running version 0.204002. The Dancer2 software is telling me that the latest version is 0.205002.

I want to finally, once and for all, learn the proper way to upgrade Perl modules on a Debian machine to the latest and greatest versions without ruining the Debian dpkg dependencies. How do I achieve this?

EDIT Yes, this is a development machine I'm just playing with. But what if I wanted to run the latest version of Dancer 2 on a production machine? How would I do it?

like image 809
StevieD Avatar asked Jan 18 '26 19:01

StevieD


1 Answers

I can't tell that the following is the answer for the I want to finally, once and for all, learn the proper way... , but this is how me doing it in all my deployments.

  1. Install anyenv sudo git clone https://github.com/riywo/anyenv /opt/anyenv - you could deploy it into your $HOME as git clone https://github.com/riywo/anyenv ~/.anyenv but myself prefering some commonly accessible place. This step isn't mandatory, but for me help managing other local installations as node and such.
  2. change ownership: sudo chown -R jm666 /opt/anyenv - you will manage the content
  3. add into the .profile:
export ANYENV_ROOT=/opt/anyenv
export PATH="$ANYENV_ROOT/bin:$PATH"
eval "$(anyenv init -)"

Relog, or run exec $SHELL -l. Now you have installed an helper for all commonly needed environments.

Now install the perl env. helper, called plenv.

anyenv install plenv

Or follow the guide in the repo if you don't want the previous anyenv step.

And finally install fresh perl using plenv:

plenv install -l #will display all available perl versions
plenv install 5.26.1 -j 8 # number of proc cores or less. :)

This will take some time - on my notebook 4m23,186s - just tested :).

plenv global 5.26.1 # now all `perl script.pl` will use the freshly installed perl
plenv install-cpanm
plenv rehash #needed if you install some commands which should be accesible from `bash`

And you're ready to install any perl modules using cpanm - without compromising the system-wide installed perl. Everything will be installed into the plenv's directory tree. Even, you never need be root.

This way I could manage to have the same development and deployment environment. Maybe here is a better way - but for me the above works.

In short, read:

  • https://github.com/riywo/anyenv
  • https://github.com/tokuhirom/plenv
like image 58
jm666 Avatar answered Jan 21 '26 09:01

jm666



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!