仅在终端无连接

No connection only in terminal

我是初学者,我尝试在 VirtualBox 中使用 Fedora 23。我可以使用 Firefox 浏览器访问 Internet。

但是当我尝试在终端中做一些事情时(比如:sudo dnf update)我有一个错误:

Error: Failed to synchronize cache for repo 'fedora' from 'https://mirrors.fedoraproject.org/metalink?repo=fedora-23&arch=x86_64' : Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://mirrors.fedoraproject.org/metalink?repo=fedora-23&arch=x86_64 [Connection timed out after 120002 milliseconds]

我可以使用 Firefox 浏览器打开 link。

您的问题实际上是如何让 dnf 使用代理通过 HTTPS 访问 mirrors.fedoraproject.org。 This guide 将解决问题。

由于您是初学者,我建议您使用 pico 或 nano 而不是 vi。它们对初学者更友好。例如,您只需按 Control+X 即可离开编辑器。

如果您想使用其他控制台程序访问网络,请将您的代理设置为(适配 IP 地址和端口):

 export http_proxy=http://10.0.0.12:8080/
 export https_proxy=$http_proxy

您可以将这些保存到 .bash_profile 中的主目录中以使更改永久生效。