很多IT行業的新人,在工作或者學習中,經常需要查看國外的一些技術網站,但是由於一些限制很多網站都無法訪問,特別是對於Android的開發者來說,雖然現在Android已經有國內官網,但是還是有很多其他的技術信息在國內的官網上無法找到,本文就教大家一個如何訪問這些網站的方法,希望大家在學習研究的時候,少走一些彎路。
本文介紹的是:如何在服務器上部署Shadowsocks的方法。
一、服務器配置
首先得需要一個海外的服務器,這裏我用的是Vultr,經過對比Vultr的性價比很高:速度、價格(最便宜的2.5刀)、流量都很不錯,如果只用來部署Shadowsocks搓搓有餘,還能額外建個小網站。而且可以用支付寶來支付。
- 1、註冊:
- 2、Vultr配置選擇這邊就不介紹了,可以參照以下鏈接,網上有很多類似的文章:
- 3、服務器購買完成後,等幾分鐘,等創建好之後點進去看詳情,記住IP地址、用戶名和密碼。
本文選的系統版本是Ubuntu17 Ubuntu17 Ubuntu17,重要的事情說三遍,系統版本一定要一樣。
二、部署Shadowsocks
1、首先我們要做的是連接服務器,我們需要一個ssh客戶端來連接,我這邊用的是putty(文末附工具下載地址),打開putty後輸入服務器的ip地址點open就可以了,然後輸入用戶名和密碼(鼠標右鍵是粘貼)就進去到你的遠程服務器了。
2、安裝pip和幾個依賴包,安裝過程遇到Y/n的一律輸入Y(按順序執行下面命令):
apt-get install python-pip python-gevent python-m2crypto
pip install --upgrade setuptools
- 3、安裝Shadowsocks:
pip install shadowsocks
出現Successfully installed shadowsocks-XXX說明安裝成功了
- 4、按順序執行下面命令,在/etc目錄下新建文件夾“shadowsocks”,然後在shadowsocks文件夾下新建文件“config.json”:
mkdir /etc/shadowsocks
vim /etc/shadowsocks/config.json
輸入完上面命令之後出現的頁面,就相當於Windows中的記事本。最下一行提示我們當前這個文件是新建的。
在這個視圖中有如下幾個按鍵需要記住“i”:按鍵盤上的i鍵,窗口最底下顯示“insert”,表示當前文件可編輯。“Esc”:編輯完之後按Esc退出編輯模式。“:”:半角的冒號,在非編輯模式下按鍵盤上的冒號(半角),可以進入輸入命令的模式。“w”:在命令模式中輸入w並回車,窗口最下顯示“written”,表示所做的更改已保存。“q”:在命令模式中輸入q並回車,可以退出當前的編輯器。
config.json的內容如下:
{
"server":"0.0.0.0",
"server_port":8388,
"password":"your_password",
"timeout":600,
"method":"aes-256-cfb",
"fast_open": false
}
“server”:是你Vultr服務器的ip地址
“server_port”和”password”可以根據自己的要求設定
如果需要同時開多個端口,config.json的內容可以設置如下:
{
"server":"0.0.0.0",
"port_password": {
"8388": "your_password1",
"8389": "your_password2"
},
"timeout":600,
"method":"aes-256-cfb",
"fast_open": false
}
- 5、執行以下命令啓動Shadowsocks:
ssserver -c /etc/shadowsocks/config.json -d start
停止Shadowsocks執行如下命令:
ssserver -c /etc/shadowsocks/config.json -d stop
- 6、設置Shadowsocks開機自啓動
執行下面的命令,創建shadowsocks.servic文件:
vim /etc/systemd/system/shadowsocks.service
shadowsocks.service的內容如下:
[Unit]
Description=Shadowsocks
After=network.target
[Service]
Type=forking
PIDFile=/run/shadowsocks/server.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/shadowsocks
ExecStartPre=/bin/chown root:root /run/shadowsocks
ExecStart=/usr/local/bin/ssserver --pid-file /var/run/shadowsocks/server.pid -c /etc/shadowsocks/config.json -d start
Restart=on-abort
User=root
Group=root
UMask=0027
[Install]
WantedBy=multi-user.target
設置文件權限:
chmod 755 /etc/systemd/system/shadowsocks.service
啓動服務:
systemctl start shadowsocks
systemctl enable shadowsocks
三、Final
好了,搭建完畢,你現在只要去下載shadowsocks的客戶端填上Config.json中的ip地址、端口號、以及密碼就可以了。
Putty 下載地址:
Windows:https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
MAC:https://putty-for-mac.soft32.com/
shadowsocks客戶端下載地址:
Windows
https://github.com/shadowsocks/shadowsocks-windows/releases
Mac OS X
https://github.com/shadowsocks/ShadowsocksX-NG/releases
linux
https://github.com/shadowsocks/shadowsocks-qt5/wiki/Installation
https://github.com/shadowsocks/shadowsocks-qt5/releases
iOS
https://itunes.apple.com/app/apple-store/id1070901416?pt=2305194&ct=shadowsocks.org&mt=8
https://github.com/shadowsocks/shadowsocks-iOS/releases
https://play.google.com/store/apps/details?id=com.github.shadowsocks
https://github.com/shadowsocks/shadowsocks-android/releases
資源在左上方“我的信息”欄目中
資源在左上方“我的信息”欄目中
資源在左上方“我的信息”欄目中