本文介绍了在 o conf init/proxy/后使用 CPAN 代理失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在公司环境中有一个 Linux 机器,其中 Web 访问通过需要身份验证的代理进行门控.

I have a Linux box in a corporate environment in which web access is gated through a proxy which requires authentication.

在第一次运行 cpan 时,它会自动配置它通常所做的一切:

During a first run of cpan it auto configures everything that it normally does:

自动配置除urllist"之外的所有内容.请立即调用o conf init urllist"来配置您的 CPAN 服务器!

提交:写'/usr/lib/perl5/5.10.0/CPAN/Config.pm'

commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

知道我有一个代理可以导航,并阅读了有关代理和 cpan I 的文档和网络上的几个页面:

Knowing that I have a proxy to navigate, and having read the docs and several pages on the web about proxy and cpan I:

cpan[1]> o conf init/proxy/

如果您通过代理访问网络,您可以在CPAN 配置或通过环境变量.中的变量$CPAN::Config 优先.

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_proxy?[] 10.12.8.9:3128

Your http_proxy? [] 10.12.8.9:3128

你的 no_proxy?[]

Your no_proxy? []

如果您的代理是身份验证代理,您可以存储您的用户名永久性.如果您不想这样,只需按 RETURN.然后你会在以后的每个会话中都被要求提供您的用户名.

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

您的代理用户 ID?[] my_net_id

Your proxy user id? [] my_net_id

您的身份验证代理密码也可以存储永久在磁盘上.如果这违反了您的安全策略,只需按返回.以后每次都会要求您输入密码会话.

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

CPAN:Term::ReadKey 加载正常 (v2.30)你的代理密码?请记得调用 'o conf commit' 以使配置永久生效!

CPAN: Term::ReadKey loaded ok (v2.30) Your proxy password? Please remember to call 'o conf commit' to make the config permanent!

cpan[2]> o conf 提交提交:写'/usr/lib/perl5/5.10.0/CPAN/Config.pm'

cpan[2]> o conf commit commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

现在应该一切顺利吧?所以我希望,

All should be good now, right?So I wish,

cpan[3]> i/Some::Module/CPAN:可存储加载正常 (v2.18)

我想连接到以下站点之一以获取'作者/01mailrc.txt.gz':

I would like to connect to one of the following sites to get 'authors/01mailrc.txt.gz':

http://www.perl.org/CPAN/ ftp://ftp.perl.org/pub/CPAN/

尝试连接到 Internet 可以吗?[是] LWP 不可用

Is it OK to try to connect to the Internet? [yes] LWP not available

尝试使用/usr/bin/curl -L -f -s -S --netrc-optional"来获取http://www.perl.org/CPAN/authors/01mailrc.txt.gz curl: (22) 请求的 URL 返回错误:407

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get http://www.perl.org/CPAN/authors/01mailrc.txt.gz curl: (22) The requested URL returned error: 407

系统调用/usr/bin/curl -L -f -s -S --netrc-optional"http://www.perl.org/CPAN/authors/01mailrc.txt.gz" >/root/.cpan/sources/authors/01mailrc.txt.tmp29726"返回状态 22 (wstat 5632) 警告:预期文件 [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp29726] 不存在

System call "/usr/bin/curl -L -f -s -S --netrc-optional "http://www.perl.org/CPAN/authors/01mailrc.txt.gz" > /root/.cpan/sources/authors/01mailrc.txt.tmp29726" returned status 22 (wstat 5632) Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp29726] doesn't exist

尝试使用/usr/bin/wget -O/root/.cpan/sources/authors/01mailrc.txt.tmp29726" 获取http://www.perl.org/CPAN/authors/01mailrc.txt.gz--2012-07-17 15:57:38-- http://www.perl.org/CPAN/authors/01mailrc.txt.gz 连接到10.12.8.9:3128... 已连接.代理请求已发送,正在等待响应... 301 永久移动位置:http://www.cpan.org/authors/01mailrc.txt.gz[下列的]--2012-07-17 15:57:38-- http://www.cpan.org/authors/01mailrc.txt.gz 正在连接到 10.12.8.9:3128... 已连接.已发送代理请求,等待响应... 407 需要代理身份验证2012-07-17 15:57:38 错误 407:需要代理身份验证.

Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/01mailrc.txt.tmp29726" to get http://www.perl.org/CPAN/authors/01mailrc.txt.gz --2012-07-17 15:57:38-- http://www.perl.org/CPAN/authors/01mailrc.txt.gz Connecting to 10.12.8.9:3128... connected. Proxy request sent, awaiting response... 301 Moved Permanently Location: http://www.cpan.org/authors/01mailrc.txt.gz [following] --2012-07-17 15:57:38-- http://www.cpan.org/authors/01mailrc.txt.gz Connecting to 10.12.8.9:3128... connected. Proxy request sent, awaiting response... 407 Proxy Authentication Required 2012-07-17 15:57:38 ERROR 407: Proxy Authentication Required.

那么密码提示在哪里?

将 cpan 配置为通过具有身份验证的公司代理访问 Internet 时,我缺少什么?

What am I missing to configure cpan to access the internet through the corporate proxy with authentication?

推荐答案

安装 LWP.cpan 实用程序正在使用 curl,我猜是因为它无法加载 LWP.没有代理参数传递给 curl,因此在运行命令之前您需要导出 http_proxy=http://host:port/.

Install LWP. The cpan utility is using curl, I guess because it couldn't load LWP. No proxy parameters are being passed to curl, so you need the export http_proxy=http://host:port/ before running the command.

或者,如果您可以使用发行版的包管理器安装 LWP,那么它应该正确配置代理访问.

Or, if you can install LWP using your distribution's package manager, then it should configure the proxy access correctly.

这篇关于在 o conf init/proxy/后使用 CPAN 代理失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:35