pgintro.net

Perlbrew

作成日時:2018/11/18

更新日時:2018/11/18

スポンサーリンク

この記事の確認環境

OS

$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

perlbrew

$ perlbrew version
/home/pgintro/perl5/perlbrew/bin/perlbrew  - App::perlbrew/0.86

perlbrew公式サイト

perlbrewのインストール方法

公式サイトに記載されている手順に沿って以下コマンドを実行します。

$ curl -L https://install.perlbrew.pl | bash

以下のコマンド等でパスを通す

ログアウト後もパスを通す場合は、ユーザーのbashrc等にも同様の記述を行います。

$ source ./perl5/perlbrew/etc/bashrc

perlのインストール方法

「perlbrew available」コマンドでインストール可能なperlバージョンを確認し、その中から任意のバージョンのperlをインストールします。

以下はユーザー「pgintro」で「perl-5.28.1」をインストール使用した場合の出力

$ perlbrew install perl-5.28.1
Installing /home/pgintro/perl5/perlbrew/build/perl-5.28.1/perl-5.28.1 into ~/perl5/perlbrew/perls/perl-5.28.1

This could take a while. You can run the following command on another shell to track the status:

  tail -f ~/perl5/perlbrew/build.perl-5.28.1.log

しばらくたった後以下のような出力がされればインストール完了です。

上記の出力例で「tail -f ~/perl5/perlbrew/build.perl-5.28.1.log」となっている部分のコマンドを別シェルにで実行すればインストールの進捗が確認可能です。

perl-5.28.1 is successfully installed.

以下のような出力がされた場合はインストールに失敗しています。

ログファイルの内容を確認し、エラーに対処して再度インストールを実行します。

Installation process failed. To spot any issues, check

  /home/pgintro/perl5/perlbrew/build.perl-5.28.1.log

If some perl tests failed and you still want to install this distribution anyway,
do:

  (cd /home/pgintro/perl5/perlbrew/build/perl-5.28.1/perl-5.28.1; make install)

You might also want to try upgrading patchperl before trying again:

  perlbrew install-patchperl

Generally, if you need to install a perl distribution known to have minor test
failures, do one of these commands to avoid seeing this message:

  perlbrew --notest install perl-5.28.1
  perlbrew --force install perl-5.28.1

ログに以下のような出力がされていた場合はpatchコマンドのインストールでエラーが解消される場合があります。

Auto-guessed '5.28.1'
No patch utility found
patching Configure
##### Brew Failed #####

yumの場合のpatchコマンドのインストール

# yum install patch

インストール可能なperlバージョン一覧表示

$ perlbrew available

出力例

先頭に「i」が付いているものはインストール済みのものです。

i  perl-5.29.8   
i  perl-5.28.1   
   perl-5.28.0   
  cperl-5.26.4   
  cperl-5.26.5   

インストール済みperlバージョンの一覧表示

$ perlbrew list

出力例

先頭に「*」が付いているものは現在設定されているものです。

 * perl-5.29.8                 
   perl-5.28.1                 

perlバージョン設定

「perl-5.29.8」に設定する場合

$ perlbrew switch perl-5.29.8

「perlbrew list」コマンドの出力で指定したバージョンの先頭に「*」が付いているか、または「which perl」コマンドで指定したperlにパスが変更されているかどうかで正常に設定できたか確認できます。

perlバージョン設定解除

$ perlbrew switch-off

出力例

以下のように出力された場合は正常に設定が解除されています。

perlbrew is switched off.

ヘルプ表示

$ perlbrew help