Tools系列04丨常用的PROXY配置

1.配置apt-proxy

sudo vim /etc/apt/apt.conf

## 输入
Acquire::http::Proxy "http://proxy-prc.xx.com:912";
## 或者
Acquire::http::Proxy "http://c-prc.xx.com:913";

2.配置系统或者user的proxy

vim ~/.bashrc   或
sudo vim /etc/environment

## 输入
export http_proxy='http://c-prc.xx.com:913'
export https_proxy='http://c-prc.xx.com:913'

## 执行使生效
source ~/.bashrc   或
source /etc/environment 

3.配置git

git config --global http.proxy http://c-prc.xx.com:913
git config --global https.proxy http://c-prc.xx.com:913

## 查看代理
git config --global http.proxy
git config --global https.proxy

## 删除代理
git config --global --unset http.proxy
git config --global --unset https.proxy

4.docker代理

sudo su

mkdir -p /etc/systemd/system/docker.service.d

cd  /etc/systemd/system/docker.service.d

touch  http-proxy.conf    
touch  https-proxy.conf

## 设置文件权限
chmod 775 http-proxy.conf  
chmod 775 https-proxy.conf 

vim http-proxy.conf       

## 输入
[Service]
Environment="HTTP_PROXY=http://c-prc.xx.com:913" "NO_PROXY=localhost,127.0.0.1"

vim https-proxy.conf

## 输入
[Service]
Environment="HTTPS_PROXY=http://c-prc.xx.com:913" "NO_PROXY=localhost,127.0.0.1"

## 刷新配置
systemctl daemon-reload

## 重启服务
systemctl restart docker

## 查看配置
systemctl show --property=Environment docker