Home > 系统管理 > Ubuntu的更改apt-get代理设置

Ubuntu的更改apt-get代理设置

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

1
2
3
4
5
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使用。

1
2
3
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的设置变量,就不用指定配置文件了,比如

1
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

Categories: 系统管理 Tags: ,
  1. No comments yet.
  1. No trackbacks yet.