Centos 下的代理添加

前言:设代理网址为 http://10.57.10.11:3128/

 

一、全局代理添加

vi /etc/profile
#添加下面内容 (=号两边没有空格)
http_proxy=http://10.57.10.11:3128/
ftp_proxy=http://10.57.10.11:3128/
export http_proxy
export ftp_proxy

#配置修改生效
source /etc/profile  

#配置修改验证
curl http://www.baidu.com

 

二、yum代理添加

vi /etc/yum.conf
#添加下面内容
proxy=http://10.57.10.11:3128/

 

三、Git代理添加

#命令行下执行如下命令设置,命令执行后,可以在~/.gitconfig 文件中可以看到添加结果
git config --global http.proxy http://10.57.10.11:3128/
git config --global https.proxy https://10.57.10.11:3128/

也可以在 ~/.gitconfig 直接添加配置,

 

四、wget 代理添加

vi /etc/wgetrc

#添加下面内容
http_proxy=http://10.57.10.11:3128/
https_proxy=https://10.57.10.11:3128/
ftp_proxy=http://10.57.10.11:3128/

 

五、 anaconda 代理添加

vi ~/.condarc
#文件中添加如下内容
proxy_servers:
    http: http://10.57.10.11:3128
    https: https://10.57.10.11:3128

 

六、apt-get 代理添加

vi /etc/apt/apt.conf
#添加如下内容
Acquire::http::proxy "http://10.57.10.11:3128/";
Acquire::ftp::proxy "ftp://10.57.10.11:3128/";
Acquire::https::proxy "https://10.57.10.11:3128/";

 

posted @ 2022-02-22 22:10  抓住小白白  阅读(87)  评论(0)    收藏  举报