下載Shadowsocks-libev:https://github.com/madeye/shadowsocks-libev
unzip解壓至/home/me/Downloads/AppSrc/shadowsocks-libev
cd到此目錄,運行
./configure
sudo make install
如果運行configure提示ssh header error,請安裝libssl-dev。Centos、Fedora下請安裝zlib-devel。如果提示ssl有問題,Fedora下可安裝openssl-devel。
新建配置文件
sudo nano /etc/shadowcks.json
粘貼進下面文本並保存
{
"server":"服务器的ip",
"server_port":服务器的端口,
"local_port":你的本地端口,默认1080,
"password":"密码",
"timeout":600,
"method":"加密方式"
}
運行下面命令啓動shadowsocks服務
ss-local -c /etc/shadowcks.json
如果提示隨機數不足,可以安裝rng-tools
yum install -y rng-tools
systemctl start rngd
systemctl status rngd
systemctl enable rngd
加入開機自動啟動:
#先建一個log文件
touch /home/me/.sslog
#将下面一行加入/etc/rc.local
/usr/local/bin/ss-local -c /etc/shadowcksB.json > /home/me/.sslog 2>&1 &
Firefox
從這裏下載firefox,或者通過市場安裝。火狐市場好像還沒被干擾,所以直接進插件市場搜索FoxyProxy安裝並重啓。點擊FoxyProxy圖標,新建代理服務器,選擇手動配置代理服務器,輸入127.0.0.1和端口,選中socks v5。URL模式勾選不要對內部網絡選項。保存後轉到訂閱模式,添加新的訂閱模式,訂閱網址http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txthttps://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt,代理服務器選擇剛剛新建的。Format選AutoProxy,Obfuscation選Base64。確定保存,如果訂閱添成功此時前面URL模式中應該多了很多項。最後將工作模式設置爲使用基於其預定義模板,就可以自動分流了。
18年09說06日,Firefox ESR版本也自動升級到了Quantum(版本號>60)。新版對於附加原件有較大改動,以至FoxyProxy老版本不能運行。雖然FoxyProxy作者開發了新版本,但是試用之後沒有找到導入gfwlist.txt的地方。搜了一下,發現SwitchOmega有了火狐的插件,雖然是測試版,用起來卻很好用。在auto swith中導入https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt就能自動分流,而且有加載不到的資源還可快速加入白名單,真實非常方便。
家裏長城寬帶按照上述方法無效。多數內容複製了+McNulty Gracie的帖子。
讓命令行通過shadowsocks的socksv5代理聯網
安裝proxychains
sudo apt-get install proxychains
修改配置文件/etc/proxychains.conf,更改如下4行:
dynamic_chain
#strict_chain
#socks4 127.0.0.1 9050
socks5 127.0.0.1 1234 #你的本地代理地址和端口
測試下proxychains:
proxychains wget -O - http://myip.dnsdynamic.org/ | more
#如果成功會顯示出你代理服務器的IP
Ubuntu搭建Shadowsocks
安裝
sudo apt-get install python-pip python-m2crypto supervisor
sudo pip install shadowsocks
编辑 /etc/shadowsocks.json
#sudo nano /etc/shadowsocks.json
{
"server":"0.0.0.0",
"server_port":服务器的端口,
"local_port":1080,
"password":"密码",
"timeout":600,
"method":"aes-256-cfb"
}
编辑 /etc/supervisor/conf.d/shadowsocks.conf
#sudo nano /etc/supervisor/conf.d/shadowsocks.conf
[program:shadowsocks]
command=ssserver -c /etc/shadowsocks.json
autorestart=true
user=nobody
#如果端口 < 1024,把上面的 user=nobody 改成 user=root
在 /etc/default/supervisor 最后加一行:
ulimit -n 51200
reboot或者
service supervisor start
supervisorctl reload
Ubuntu或CentOS分享Shadowsocks給局域網用戶
安裝polipo
sudo apt-get install polipo
在配置文件/etc/polipo/config的末尾貼上下面的配置信息
proxyAddress = "0.0.0.0"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
重啟polipo
/etc/init.d/polipo restart
現在就可以在局域網設備上使用http代理了,主機為運行ssclient的ip地址,端口為8123。
本文更新於 2024/04/19。