Ubuntu安装使用Shadowsocks
sudo apt-get install python-pip
pip install shadowsocks
然后在本地任意目录创建配置文件ss_conf.json,比如放到目录/home/wany,内容如下:
{
"server":"server_ip",
"server_port":443,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"password",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
请根据你获得的Shadowsocks帐号信息自行修改这个配置文件,比如服务器、端口和密码等。
接着创建一个脚本文件来启动Shadowsocks,命名为ss_start.sh,输入内容(里面的地址记得换成你自己的):
sslocal -c /home/wany/ss_conf.json
记得给shell添加执行权限。
Shadowsocks转换HTTP代理
Shadowsocks默认是用Socks5协议的,对于Terminal的get,wget等走Http协议的地方是无能为力的,所以需要转换成Http代理,加强通用性,这里使用的转换方法是基于Polipo的。
输入命令安装Polipo:
sudo apt-get install polipo
修改配置文件:
sudo gedit /etc/polipo/config
将下面的内容整个替换到文件中并保存:
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
logSyslog = false
logFile = "/var/log/polipo/polipo.log"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
proxyAddress = "0.0.0.0"
proxyPort = 8123
重启Polipo:
/etc/init.d/polipo restart
设置代理环境变量:
export http_proxy="http://127.0.0.1:8123/"
另外,在浏览器中输入http://127.0.0.1:8123 便可以进入到Polipo的使用说明和配置界面。