这里写自定义目录标题

  • 全局proxy
  • ubuntu apt repo proxy
  • centos yum repo proxy
  • pip proxy
  • current bash shell
  • Docker proxy
    • User level
    • Docker daemon level

全局proxy

更新 /etc/environment

http_proxy=http://10.0.0.1:8080
https_proxy=http://10.0.0.1:8080
ftp_proxy=http://10.0.0.1:8080
no_proxy="127.0.0.1,localhost"

也可以更新 /etc/profile, /etc/environment是设置整个系统的环境,而/etc/profile是设置所有用户的环境,前者与登录用户无关,后者与登录用户有关。
但profile 中写法不一样

export http_proxy=http://10.0.0.1:8080
export https_proxy=http://10.0.0.1:8080
export ftp_proxy=http://10.0.0.1:8080
export no_proxy="127.0.0.1,localhost"

ubuntu apt repo proxy

更新 /etc/apt/apt.conf

Acquire::http::proxy "http://10.0.0.1:8080/";
Acquire::ftp::proxy "http://10.0.0.1:8080/";
Acquire::https::proxy "http://10.0.0.1:8080/";
## 访问这个IP 不走proxy,直接访问,相当于no_proxy
Acquire::http::proxy::192.168.34.77 DIRECT;

centos yum repo proxy

update /etc/yum.conf

proxy=10.0.0.1:8080
# 如果要认证
proxy=10.0.0.1:8080
proxy_username=aaa
proxy_password=bbb

pip proxy

可以直接读取系统的代理设置。
如果没有设置,可以用下面的方法手工设置一下

export https_proxy=https://username:password@proxyserver:port

然后就可以安装了

pip install somepackage

也可以直接在命令行中直接指定proxy

pip install --proxy=https://[username:password@]proxyserver:port somepackage

current bash shell

export http_proxy=xxxxxx

Docker proxy

User level

On the Docker client, create or edit the file ~/.docker/config.json in the home directory of the user which starts containers.

{"proxies":{"default":{"httpProxy": "http://127.0.0.1:3001","httpsProxy": "http://127.0.0.1:3001","noProxy": "*.test.example.com,.example2.com"}}
}

Docker daemon level

  1. Create a systemd drop-in directory for the docker service:
sudo mkdir -p /etc/systemd/system/docker.service.d
  1. Create a file named /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80"
Environment="HTTPS_PROXY=https://proxy.example.com:443"
Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
  1. Flush changes and restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
  1. Verify that the configuration has been loaded and matches the changes you made, for example:
sudo systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80 HTTPS_PROXY=https://proxy.example.com:443 NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp

Linux proxy 设置相关推荐

  1. Ubuntu下的PROXY设置

     用过Linux的都知道,众多的PROXY配置,让人应接不暇,本文列出常见的一些PROXY的配置 1.apt-get proxy 的配置 sudo gedit /etc/apt/apt.conf  ...

  2. linux操作系统-设置静态ip

    在使用linux虚拟机的时候因为经常有关机的需求,然后重新开机后可能面临这上一次获取的ip被改变,在这里我分享一下在linux 下设置静态ip的经验 1.查看路由状态 [root@localhost ...

  3. 在Linux里设置环境变量的方法(export PATH)

    在Linux里设置环境变量的方法(export PATH) 在Linux里设置环境变量的方法(export PATH) 一般来说,配置交叉编译工具链的时候需要指定编译工具的路径,此时就需要设置环境变量 ...

  4. linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 MySQL 服务的问题

    linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 MySQL 服务的问题 参考文章: (1)linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 M ...

  5. WIN7上VM中的LINUX如何设置上网

    WIN7上VM中的LINUX如何设置上网? 这个问题的关键是VM的版本,只有VM8开始才能支持WIN7上的调协上网.如果安装的版本比这低,直接下载VM8重新安装是最快捷的方法. 在安装VM8的过程中设 ...

  6. Linux离线时间设置(NTP)

    linux离线时间设置 为什么需要使用到NTP时间同步服务 ,在做某些服务时,我们需要所有的服务器保持同一时间执行预设好的命令,将服务同步协作. 操作方法如下: 先关闭firewalld 和 Seli ...

  7. linux系统中建立网络白名单,Linux下设置防火墙白名单(RHEL 6和CentOS 7)的步骤

    进入Linux 命令行,编辑防火墙规则配置文件 iptables vi /etc/sysconfig/iptables 下面是一个白名单设置的例子: # Firewall configuration ...

  8. Linux(Ubuntu)设置环境变量(转载)

    Linux(Ubuntu)设置环境变量(转载) http://blog.csdn.net/wumingxing0228/article/details/6050175 环境变量是和Shell紧密相关的 ...

  9. Linux里设置环境变量的方法(export PATH)

    转自:在Linux里设置环境变量的方法(export PATH) 一般来说,配置交叉编译工具链的时候需要指定编译工具的路径,此时就需要设置环境变量.例如我的mips-linux-gcc编译器在&quo ...

最新文章

  1. Linux Shell脚本Ldd命令原理及使用方法
  2. 教程:一起学习Hystrix--服务(依赖)失败场景的表象
  3. Coursera吴恩达《优化深度神经网络》课程笔记(1)-- 深度学习的实用层面
  4. linux apache 2.2下载,Linux下的Apache 2.2.* SSL证书安装
  5. 3 - SQL Server 2008 之 使用SQL语句删除约束条件
  6. Atmel megaAVR控制器 串行引导Bootloader
  7. 设计模式(三)创建型模式
  8. arcgis两点之间连线_使用ArcGIS制作城市关系强度图(附数据下载)
  9. 台风路径超级计算机,厄尔尼诺又要来了?2号台风或要生成,超级计算机:路径争议大...
  10. 董明珠回应口罩预约不到:没想到几十万人预约 正提高产能
  11. 动态规划实战15 leetcode-256. Paint House
  12. Peer-To-Peer 综述(P2P技术综述)
  13. 读书报告1500字计算机大学篇,大学生读书报告1500.doc
  14. Arranging Coins 排列硬币
  15. DOS命令字典..收藏
  16. android搜索app下载地址,如何找出APP的URL Scheme
  17. python控制机器人走8字_爱,死亡和机器人 第十四集 齐马蓝 中文字幕(Python处理utf8文件获取想要的内容)...
  18. java 读取ssh2协议得到的数据_Java通过SSH2协议执行远程Shell脚本
  19. Swing关于JButton的文本和图片之间间距调整的问题纪要!
  20. ArcGIS教程:等值线

热门文章

  1. HTML5+CSS3小实例:简约不简单的社交分享按钮
  2. 光纤:光纤和光纤布线
  3. 嵌入式(stm32)学习之路---MIDI音乐播放器
  4. Golang项目 Go Build时报错
  5. Linux文件类型与属性
  6. left join,join和right join区别
  7. sql查询每科成绩的最高分_SQL查询语句: 查询 每科目分数最高的5项(学生姓名,科目,分数)...
  8. 接口测试中的接口到底是什么?
  9. 【MapReduce】MapReduce综合练习
  10. 无盘服务器网线接法,无盘经验:解析网吧千兆网线的标准做法