CentOS7にperlbrewとcpanmを入れたメモ

新しいサーバにCentOS7を入れたので空っぽの段階から
perlbrewcpanm頑張って入れたメモ。

■ perlbrew を導入する

$ curl -kL http://install.perlbrew.pl | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   315    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1255  100  1255    0     0    674      0  0:00:01  0:00:01 --:--:--  1594

## Download the latest perlbrew

## Installing perlbrew
Can't locate Getopt/Long.pm in @INC (@INC contains: FatPacked::39156136=HASH(0x25579a8) /usr/share/perl5 /usr/lib64/perl5 /usr/local/share/perl5 /usr/local/lib64/perl5) at perlbrew-8920 line 33.
BEGIN failed--compilation aborted at perlbrew-8920 line 33.
Compilation failed in require at perlbrew-8920 line 5795.
BEGIN failed--compilation aborted at perlbrew-8920 line 5795.

んん?Getopt/Long.pmが入ってないだと?
デフォルトで入ってたと思うけど、、、
とりあえず、yumさんで入れてしまおう。

$ sudo yum -y install perl-Getopt-Long
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
パッケージ perl-Getopt-Long-2.40-2.el7.noarch はインストール済みか最新バージョンです
何もしません

やっぱり入ってるじゃないかー!

なんでだとggrと
https://github.com/gugod/App-perlbrew/issues/409

curl -kL http://install.perlbrew.pl | sed "/\$PERLBREWDOWNLOAD/{N;s|$|sed -i -r '/@INC/ s/([)][}])/ vendorlib vendorarch\\\1/' \\\$LOCALINSTALLER\n|}" | bash

とやると良いよと書いてあった。

ということで、上記ワンライナーで試してみる。

$ curl -kL http://install.perlbrew.pl | sed "/\$PERLBREWDOWNLOAD/{N;s|$|sed -i -r '/@INC/ s/([)][}])/ vendorlib vendorarch\\\1/' \\\$LOCALINSTALLER\n|}" | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   315    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1255  100  1255    0     0    739      0  0:00:01  0:00:01 --:--:--  6151

## Download the latest perlbrew

## Installing perlbrew
perlbrew is installed: ~/perl5/perlbrew/bin/perlbrew

perlbrew root (~/perl5/perlbrew) is initialized.

Append the following piece of code to the end of your ~/.bash_profile and start a
new shell, perlbrew should be up and fully functional from there:

    source ~/perl5/perlbrew/etc/bashrc

Simply run `perlbrew` for usage details.

Happy brewing!

## Installing patchperl

## Done.

ということで、インストール出来た!

後はいつもの設定

$ source ~/perl5/perlbrew/etc/bashrc
$ echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bashrc

■ cpanmをインストールする

$ perlbrew install-cpanm

cpanm is installed to

    /home/dimgraycat/perl5/perlbrew/bin/cpanm

ということで、完了!