-
安装shadowsocks
sudo apt-get install python-pip sudo pip install shadowsocks
-
配置文件(自己创建文件/etc/shadowsocks.json)
{ "server":"your_server_ip", # ss服务器IP "server_port":your_server_port, # 端口 "local_address": "127.0.0.1", # 本地ip "local_port":1080, # 本地端口 "password":"your password", "timeout":300, "method":"aes-256-cfb" }
-
启动
nohup sslocal -c /etc/shadowsocks.json /dev/null 2>&1 &
-
安装privoxy
sudo apt-get install privoxy
-
配置
sudo vi /etc/privoxy/config # 添加如下内容 forward-socks5 / 127.0.0.1:1080 .
-
启动服务设置全局代理
# 开启privoxy 服务就行 sudo service privoxy start # 设置http 和 https 全局代理 export http_proxy='http://localhost:8118' export https_proxy='http://localhost:8118'
-
设置代理
git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:1080'
-
取消代理
git config --global --unset http.proxy git config --global --unset https.proxy