Ubuntu 位于公司代理/防火墙后面——我如何安装软件包?

Ubuntu 位于公司代理/防火墙后面——我如何安装软件包?

我有一个全新安装的 Ubuntu 16.04 LTS,但由于我的机器在公司防火墙/代理后面运行,我不知道如何克服这些障碍。我知道我们有一个公司代理,我有使用它的服务器/端口/用户名/密码,但我不知道这是否能解决我的问题。我可能仍需要将包源添加到我们的白名单 IP 地址列表中。

首先,这是我在尝试安装任何软件包时收到的错误消息。

sudo apt install software-center
[sudo] password for alilland:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package software-center is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'software-center' has no installation candidates

我该从哪里开始解开公司给我造成的结呢?

< ----- 编辑 1 ----->

当我sudo apt-get update收到以下错误时...

alilland@TI-AronLilland:~$ sudo apt-get update
[sudo] password for alilland: 
. . . .
Reading package lists... Done
W: The repository 'http://security.ubuntu.com/ubuntu xenial-security Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://us.archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://us.archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://us.archive.ubuntu.com/ubuntu xenial-backports Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/main/binary-i386/Packages  407  Authorization Required
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages  407  Authorization Required
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-amd64/Packages  407  Authorization Required
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-backports/main/binary-amd64/Packages  407  Authorization Required
E: Some index files failed to download. They have been ignored, or old ones used instead.

< ----- 编辑 2 ----- >

添加代理后,htttp://[username]:[password]@[ip address]:[port]我现在收到不同的错误消息,而不是407 Authorization Required我现在看到的403 Forbidden

. . . . 
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/main/binary-i386/Packages  403  Forbidden
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages  403  Forbidden
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-amd64/Packages  403  Forbidden
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-backports/main/binary-amd64/Packages  403  Forbidden
E: Some index files failed to download. They have been ignored, or old ones used instead.

答案1

对于临时代理设置..我的意思是仅针对当前会话运行以下命令:

export http_proxy=http://yourproxyaddress:proxyport

要永久添加此代理设置,请编辑 apt.conf 文件

gksudo gedit /etc/apt/apt.conf

并添加以下行:

Acquire::http::Proxy "http://yourproxyaddress:proxyport";

相关内容