2011-05-23

(Perl) perlbrew 를 이용하여 다양한 버전의 Perl을 설치해보자!

CentOS 5.6 에 기본으로 설치되어 있는 Perl 의 버전은 5.8.8 이다. 버전이 낮아도 한참 낮다. 요즘 다른 OS에는 5.10을 기본으로 사용하도록 되어 있으며, 최신 버전은 5.12 이다. 거기에 벌써 5.14 RC 버전까지 나온 상태이다. 이런 구닥다리 버전을 벗어나서 그나마 남들도 쓰는 버전을 쓰려면, 별도로 Perl 을 설치해야 되는데... 직접 소스 파일을 다운로드하여 컴파일/설치 하는 것도 방법이겠지만... 더욱 유연하고 확장성 있는 방법을 소개하고자 한다. 지난번 pythonbrew 를 이용해서 여러 버전의 python 을 설치하는 법을 알려드렸는데, 이것의 원조인 perlbrew 를 이용하면 우리가 원하는 것을 할 수 있다.



  1. 먼저 perlbrew를 설치한다.
    $ curl -L http://xrl.us/perlbrewinstall | bash
    설치를 완료하면 ~/perl5/perlbrew 가 생성된다. 그리고, 여기에 모든 파일들이 들어있다.
  2. .bashrc 에 다음을 추가한다.
    source ~/perl5/perlbrew/etc/bashrc
  3. Perl 5.12.3 설치해보기
    $ . .bashrc
    $ perlbrew install --force perl-5.12.3
  4. Perl 5.12.3 사용해보기
    $ perlbrew use perl-5.12.3
    $ perl -v
    
    This is perl 5, version 12, subversion 3 (v5.12.3) built for i686-linux
    
    Copyright 1987-2010, Larry Wall
    
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at http://www.perl.org/, the Perl Home Page.
  5. Perl 시스템에 설치된 원래 버전 사용하기
    $ perlbrew off
    
    perlbrew is switched off. Please exit this shell and start a new one to make it effective.
    To immediately make it effective, run this line in this terminal:
    
        exec /bin/bash
    
    $ perl -v
    
    This is perl, v5.8.8 built for i386-linux-thread-multi
    
    Copyright 1987-2006, Larry Wall
    
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at http://www.perl.org/, the Perl Home Page.
  6. perl-5.12.3 을 default Perl 로 설정하기
    $ perlbrew switch perl-5.12.3
    Switched to perl-5.12.3





댓글 2개:

  1. 위 문서대로 하면 안됨~~~ ㅠㅠ 다음 참조 후 수정 바랍니다.
    $ curl -Lk http://xrl.us/perlbrewinstall | bash
    $ echo " source ~/perl5/perlbrew/etc/bashrc " >> .bashrc
    $ source ~/.bashrc
    $ perlbrew install perl-5.14.1
    $ perlbrew switch perl-5.14.1
    $ perl -v This is perl 5, version 14, subversion 1 (v5.14.1) built for i686-linux Copyright 1987-2011, Larry Wall

    답글삭제
  2. 혹시 어떤 부분이 안되시는지요? 잘 안되는 부분을 찦어주시면 더욱 감사하겠습니다.
    아마도 curl 을 통해서 perlbrew를 설치하는 부분이 안된다고 하시는 것 같습니다. http://www.perlbrew.pl/ 공식사이트에서 도 curl -L http://xrl.us/perlbrewinstall | bash 와 같이 하라고 되어 있습니다. 저의 Linux 환경에서도 문제없시 설치되었습니다. 아마도 curl 이 설치된 환경에 따라서 되고 안되고 하는 문제가 있을 듯 합니다. 이 부분에 대해서는 좀 더 연구해봐야겠지요. ^^

    답글삭제