Install latest perl to Ubuntu on Windows

Have you tried Ubuntu on Windows? It looks great!

To use perl in Ubuntu on Windows, it seems that we should set dont_use_nlink true in at least File::Find. See https://github.com/Microsoft/BashOnWindows/issues/186 for details.

So here is how to install perl 5.24 to Ubuntu on Windows. Make sure dont_use_nlink defined.

# set LANG explicitly to avoid weird problems....
$ export LANG=en_US.UTF-8

# need cc and make to build perl...
$ apt-get install gcc make

# usual way
$ wget http://www.cpan.org/src/5.0/perl-5.24.0.tar.gz
$ tar xzf perl-5.24.0.tar.gz
$ cd perl-5.24.0

# define dont_use_nlink
$ echo "dont_use_nlink='define'" >> Policy.sh

# back to usual way (change prefix as you want)
$ ./Configure -des -Dprefix=/root/perl
$ make
$ make install

Easy.

Let's install some CPAN modules, say Plack.

$ export PATH=/root/perl/bin:$PATH
$ perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux

# install cpanminus
$ curl -sSL https://cpanmin.us | perl - -nq App::cpanminus

# install some CPAN modules, say Plack
$ cpanm -nq Plack

$ plackup -e 'sub {[200,[],["Hello world!"]]}'
HTTP::Server::PSGI: Accepting connections at http://0:5000/

You can access http://localhost:5000 from your browser in Windows.

No more emulation of fork(). Wow!