作为IT人员,经常需要访问一些国外的技术网站,但是由于种种限制,很多技术网站都无法访问。Android开发者应该体会很深,Android官网无法访问、API无法查看以及很多Android的最新资讯都无法及时了解。本文就教大家一个简单的实现方法,就是在VPS上部署Shadow,下面教大家具体实现步骤:
本文着重讲解如何安装配置,服务器的购买操作不做详细说明,网上有很多,可以参考以下链接
apt-get install python-pip python-gevent python-m2crypto
pip install --upgrade setuptools
pip install shadowsocks
出现Successfully installed shadowsocks-XXX说明安装成功了
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":8888,
"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": {
"8888": "your_password1",
"8889": "your_password2"
},
"timeout":600,
"method":"aes-256-cfb",
"fast_open": false
}
vim /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py
(2)替换文中libcrypto.EVP_CIPHER_CTX_cleanup 为libcrypto.EVP_CIPHER_CTX_reset共两处(大概是52行和111行的位置,把cleanup改成reset),并保存。
ssserver -c /etc/shadowsocks/config.json -d start
如果要停止Shadow执行如下命令(该步骤不需要执行):
ssserver -c /etc/shadowsocks/config.json -d stop
vim /etc/systemd/system/shadowsocks.service
shadowsocks.service的内容如下:
[Unit]
Description=Shadow
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
好了,到此,你的梯子已经搭好了,你现在只要去下载shadowsocks的客户端填上Config.json中的ip地址、端口号、以及密码就可以了。
搭建过程有遇到任何不懂的地方欢迎留言或者联系Q:931003200
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/ShadowX-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