web-dev-qa-db-ja.com

CPANの最初の起動(プロキシ構成)

cpanトラフプロキシを実行する必要がありますが、設定しようとするとエラーが発生し、初めてcpanに入ることができません

root@srv-linux01:~# cpan

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] no

プロキシ設定の場合:

If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

 <ftp_proxy>
Your ftp_proxy? [] http://username:password@proxyIP:Port/  <---- is ok the information?

 <http_proxy>
Your http_proxy? [] http://username:password@proxyIP:Port/  <---- is ok the information?

 <no_proxy>
Your no_proxy? []



If your proxy is an authenticating proxy, you can store your username
permanently. If you do not want that, just press ENTER. You will then
be asked for your username in every future session.

Your proxy user id? []     <---- username is needed again?


Your password for the authenticating proxy can also be stored
permanently on disk. If this violates your security policy, just press
ENTER. You will then be asked for the password in every future
session.

Your proxy password?     

そしてその前に私はこれを手に入れます。

Fetching with HTTP::Tiny:
http://www.Perl.org/CPAN/MIRRORED.BY.gz
Error downloading with HTTP::Tiny: Not a CODE reference at /usr/share/Perl/5.18/CPAN/HTTP/Client.pm line 112, <STDIN> line 65.

Ubuntu Server 14.04LTSとPerl5.18.2を使用しています

ありがとう

4

ええ、これはかなり腹立たしいです。

This SO answer は、LWP(およびその18の依存関係)をインストールすると問題が改善される可能性があることを示唆しています。まあ、それに頼る必要がなかったのはうれしいです。 。

これに関して私が抱えていた問題は、すでにhttp_proxyhttps_proxy、およびそれらのセット(およびエクスポート)の大文字バージョン両方が環境にあることでした。これらの環境変数が存在する場合、他のほぼすべてのプログラム(wgetおよびcurlを含む)は正常に機能します。これらを再度設定する必要はありませんでしたが、stillCPANが失敗し、明らかに呼び出している場合to wget

私にとって最終的に機能したのはの指示に従うことでした ここ 、CPAN http_proxyconfig設定を空の文字列に設定しました。 (以前、~/.cpan/CPAN/MyConfig.pmを手動で編集して、プロキシのユーザー名とパスワードの設定を削除していました。)

$ cpan  # or Perl -MCPAN -e Shell
cpan[1]> o conf http_proxy ""
cpan[2]> o conf ftp_proxy ""
cpan[3]> o conf proxy_user ""
cpan[4]> o conf proxy_pass ""
cpan[5]> o conf commit
cpan[6]> q

$ # I have a Shell function that does basically this
$ export http_proxy="http://user:pass@proxyserver:8080"
$ for v in HTTP_PROXY https_proxy HTTPS_PROXY ftp_proxy FTP_PROXY; do
> export $v="$http_proxy"
> done

$ cpan i Devel::Repl   # or whatever

次に、おそらく、wgetcpanを呼び出す前に定義された環境変数を使用していましたが、これはもちろん正常に機能します。認証を必要とするプロキシがある場合、Arch wikiの この記事 には、資格情報の入力を求める小さなスクリプトがあり、適切な*_proxyおよび*_PROXY環境変数をすべて設定します。

その点については、公共サービス広告と同様に、重要なパスワードをプレーンテキストの構成ファイルや~/.bashrcに入れないでください。

1
TheDudeAbides