1.全局http代理
所有用户
编辑/etc/profile添加
http_proxy="http://username:password@proxy_ip:port" export http_proxy
https_proxy="http://username:password@proxy_ip:port" export https_proxy
ftp_proxy="http://username:password@proxy_ip:port"
export ftp_proxy
用户名和密码如果不需要的话可以不填写,只写IP地址和端口就可以了,像http://123.123.123.123:8000就可以了
网上有好多相关的转载的文章都把 export http_proxy 写成了 export_http_proxy
网上的只几乎都只是把http的那条写上了,运行命令的时候经常就连不上网了,尤其是一些github上的开源项目,那地址都是https的,所以必须要加上https的条目哦,顺手把ftp的也加上吧,有备无患嘛。
单一用户
编辑~/.bash_profile添加
http_proxy="http://username:password@proxy_ip:port" export http_proxy
2.YUM代理
编辑/etc/yum.conf添加
proxy=http://username:password@proxy_ip:port
同样用户名和密码如果不需要的话可以不填写
3.wget代理
编辑/etc/wgetrc添加
https_proxy = http://username:password@proxy_ip:port/ http_proxy = http://username:password@proxy_ip:port/ ftp_proxy = http://username:password@proxy_ip:port/
原文:http://www.cnblogs.com/piaomiao1314/p/centos-proxy.html