linux下设置软件使用socks5代理

1.为wget使用代理,可以直接修改/etc/wgetrc,也可以在主文件夹下新建.wgetrc,并编辑相应内容,本文采用后者。

直接往~/.wgetrc(自行创建此文件)添加如下内容:

https_proxy = http://127.0.0.1:8087/
http_proxy = http://127.0.0.1:8087/
ftp_proxy = http://127.0.0.1:8087/
use_proxy = on

这样设置就可以了。

注意:如果不想使用代理了就将~/.wgetrc中的最后一行use_proxy = on改为 use_proxy = off即可.

 

2.为apt-get 使用代理

2.1安装tsocks

sudo apt-get install tsocks

2.2设置tsocks的配置文件

vi /etc/tsocks.conf

往其中加入如下内容:

 server = 127.0.0.1

 server_type = 5

 server_port = 8087

 

3.使用tsocks

在要使用的软件前面加上tsocks即可,比如:

sudo tsocks apt-get update

 

posted @ 2017-07-22 17:15  Jello  阅读(9073)  评论(0编辑  收藏  举报