1、
ubuntu下在root权限下运行,(最好是root权限):
apt-get install python-pip
pip install shadowsocks
或者python3版本
apt-get install python3-pip
pip3 install shadowsocks
2、配置
sudo vim /etc/shadowsocks.json
新建一个json文件,配置ss
配置文件的内容大致如下:
{ "server":"你的vps服务器的ip",
"server_port":你的vps服务器的端口,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"你的vps服务器的密码",
"timeout":300,
"method":"aes-256-cfb",
"fast_open":false }
除了粗体内容,其余均是默认配置
3、
输入命令启动ss
sslocal -c /etc/shadowsocks.json
可以通过ssloacl或者sslocal -help查看配置选项
如果想要科学上网,还没完~
4、转换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/”
curl www.google.com
如果正常,就会返回抓取到的Google网页内容。
另外,在浏览器中输入http://127.0.0.1:8123/便可以进入到Polipo的使用说明和配置界面
5、配置浏览器
在firefox中preference->advanced->network->connection->settings中选择手动设置代理,
并将http代理设置为127.0.0.1 端口8123(根据你在/etc/polipo/config配置的端口)
一般做到这步应该就能通过shadowsocks访问外网了,可以尝试一下。
假如还是不行,再将手动设置代理中http代理下面的“Use this proxy server for all protocols(将代理应用到所有协议)”也钩上。
6、开机自启