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

  1. 먼저 perlbrew를 설치한다.
    $ curl -Lk 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
    

+ Recent posts