我正在运行以下命令
sudo apt-get install oracle-java7-installer
但是我收到以下错误
Downloading Oracle Java 7...
--2015-03-10 08:13:35-- http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-i586.tar.gz
Connecting to 10.226.33.153:6050... connected.
Proxy request sent, awaiting response... 302 Moved Temporarily
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.57.214.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.57.214.140|:443... failed: Connection refused.
download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing package oracle-java7-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
不过,我可以使用在文件sudo apt-get update
中设置代理 ip:port 后获取更新/etc/apt/apt.conf.d/80proxy
,但它似乎连接到了一个错误的 URL。所以我猜这不是与代理相关的问题。
我尝试清除并重试安装 - 但仍然出现相同的错误。
答案1
如果您使用代理,请尝试在 apt-get 之前添加 -E,它将强制环境使用代理:
sudo -E apt-get install oracle-java7-installer
答案2
您还需要将 HTTPS 重定向到您的代理,将其添加到您的 /etc/apt/apt.conf:
Acquire::HTTP::proxy "http://127.0.0.1:3128";
Acquire::HTTPS::proxy "http://127.0.0.1:3128";