banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

Ubuntu的更改apt-get代理设置

网站服务器切换回国内机房之后就是各种不适应,早上安装 Docker, 一直提示

Get:1 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 docker-engine amd64 1.11.2-0~xenial [14.5 MB]
Err:1 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 docker-engine amd64 1.11.2-0~xenial
Operation too slow. Less than 10 bytes/sec transferred the last 120 seconds
E: Failed to fetch https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine\_1.11.2-0~xenial\_amd64.deb Operation too slow. Less than 10 bytes/sec transferred the last 120 seconds
E: Unable to fetch some archives, maybe run a-get update or try with --fix-missing?

调查后发现是因为 docker 把相关文件放在了 Amazon S3 上,国内只能时好时不好。原因大家都懂

直接修改 “/etc/apt/apt.conf” 文件,配合 Shadowsocks 使用。

Acquire::http::proxy "http://127.0.0.1:1080/";
Acquire::ftp::proxy "ftp://127.0.0.1:1080/";
Acquire::https::proxy "https://127.0.0.1:1080/";

另外,apt-get 也有一个 “-o” 选项,直接跟 apt-get 的设置变量,就不用指定配置文件了,比如

sudo apt-get -o Acquire::http::proxy="http://127.0.0.1:1080/”

其他安装方法 http://get.daocloud.io/#install-docker

参考 http://blog.csdn.net/sww\_simpcity/article/details/8776098

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.