- 系统支持:CentOS 6+,Debian 7+,Ubuntu 12+ - 内存要求:≥128M - Debian关闭防火墙:iptables -P INPUT ACCEPT ## 关于本脚本 1、一键安装 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版(四选一)服务端; 2、各版本的启动脚本及配置文件名不再重合; 3、每次运行可安装一种版本; 4、支持以多次运行来安装多个版本,且各个版本可以共存(注意端口号需设成不同); 5、若已安装多个版本,则卸载时也需多次运行(每次卸载一种); 6、Shadowsocks-Python 和 ShadowsocksR 安装后不可同时启动(因为本质上都属 Python 版)。 ## 注释: 1)Shadowsocks 有几种版本?区别是什么? 首先要明确一点,不管 Shadowsocks 有几种版本,都分为服务端和客户端,服务端是部署在服务器(VPS)上的,客户端是在你的电脑上使用的。 Shadowsocks 服务端大体上有 4 种版本,按照程序语言划分,分别为 Python ,libev ,Go , Nodejs ,目前主流使用前 3 种。 Shadowsocks 客户端几乎包括了所有的终端设备,PC ,Mac ,Android ,iOS ,Linux 等。 其实作者已经作了详细总结,包括 UDP 转发,多用户等 Feature ,具体可参考《Feature Comparison across Different Versions》一文,英文很简单,耐心一点,能看懂的。 2)Shadowsocks 的最低安装需求是多少? 个人建议最少 128MB 内存,因为在连接数比较多的情况下,还是占用不少内存的,如果内存不足,进程就会被系统 kill 掉,这时候就需要手动重启进程。当然,低于 128MB 也是可以安装的,Go 版是二进制安装,无需编译,非常简单快捷,libev 版运行过程中,占用内存较少,可以搭建在 Openwrt 的路由器上。 自己个人使用,且连接数不是特别大的情况下,64MB 内存也基本够用了。如果你要分享给朋友们一起使用,最好还是选用大内存的。 3)为什么我安装(启动) Shadowsocks 失败? 我只能说脚本并没有在所有的 VPS 上都测试过,所以遇到问题是在所难免的。大部分情况下,请参考《Troubleshooting》一文,自行解决。据我所知,很多人都是配置文件出了问题导致的启动失败。还有部分是改错了 iptables 导致的。 在 Amazon EC2 ,百度云,青云上启动失败,连接不上怎么办? 在这类云 VPS 上搭建,需要注意,配置服务器端时,应使用内网IP;Amazon EC2 缺省不允许 inbound traffic,需要在security group里配置允许连接的端口,和开通SSH client连接类似,这个在 Amazon EC2 使用指南里有说明。同样的,青云,百度云也差不多,默认不允许入网流量,网卡绑定的是内网IP,因此需要将配置文件里的 server 值改为对应的内网 IP 后再重新启动。然后在云管理界面,允许入网端口。 我帮人设置了过之后,才发觉这些云和普通的 VPS 不一样,所以需要注意以上事项。 ## 默认配置 服务器端口:自己设定(如不设定,默认为 8989) 密码:自己设定(如不设定,默认为 teddysun.com) 加密方式:自己设定(如不设定,Python 和 libev 版默认为 aes-256-gcm,R 和 Go 版默认为 aes-256-cfb) 协议(protocol):自己设定(如不设定,默认为 origin)(仅限 ShadowsocksR 版) 混淆(obfs):自己设定(如不设定,默认为 plain)(仅限 ShadowsocksR 版) 备注:脚本默认创建单用户配置文件,如需配置多用户,请手动修改相应的配置文件后重启即可。 ## 使用方法 使用root用户登录,运行以下命令: ```lua wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh chmod +x shadowsocks-all.sh ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log ``` 安装完成后,脚本提示如下 ```lua Congratulations, your_shadowsocks_version install completed! Your Server IP :your_server_ip Your Server Port :your_server_port Your Password :your_password Your Encryption Method:your_encryption_method Your QR Code: (For Shadowsocks Windows, OSX, Android and iOS clients) ss://your_encryption_method:your_password@your_server_ip:your_server_port Your QR Code has been saved as a PNG file path: your_path.png Welcome to visit:https://teddysun.com/486.html Enjoy it! ``` ## 卸载方法 若已安装多个版本,则卸载时也需多次运行(每次卸载一种) 使用root用户登录,运行以下命令: ```lua ./shadowsocks-all.sh uninstall ``` ## 启动脚本 启动脚本后面的参数含义,从左至右依次为:启动,停止,重启,查看状态。 - Shadowsocks-Python 版: ```lua /etc/init.d/shadowsocks-python start | stop | restart | status ``` - ShadowsocksR 版: ```lua /etc/init.d/shadowsocks-r start | stop | restart | status ``` - Shadowsocks-Go 版: ```lua /etc/init.d/shadowsocks-go start | stop | restart | status ``` - Shadowsocks-libev 版: ```lua /etc/init.d/shadowsocks-libev start | stop | restart | status ``` ## 各版本默认配置文件 - Shadowsocks-Python 版: ```lua /etc/shadowsocks-python/config.json ``` - ShadowsocksR 版: ```lua /etc/shadowsocks-r/config.json ``` - Shadowsocks-Go 版: ```lua /etc/shadowsocks-go/config.json ``` - Shadowsocks-libev 版: ```lua /etc/shadowsocks-libev/config.json ``` 1、默认加密方式从 aes-256-cfb 改为 aes-256-gcm(Python 和 libev 版); 2、安装时可选 16 种加密方式的其中之一(Python 和 libev 版)。如下所示: aes-256-gcm aes-192-gcm aes-128-gcm aes-256-ctr aes-192-ctr aes-128-ctr aes-256-cfb aes-192-cfb aes-128-cfb camellia-128-cfb camellia-192-cfb camellia-256-cfb chacha20-ietf-poly1305 chacha20-ietf chacha20 rc4-md5 3、安装时可选 9 种加密方式的其中之一(Go 版)。如下所示: aes-256-cfb aes-192-cfb aes-128-cfb aes-256-ctr aes-192-ctr aes-128-ctr chacha20-ietf chacha20 rc4-md5 4、安装时可选 13 种加密方式的其中之一(none 是不加密,ShadowsocksR 版)。如下所示: none aes-256-cfb aes-192-cfb aes-128-cfb aes-256-cfb8 aes-192-cfb8 aes-128-cfb8 aes-256-ctr aes-192-ctr aes-128-ctr chacha20-ietf chacha20 rc4-md5 rc4-md5-6 5、安装时可选 7 种协议(protocol)的其中之一(仅限 ShadowsocksR 版)。如下所示: origin verify_deflate auth_sha1_v4 auth_sha1_v4_compatible auth_aes128_md5 auth_aes128_sha1 auth_chain_a auth_chain_b 6、安装时可选 9 种混淆(obfs)的其中之一(仅限 ShadowsocksR 版)。如下所示: plain http_simple http_simple_compatible http_post http_post_compatible tls1.2_ticket_auth tls1.2_ticket_auth_compatible tls1.2_ticket_fastauth tls1.2_ticket_fastauth_compatible ## 客户端下载 - 常规版 Windows 客户端 https://github.com/shadowsocks/shadowsocks-windows/releases - ShadowsocksR 版 Windows 客户端 https://github.com/shadowsocksr-backup/shadowsocksr-csharp/releases Last modification:August 27, 2018 © Allow specification reprint Support Appreciate the author AliPayWeChat Like If you think my article is useful to you, please feel free to appreciate