这里以centos7.0为例,记录代理服务器设置过程:
1、设置全局代理,需要编辑profile文件
vim /etc/profile
#无用户名密码
export http_proxy=http://proxy_ip:prot
export https_proxy=https://proxy_ip:prot
#有用户名密码
export http_proxy=http://username:password@proxy_ip:prot
export https_proxy=https://username:password@proxy_ip:port
生效配置文件
source /etc/profile
查看当前已设置代理
echo $http_proxy
echo $https_proxy
2.yum的代理设置:
vi /etc/yum.conf
添加下面内容
proxy = http://username:password@yourproxy:8080/
或者
proxy=http://yourproxy:8080
proxy=ftp://yourproxy:8080
proxy_username=username
proxy_password=password
3.Wget的代理设置:
vi /etc/wgetrc
添加下面内容
# Proxy
http_proxy=http://username:password@proxy_ip:port/
ftp_proxy=http://username:password@proxy_ip:port/
4、配置docker http代理:
mkdir -p /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
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"
重启docker服务
systemctl daemon-reload
systemctl restart docker
systemctl show --property=Environment docker