2012-07-18 149 views
17

后使用CPAN代理服务器失败我在企业环境中有一个Linux机器,通过需要身份验证的代理来访问网络。在初始化/代理服务器/代理服务器/

在CPAN它自动的第一次运行配置的一切,它一般不会:

Autoconfigured everything but 'urllist'. Please call 'o conf init urllist' to configure your CPAN server(s) now!

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

知道我有一个代理服务器浏览,并具有阅读有关代理和CPAN在网络上的文档和几页我:

cpan[1]> o conf init /proxy/

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.

Your ftp_proxy? []

Your http_proxy? [] 10.12.8.9:3128

Your no_proxy? []

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.

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 loaded ok (v2.30) Your proxy password? Please remember to call 'o conf commit' to make the config permanent!

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

现在都应该好了吧? 所以我希望,

cpan[3]> i /Some::Module/ CPAN: Storable loaded ok (v2.18)

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/

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

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

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

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通过身份验证企业代理访问互联网?

回答

9

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

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

+0

我们有一个赢家。虽然看起来像把马车放在马前,但可以手动安装LWP及其18个依赖项,然后cpan将通过代理进行导航。 @卢西亚诺有它。 – MichaelRpdx 2012-07-18 17:44:29

+0

作为从CPAN手动安装19个软件包的替代方法,可以尝试'o conf'将'http_proxy','proxy_user'和'proxy_pass'的所有三个设置为空字符串(或者从〜/ .cpan/CPAN中删除它们/ MyConfig.pm'文本编辑器)。然后确保在您的shell环境中设置了'HTTP_PROXY','HTTPS_PROXY'和小写变体。 _这对我来说是一个全新的来自源代码的Perl安装和一个需要身份验证的公司HTTP代理._ – TheDudeAbides 2017-10-21 01:43:28

3

你可以尝试调用cpan前使用此:

export http_proxy=http://my_net_id:[email protected]:3128/ 

这样也许curl将使用代理。

+0

事实上,输入'10.12.8.9:3128'看起来是错误的。它应该说'http://10.12.8.9:3128'。 – daxim 2012-07-18 15:21:55

+0

@Paulo这没有效果 – MichaelRpdx 2012-07-18 15:48:14

+0

@daxim从我发布的日志中注意到cpan连接到代理服务器,它只是没有做所需的验证 – MichaelRpdx 2012-07-18 15:50:58

22

您需要提供绝对代理URL地址来配置CPAN代理设置。请不要担心,只需提供如下所示的IP地址和端口号。

cpan> o conf init /proxy/ 

Your ftp_proxy? [] ftp://10.12.8.9:3128 

Your http_proxy? [] http://10.12.8.9:3128 

Your no_proxy? [] 

,并提供用户名密码如果需要的话(请确保您有下载权限)

我也有同样的问题,但现在它为我工作。我也应该为你工作。

BR 杰里詹姆斯

+0

这是我删除代理的正确答案。 现有的docker镜像/容器有一个http_proxy的环境,我想解除它。 – 2016-06-08 05:17:02