linux使用socks5代理yum等

作者: 千城program 2017-01-25 23:53:23

网上找了有一会linux直接使用shadowsocks的方法,最后发现shadowsocks是socks5,而yum,wget,curl都是http,于是乎找了个socks5转http的方法。


 


1.安装shadowsocks 客户端


easy_install shadowsocks


vim /etc/shadowsocks/client.conf  #把下面内容写进去,这个和shadowsocks的服务端对应。


{


"server":"x.x.x.x",


"server_port":1443,


"local_address":"127.0.0.1",


"local_port":1080,


"password":"xxxxxx",


"timeout":600,


"method":"aes-256-cfb"


}


nohup /usr/bin/python /usr/bin/sslocal -c /etc/shadowsocks/config.json >> /var/log/sslocal.log 2>&1 &   #启动shadowsocks client


 


2.安装privoxy


yum install privoxy


vim /etc/privoxy/conf  #添加下面内容


forward-socks5 /          127.0.0.1:1080 .


systemctl start privoxy.service #启动privoxy


 


3.设置代理


vim ~/.bashrc #添加下面内容


export http_proxy=http://127.0.0.1:8118/


export https_proxy=http://127.0.0.1:8118/


export ftp_proxy=http://127.0.0.1:8118/


source ~/.bashrc #生效


vim /etc/yum.conf #添加下面内容


proxy=http://127.0.0.1:8118/


yum search gcc


能跑起来就是表示,代理成功了。


 


本文永久更新地址:http://www.linuxdiyf.com/linux/27927.html

相关资讯