Shadowsocks 一键安装脚本(四合一)

技术 秋水逸冰 3784328浏览 1374评论

本脚本适用环境

系统支持:CentOS 6+,Debian 7+,Ubuntu 12+
内存要求:≥128M
日期  :2019 年 01 月 11 日

关于本脚本

1、一键安装 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版(四选一)服务端;
2、各版本的启动脚本及配置文件名不再重合;
3、每次运行可安装一种版本;
4、支持以多次运行来安装多个版本,且各个版本可以共存(注意端口号需设成不同);
5、若已安装多个版本,则卸载时也需多次运行(每次卸载一种);

友情提示:如果你有问题,请先阅读这篇《Shadowsocks Troubleshooting》之后再询问。

默认配置

服务器端口:自己设定(如不设定,默认从 9000-19999 之间随机生成)
密码:自己设定(如不设定,默认为 teddysun.com)
加密方式:自己设定(如不设定,Python 和 libev 版默认为 aes-256-gcm,R 和 Go 版默认为 aes-256-cfb)
协议(protocol):自己设定(如不设定,默认为 origin)(仅限 ShadowsocksR 版)
混淆(obfs):自己设定(如不设定,默认为 plain)(仅限 ShadowsocksR 版)
备注:脚本默认创建单用户配置文件,如需配置多用户,请手动修改相应的配置文件后重启即可。

客户端下载

常规版 Windows 客户端
https://github.com/shadowsocks/shadowsocks-windows/releases

ShadowsocksR 版 Windows 客户端
https://github.com/shadowsocksrr/shadowsocksr-csharp/releases

使用方法

使用root用户登录,运行以下命令:

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

安装完成后,脚本提示如下

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用户登录,运行以下命令:

./shadowsocks-all.sh uninstall

启动脚本

启动脚本后面的参数含义,从左至右依次为:启动,停止,重启,查看状态。

Shadowsocks-Python 版:
/etc/init.d/shadowsocks-python start | stop | restart | status

ShadowsocksR 版:
/etc/init.d/shadowsocks-r start | stop | restart | status

Shadowsocks-Go 版:
/etc/init.d/shadowsocks-go start | stop | restart | status

Shadowsocks-libev 版:
/etc/init.d/shadowsocks-libev start | stop | restart | status

各版本默认配置文件

Shadowsocks-Python 版:
/etc/shadowsocks-python/config.json

ShadowsocksR 版:
/etc/shadowsocks-r/config.json

Shadowsocks-Go 版:
/etc/shadowsocks-go/config.json

Shadowsocks-libev 版:
/etc/shadowsocks-libev/config.json

更新日志

2019 年 01 月 11 日:
1、升级:libsodium 到最新版本 1.0.17;
2、升级:mbedtls 到最新版本 2.16.0;

2018 年 11 月 05 日:
1、升级:使用 Github 上最新代码编译出 Go 版二进制可执行文件,版本号 1.2.2。

2018 年 06 月 01 日:
1、修正:在启用了插件 simple-obfs 的情况下,libev 版启动失败的问题;
2、修正:在使用 /etc/init.d/shadowsocks-libev restart 命令重启 libev 版服务端时,偶尔出现的 “bind: Address already in use” 问题;
3、修正:移除 libev 版配置文件中的 local_address 字段;
4、修改:不再默认使用 root 用户启动,改为使用 nobody 用户启动 libev 版服务端 ss-server;
5、升级:mbedtls 到版本 2.9.0;
6、修改:libev 版启动脚本中的 -u 参数(即同时启用 TCP 和 UDP 模式),改到配置文件里配置为 “mode”: “tcp_and_udp”;
7、修改:libev 版配置文件的内置 NameServers 为 8.8.8.8,默认是从 /etc/resolv.conf 中取得。

2018 年 02 月 07 日:
1、修改:将默认端口从 8989 改为从 9000-19999 之间随机生成。

2018 年 02 月 06 日:
1、修改:ShadowsocksR 版为 ShadowsocksRR 最新版;
2、新增:ShadowsocksR 版的协议(protocol)增加了 4 个,分别为:

auth_chain_c
auth_chain_d
auth_chain_e
auth_chain_f

2017 年 12 月 29 日:
1、升级:libsodium 到 1.0.16。

2017 年 11 月 25 日:
1、如果 Linux 内核版本大于 3.7.0,则配置文件默认支持 TCP fast open;
2、新增:libev 版启动时支持 verbose mode,也就是默认写 log 到 /var/log/messages 方便查看。

2017 年 11 月 12 日:
1、新增生成 ss:// 或 ssr:// 链接,以及其二维码图片。
※ 脚本会根据当前安装的版本以及输入的各项配置,自动生成 ss:// 或 ssr:// 的链接并在安装成功后显示,直接复制即可被客户端识别。同时生成其二维码图片,并保存在当前目录下,下载后用看图软件打开,也能被客户端识别。

复制二维码链接后 Shadowsocks 客户端识别示例:

复制二维码链接后 ShadowsocksR 客户端识别示例:

二维码(QR Code)参考链接:
https://github.com/shadowsocks/shadowsocks/wiki/Generate-QR-Code-for-Android-or-iOS-Clients
https://github.com/shadowsocksr-backup/shadowsocks-rss/wiki/SSR-QRcode-scheme

2017 年 10 月 22 日:
1、升级:libsodium 到 1.0.15。

2017 年 10 月 14 日:
1、新增:在安装 Shadowsocks-libev 版时可选安装 simple-obfs 服务端。
※ 脚本通过判断 autoconf 版本是否大于或等于 2.67 来一键安装 simple-obfs 服务端。并且,支持在安装过程中选择 obfs 为 http 或 tls。
※ 使用方法参考:https://teddysun.com/511.html

2017 年 09 月 16 日:
1、修正:Shadowsocks-libev 版 v3.1.0 使用 libc-ares 替换 libudns 依赖包,解决了依赖问题;
2、升级:mbedtls 到版本 2.6.0。

2017 年 07 月 27 日:
1、新增:ShadowsocksR 版可选协议(protocol)auth_chain_b 。使用该协议需更新到最新(4.7.0) ShadowsocksR 版客户端
2、修改:更新 ShadowsocksR 源码下载地址。

2017 年 07 月 23 日:
1、修正:卸载时可自行选择某个版本卸载,若该版本不存在则报错退出。

2017 年 07 月 22 日:
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、新增:安装时可选 15 种加密方式的其中之一(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
salsa20
xchacha20
xsalsa20
rc4-md5

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

2017 年 02 月 24 日:
1、恢复: 通过 Github API 自动获取 Shadowsocks-libev 的最新 release 版本的功能(v3.0.3)。

2017 年 02 月 13 日:
1、升级: Shadowsocks-libev 版到版本 3.0.2;
2、升级: Shadowsocks-go 版到版本 1.2.1(基于 Github 最新代码,用 go 1.8 编译完成的 x86 和 x86_64 二进制文件);
3、修复:在 Debian 7 下默认没有 libudns-dev 依赖包的问题。

2017 年 02 月 12 日:
1、升级: Shadowsocks-libev 版到版本 3.0.1。

2017 年 01 月 27 日:
1、升级: Shadowsocks-go 版到版本 1.2.1 (仅适用于 x86_64 系统)

更多单版本 Shadowsocks 服务端一键安装脚本

Shadowsocks Python 版一键安装脚本(CentOS,Debian,Ubuntu)
ShadowsocksR 版一键安装脚本(CentOS,Debian,Ubuntu)
CentOS 下 Shadowsocks-libev 一键安装脚本
Debian 下 Shadowsocks-libev 一键安装脚本
Shadowsocks-go 一键安装脚本(CentOS,Debian,Ubuntu)

注意:以上单版本不可与该四合一版本混用。

转载请注明:秋水逸冰 » Shadowsocks 一键安装脚本(四合一)

发表我的评论
取消评论

请输入正确答案后提交评论 *超出时限。 请再次填写验证码。

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1374)

  1. 你好,能推荐几个酸酸乳的加密混肴算法吗,哪种最不容易被检测到,不在乎速度,只在乎稳定,谢谢了
    只想上谷歌6年前(2018-06-04)回复
    • 不存在安全的协议一说,这取决于地区差异。有的人用了很久都安然无恙,有的人开了几分钟就被干死。
      秋水逸冰6年前(2018-06-04)回复
  2. Delta RPMs disabled because /usr/bin/applydeltarpm not installed. 到这儿不动了。
    望星湖畔6年前(2018-06-03)回复
  3. 大佬你好,之前一直用的没有问题。前两天上不去,可以ping通,但是http解析不到。linode网站都能上,就是不能ssh远程。重新搭建vps后,还是不能ssh,提示port: 22 operation timed out. 怎么解决呢,谢谢
    janima6年前(2018-06-03)回复
    • 这说明你被单向阻塞了,6.2号左右GFW升级了,貌似能够匹对部分特征
      elf6年前(2018-06-03)回复
  4. 您好,请问怎么才能进控制面板,修改密码协议混淆这些东西呢
    lea6年前(2018-06-02)回复
  5. CC ss_local-base64.o CC ss_local-plugin.o CC ss_local-http.o CC ss_local-tls.o CC ss_local-rule.o CC ss_local-acl.o CCLD ss-local ss_local-aead.o: In function `aead_cipher_decrypt': /root/shadowsocks-libev-3.2.0/src/aead.c:222: undefined reference to `crypto_aead_xchacha20poly1305_ietf_decrypt' ss_local-aead.o: In function `aead_cipher_encrypt': /root/shadowsocks-libev-3.2.0/src/aead.c:183: undefined reference to `crypto_aead_xchacha20poly1305_ietf_encrypt' collect2: error: ld returned 1 exit status Makefile:689: recipe for target 'ss-local' failed make[2]: *** [ss-local] Error 1 make[2]: Leaving directory '/root/shadowsocks-libev-3.2.0/src' Makefile:480: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/shadowsocks-libev-3.2.0' Makefile:389: recipe for target 'all' failed make: *** [all] Error 2 [Error] Shadowsocks-libev install failed. Please visit: https://teddysun.com/486.html and contact. 这是什么问题?
    L.G.Y6年前(2018-06-02)回复
    • 请检查一下在安装 libsodium 时是否成功安装。 ls -ltr /usr/lib/libsodium*
      秋水逸冰6年前(2018-06-02)回复
  6. checking whether mbedtls supports Cipher Feedback mode or not... ok checking whether mbedtls supports the ARC4 stream cipher or not... ok checking whether mbedtls supports the Blowfish block cipher or not... ok checking whether mbedtls supports the Camellia block cipher or not... ok checking for sodium_init in -lsodium... yes configure: error: Wrong libsodium: version >= 1.0.4 required
    L.G.Y6年前(2018-06-02)回复
  7. 这个怎么管理呢.我重新进服务器需要输入什么命令才会出现最开始那个界面.还是只能说只能进配置文件修改.谢谢,期待你的答复.
    lea6年前(2018-06-01)回复
  8. 请更新config.json的格式,包括引号,使其完全符合github上的范例,否则shadowsocks-libev和simple-obfs都会无法启动。详见:https://github.com/shadowsocks/shadowsocks-libev/issues/2072
    lyf6年前(2018-06-01)回复
  9. 软件包 libcurl.x86_64.0.7.29.0-46.el7 将被 更新 --> 正在检查事务 ---> 软件包 libcurl-devel.x86_64.0.7.29.0-35.el7.centos 将被 升级 ---> 软件包 libcurl-devel.x86_64.0.7.29.0-46.el7 将被 更新 --> 解决依赖关系完成 错误: Multilib version problems found. This often means that the root cause is something else and multilib version checking is just pointing out that there is a problem. Eg.: 1. You have an upgrade for curl which is missing some dependency that another package requires. Yum is trying to solve this by installing an older version of curl of the different architecture. If you exclude the bad architecture yum will tell you what the root cause is (which package requires what). You can try redoing the upgrade with --exclude curl.otherarch ... this should give you an error message showing the root cause of the problem. 2. You have multiple architectures of curl installed, but yum can only see an upgrade for one of those architectures. If you don't want/need both architectures anymore then you can remove the one with the missing update and everything will work. 3. You have duplicate versions of curl installed already. You can use "yum check" to get yum show these errors. ...you can also use --setopt=protected_multilib=false to remove this checking, however this is almost never the correct thing to do as something else is very likely to go wrong (often causing much more problems). 保护多库版本:curl-7.29.0-46.el7.x86_64 != curl-7.50.3-1.el7.centos.x86_64 [Error] Failed to install curl 提示这个怎么回事?
    Linus6年前(2018-06-01)回复
  10. 奇怪,发的评论显示不出来,是延迟还是提交不对呢
    het6年前(2018-05-31)回复
  11. 昨天在谷歌云装Shadowsocks-libev装完也改了防火墙规则,但是怎么都用不了,用curl测试端口显示 ----------------------------- curl ****:8988 curl : 基础连接已经关闭: 接收时发生错误。 ----------------------------- 说明端口肯定是open的 之前导致我一度怀疑谷歌云的防火墙规则是假的....然后改装了go版本发现一切正常,我一度使用go版本可用的端口再次卸载go安装libev,还是用不了....进程什么的都是正常的,配置检查也没有什么问题...
    aiqinxuancai6年前(2018-05-31)回复
  12. root@debian:~# /etc/init.d/shadowsocks-libev status Shadowsocks-libev is stopped root@debian:~# /etc/init.d/shadowsocks-libev start Starting Shadowsocks-libev success root@debian:~# /etc/init.d/shadowsocks-libev start Starting Shadowsocks-libev success root@debian:~# /etc/init.d/shadowsocks-libev start Starting Shadowsocks-libev success root@debian:~# /etc/init.d/shadowsocks-libev start Starting Shadowsocks-libev success root@debian:~# /etc/init.d/shadowsocks-libev status Shadowsocks-libev is stopped root@debian:~# 秋大,我使用Debian8,Debian9安装,安装完成后状态都是停止,然后我手动启动,重新启动,显示启动成功,看下状态,结果还是停止,请问一下是怎么回事?
    魔山6年前(2018-05-30)回复
    • ss-libev升级3.2.0了,如果有obfs的话,Plugin和Plugin-opts参数配置要分开写,不能写成一行了。另外因为工作机制的改变,也不需要指定服务端的本地IP"local_address"和端口"local_port"了,删除这两行配置就可以了~出入你有其它的插件需要配合 { "server":"0.0.0.0", "server_port":8989 "password":"Password", "timeout":300, "method":"aes-256-gcm", "fast_open":false, "plugin":"/usr/local/bin/obfs-server", "plugin_opts":"obfs=http" }
      Jenking6年前(2018-05-31)回复
    • 我的也是这样,你试试先obfs-server关掉看看
      pan6年前(2018-06-01)回复
    • 我也是这个情况,之前装的是没问题的,这两天新安装的才那样!好诡异的样子
      Adamᶻ6年前(2018-06-01)回复
    • 是的,出现了一样的问题,麻烦大佬解决一下
      hyy6年前(2018-06-01)回复
    • 将最后一行插件 "plugin":"",这一行去掉,就可以正常启动了
      hyy6年前(2018-06-01)回复
  13. [2018-05-30 19:34:16] Socket connected to ss server: virmach [2018-05-30 19:34:17] System.Reflection.TargetInvocationException: 操作过程中出现异常,结果无效。 有关异常的详细信息,请查看 InnerException。 ---> System.Net.WebException: 基础连接已经关闭: 发送时发生错误。 ---> System.IO.IOException: 由于远程方已关闭传输流,身份验证失败。 在 System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) 在 System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) 在 System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- 内部异常堆栈跟踪的结尾 --- 在 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result) 在 System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result) --- 内部异常堆栈跟踪的结尾 --- 在 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 在 Shadowsocks.Controller.UpdateChecker.http_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
    sanfeng zhang6年前(2018-05-30)回复
  14. libev在搬瓦工ubuntu18.04上有问题,python是好的
    will6年前(2018-05-30)回复
  15. 楼主,我找到问题了,因为我的加密软件把服务器IP屏蔽了,已解决,谢谢~
    galen6年前(2018-05-30)回复