Step1:安裝Shadowsocks客戶端
- 執行
sudo apt-get install python-pip python-m2crypto
sudo pip install shadowsocks
複製程式碼
Step2:配置Shadowsocks客戶端
- 執行:
sudo nano /etc/shadowsocks.json
- 輸入如下內容:
{
"server":"xxx.xxx.xxx.xxx",
"server_port":xxx,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"xxx",
"timeout":600,
"method":"aes-256-cfb",
"fast_open": false,
}
複製程式碼
- "server":填入你的Shadowsocks伺服器IP
- "server_port":填入你的Shadowsocks伺服器用於SS的埠號
- "password":填入你的Shadowsocks賬戶密碼
- "method":填入你的Shadowsocks伺服器使用的加密方法(一般預設為aes-256-cfb)
- 其餘引數保持預設即可,至此shadowsocks配置完成
Step3:新增開機啟動
- 執行:
sudo nano /etc/rc.local
- 在最後一行 exit 0 上面新增如下語句:
/usr/local/bin/sslocal -c /etc/shadowsocks.json -d start
- 檢查能否正確執行:
sudo systemctl status rc-local.service
- 若正確執行,應輸出類似結果:
注:shadowsocks無法執行錯誤解決方案
在執行上一條命令時可能會出現rc.local執行失敗的問題,這是由於shadowsocks執行出錯,單獨執行此命令:
/usr/local/bin/sslocal -c /etc/shadowsocks.json -d start
若報如下的錯誤:
Traceback (most recent call last):
File "/usr/local/bin/sslocal", line 9, in
load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'sslocal')()
....
....
....
AttributeError: /usr/local/lib/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup
複製程式碼
則是由於Openssl庫更新導致的方法名稱變更問題,修復方法如下:
-
執行:
sudo nano /usr/local/lib/python2.7/distpackages/shadowsocks/crypto/openssl.py
-
將語句
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) 複製程式碼
覆寫為
ibcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,) 複製程式碼
- 將語句
覆寫為libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (self._ctx) 複製程式碼
libcrypto.EVP_CIPHER_CTX_reset.argtypes = (self._ctx) 複製程式碼
sudo systemctl status rc-local.service
應該可以成功執行。
Step4:使用Polipo將Sock5流量轉換為HTTP流量
- 關於Polipo:GitHub主頁
- 安裝Polipo:
sudo apt-get install polipo
- 編輯配置檔案:
sudo nano /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=”127.0.0.1:8123”
- 撤銷當前終端設定全域性代理:
unset http_proxy
- 設定全域性代理到終端預設配置:
- 執行:
sudo nano /etc/profile
- 新增如下語句:
export http_proxy=”127.0.0.1:8123”
- 執行:
curl www.google.com
,若成功下載頁面,則代理設定成功
- 執行:
Step5:配置chromium實現科學上網
- 下載SwitchyOmega:Github-Releases
- 安裝SwitchyOmega:開啟chromium的擴充套件程式頁面,將下載的crx檔案拖入
- 配置SwitchyOmega:Github-Wiki