Difference between revisions of "Perlbrew"
m |
|||
Line 3: | Line 3: | ||
# create a directory where perlbrew will install the new Perl version: | # create a directory where perlbrew will install the new Perl version: | ||
− | + | <pre> | |
# mkdir /opt/perl5 [enter] | # mkdir /opt/perl5 [enter] | ||
− | </pre | + | </pre> |
I chose to do it in /opt/perl5; if we change the permissions on this directory, we do not need to run the rest as root. | I chose to do it in /opt/perl5; if we change the permissions on this directory, we do not need to run the rest as root. | ||
# declare a (temporary) environment variable PERLBREW_ROOT | # declare a (temporary) environment variable PERLBREW_ROOT | ||
− | + | <pre> | |
$ export PERLBREW_ROOT=/opt/perl5 | $ export PERLBREW_ROOT=/opt/perl5 | ||
− | </pre | + | </pre> |
# download the perlbrew script and run it: | # download the perlbrew script and run it: | ||
− | + | <pre> | |
$ curl -L http://xrl.us/perlbrewinstall | bash [enter] | $ curl -L http://xrl.us/perlbrewinstall | bash [enter] | ||
$ /opt/perlbrew/bin/perlbrew init [enter] | $ /opt/perlbrew/bin/perlbrew init [enter] | ||
− | </pre | + | </pre> |
I actually reviewed the script before executing it, do not just run stuff off the internet without knowing what you are doing. | I actually reviewed the script before executing it, do not just run stuff off the internet without knowing what you are doing. | ||
Line 26: | Line 26: | ||
In my case I use the bash shell, so I modified my .bashrc file (log off and back in to see the changes later): | In my case I use the bash shell, so I modified my .bashrc file (log off and back in to see the changes later): | ||
− | + | <pre> | |
export PERLBREW_ROOT=/opt/perl5 | export PERLBREW_ROOT=/opt/perl5 | ||
source /opt/perl5/etc/bashrc | source /opt/perl5/etc/bashrc | ||
source /opt/perl5/etc/perlbrew-completion.bash | source /opt/perl5/etc/perlbrew-completion.bash | ||
− | </pre | + | </pre> |
After this, just install a new Perl version. You will need a c compiler, make and patch: | After this, just install a new Perl version. You will need a c compiler, make and patch: | ||
− | + | <pre> | |
$ perlbrew install perl-5.14.2 [enter] | $ perlbrew install perl-5.14.2 [enter] | ||
$ perlbrew switch perl-5.14.2 [enter] | $ perlbrew switch perl-5.14.2 [enter] | ||
− | </pre | + | </pre> |
The 1st step could take a long time depending on how fast your host is. After it is done, you will have a new Perl at your disposal. | The 1st step could take a long time depending on how fast your host is. After it is done, you will have a new Perl at your disposal. | ||
− | + | <pre> | |
$ perl -v | $ perl -v | ||
Line 48: | Line 48: | ||
Copyright 1987-2011, Larry Wall | Copyright 1987-2011, Larry Wall | ||
..... | ..... | ||
− | </pre | + | </pre> |
and this is the system's Perl: | and this is the system's Perl: | ||
− | + | <pre> | |
$ /usr/bin/perl -v | $ /usr/bin/perl -v | ||
Line 59: | Line 59: | ||
Copyright 1987-2009, Larry Wall | Copyright 1987-2009, Larry Wall | ||
.... | .... | ||
− | </pre | + | </pre> |
== compile perl for intel 32bits in a 64bits intel host == | == compile perl for intel 32bits in a 64bits intel host == | ||
Line 66: | Line 66: | ||
In a redhat host you need the 32 compilers, libraries etc to do it. | In a redhat host you need the 32 compilers, libraries etc to do it. | ||
− | + | <pre> | |
$ perlbrew install perl-5.14.2 --as perl-5.14.2-i686-linux-thread-mult -Dcc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib/x86_64-linux-gnu/' -Darchname=i686-linux-thread-multi -Dusethreadscc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib' | $ perlbrew install perl-5.14.2 --as perl-5.14.2-i686-linux-thread-mult -Dcc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib/x86_64-linux-gnu/' -Darchname=i686-linux-thread-multi -Dusethreadscc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib' | ||
− | </pre | + | </pre> |
This will compile everything to your defined PERLBREW_ROOT dir. | This will compile everything to your defined PERLBREW_ROOT dir. | ||
Line 74: | Line 74: | ||
When it's done, just switch to it: | When it's done, just switch to it: | ||
− | + | <pre> | |
$ perlbrew use perl-5.14.2-i686-linux-thread-mult | $ perlbrew use perl-5.14.2-i686-linux-thread-mult | ||
$ perl -v | $ perl -v | ||
This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-thread-multi | This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-thread-multi | ||
− | </pre | + | </pre> |
Latest revision as of 22:12, 28 August 2015
Installing a system-wide perlbrew Perl
- create a directory where perlbrew will install the new Perl version:
# mkdir /opt/perl5 [enter]
I chose to do it in /opt/perl5; if we change the permissions on this directory, we do not need to run the rest as root.
- declare a (temporary) environment variable PERLBREW_ROOT
$ export PERLBREW_ROOT=/opt/perl5
- download the perlbrew script and run it:
$ curl -L http://xrl.us/perlbrewinstall | bash [enter] $ /opt/perlbrew/bin/perlbrew init [enter]
I actually reviewed the script before executing it, do not just run stuff off the internet without knowing what you are doing.
- modify your login script
In my case I use the bash shell, so I modified my .bashrc file (log off and back in to see the changes later):
export PERLBREW_ROOT=/opt/perl5 source /opt/perl5/etc/bashrc source /opt/perl5/etc/perlbrew-completion.bash
After this, just install a new Perl version. You will need a c compiler, make and patch:
$ perlbrew install perl-5.14.2 [enter] $ perlbrew switch perl-5.14.2 [enter]
The 1st step could take a long time depending on how fast your host is. After it is done, you will have a new Perl at your disposal.
$ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux Copyright 1987-2011, Larry Wall .....
and this is the system's Perl:
$ /usr/bin/perl -v This is perl, v5.10.1 (*) built for i386-linux-thread-multi Copyright 1987-2009, Larry Wall ....
compile perl for intel 32bits in a 64bits intel host
With perlbrew you can also cross compile Perl for other processor architectures. This is how I did it for i686.
In a redhat host you need the 32 compilers, libraries etc to do it.
$ perlbrew install perl-5.14.2 --as perl-5.14.2-i686-linux-thread-mult -Dcc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib/x86_64-linux-gnu/' -Darchname=i686-linux-thread-multi -Dusethreadscc='cc -m32' -Dplibpth='/lib64 /usr/lib64 /usr/lib/ /usr/lib'
This will compile everything to your defined PERLBREW_ROOT dir.
When it's done, just switch to it:
$ perlbrew use perl-5.14.2-i686-linux-thread-mult $ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for i686-linux-thread-multi