这里以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
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论