【Linux】Yum/Wget/Curl设置代理的方法


Linux系统使用yum 的设置代理的方法

如果只需要使用yum来更新包的,只需进行yum配置即可。

[root@localhost ~]# vim /etc/yum.conf
proxy=ftp://192.168.99.99:80
proxy_password=password ####代理的密码
然后直接用yum安装即可

wget设置代理的方法

[root@localhost ~]# vim /etc/wgetrc
http_proxy=192.168.99.99:80
http_proxy=192.168.99.99:443

curl访问代理设置的方法

curl --proxy proxy_server:443 http://www.alipay.com
[root@localhost ~]# curl -I --proxy 192.168.99.99:80 www.baidu.com
###显示http访问的状态码
HTTP/1.1 200 OK
备注:上边有介绍,详见上边内容。

使用设置全局代理的方法

[root@localhost ~]# vim /etc/profile
http_proxy = http://192.168.99.99:80
http_proxy = http://192.168.99.99:443
ftp_proxy = http://192.168.99.99:80/
export http_proxy
export ftp_proxy