Shadowsocks-go一键安装脚本

技术 秋水逸冰 1257374浏览 701评论

本脚本适用环境:
系统支持:CentOS,Debian,Ubuntu
内存要求:≥64M
日期:2018 年 11 月 05 日

关于本脚本:
一键安装 Go 版的 Shadowsocks 最新版本 1.2.2。与 Python 版不同的是,其客户端程序能使用多个服务端配置,本脚本安装的是服务端程序。
友情提示:如果你有问题,请先参考这篇《Shadowsocks Troubleshooting》后再问。

默认配置:
服务器端口:自己设定(如不设定,默认从 9000-19999 之间随机生成)
密码:自己设定(如不设定,默认为 teddysun.com)
加密方式:自己设定(如不设定,默认为 aes-256-cfb)

Shadowsocks for Windows 客户端下载:
https://github.com/shadowsocks/shadowsocks-windows/releases

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

wget --no-check-certificate -O shadowsocks-go.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-go.sh
chmod +x shadowsocks-go.sh
./shadowsocks-go.sh 2>&1 | tee shadowsocks-go.log

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

Congratulations, Shadowsocks-go server install completed!
Your Server IP        :your_server_ip
Your Server Port      :your_server_port
Your Password         :your_password
Your Encryption Method:your_encryption_method

Welcome to visit:https://teddysun.com/392.html
Enjoy it!

卸载方法:
使用 root 用户登录,运行以下命令:

./shadowsocks-go.sh uninstall

其他事项:
客户端配置的参考链接:https://teddysun.com/339.html

安装完成后即已后台启动 Shadowsocks-go ,运行:

/etc/init.d/shadowsocks status

可以查看 Shadowsocks-go 进程是否已经启动。
本脚本安装完成后,已将 shadowsocks-go 加入开机自启动。

使用命令:
启动:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重启:/etc/init.d/shadowsocks restart
状态:/etc/init.d/shadowsocks status

多用户多端口配置文件示例:
配置文件路径:/etc/shadowsocks/config.json

{
    "port_password":{
         "8989":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "method":"your_encryption_method",
    "timeout":600
}

官方版本的示例 ,详见这里

更多版本 Shadowsocks 服务端一键安装脚本:
ShadowsocksR 版一键安装脚本(CentOS,Debian,Ubuntu)
Shadowsocks Python 版一键安装脚本(CentOS,Debian,Ubuntu)
CentOS 下 shadowsocks-libev 一键安装脚本
Debian 下 shadowsocks-libev 一键安装脚本
Shadowsocks 一键安装脚本(四合一)

更新日志:

2018 年 11 月 05 日:
基于当前 Github 上的最新代码,自主编译 x86 和 x86_64 二进制可执行文件,版本号 1.2.2。

2018 年 03 月 15 日:
基于当前 Github 上的最新代码,自主编译 x86 和 x86_64 二进制可执行文件。

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

2017 年 07 月 22 日:
新增:安装时可选 9 种加密方式的其中之一。如下所示:

aes-256-cfb
aes-192-cfb
aes-128-cfb
aes-256-ctr
aes-192-ctr
aes-128-ctr
chacha20-ietf
chacha20
rc4-md5

2017 年 02 月 18 日:
基于当前 Github 上的最新代码,使用最新的 go 1.8 自主编译 x86 和 x86_64 二进制文件。

2017 年 02 月 13 日:
升级 Shadowsocks-go 版到版本 1.2.1(基于当前 Github 上的最新代码,用 go 1.7.5 自主编译完成的 x86 和 x86_64 二进制文件)。

2017 年 01 月 27 日:
更新 Shadowsocks-go 到版本 1.2.1(仅适用于 x86_64 系统,x86 系统仍是 1.1.5)。

2016 年 05 月 12 日:
新增在 CentOS 7 下的防火墙规则设置。

2016 年 05 月 04 日:
更新 Shadowsocks-go 到版本 1.1.5。

2015 年 08 月 01 日:
新增自定义服务器端口功能(如不设定,默认为 8989)。

2015 年 05 月 11 日:
更新 Shadowsocks-go 到版本 1.1.4。

2015 年 03 月 09 日:
新增支持在 Debian,Ubuntu 下安装。

2015 年 01 月 08 日:
修改了启动脚本 /etc/init.d/shadowsocks ,按照 CentOS 的 chkconfig 标准语法修改了一下(原来使用的是作者 Github 上自带的)。去掉了以 nobody 用户启动 shadowsocks 的方式,改为直接以当前登录用户直接启动(一般是 root 用户)。开机自启动,以及修改端口号提示无权限的问题已经解决。

参考链接:
https://github.com/shadowsocks/shadowsocks-go

转载请注明:秋水逸冰 » Shadowsocks-go一键安装脚本

发表我的评论
取消评论

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

表情

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

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

网友最新评论 (701)

  1. 搬瓦工 使用的go版本(未更新),昨天SS连不上···用最新的代码也一样···换成Python后,可以使用了·· 秋大 这个 是什么原因
    Poby8年前(2016-05-11)回复
  2. 请问下 多人修改是怎么修改 是一段复制进去还是全部修改 有样式吗 小白新手不懂 求教学习不容易啊
    terrance8年前(2016-05-11)回复
    • 文章里有多用户多端口配置文件 sample,如果你看仔细一点的话,就会发现。
      秋水逸冰8年前(2016-05-11)回复
  3. Bandwagonhost 的 VPS 上出现 Trace/breakpoint trap 现象 我的是debian 6 系统出现了这个 重装为centos 7 X64的系统 问题解决 其他系统可以自行测试
    cjw8年前(2016-05-10)回复
  4. 怎么设置ipv6连接?
    熊涛8年前(2016-05-09)回复
  5. 以前用得好好地 今天突然没法使用了,同报错 /etc/init.d/shadowsocks: line 59: 1119 Trace/breakpoint trap $BIN -c $CONFIG_ FILE > /dev/null 2 办瓦工 现在只有用办瓦工自带的来搞了。
    lkainan8年前(2016-05-09)回复
    • 在 Bandwagonhost 的 VPS 上出现 Trace/breakpoint trap 现象的,初步认为是 Bandwagonhost 的系统问题。 经过测试发现,和版本升级无关,唯独在 Bandwagonhost 才会出现这个现象。建议临时换成 libev 版,或者可以发 Ticket 找客服解决此事。
      秋水逸冰8年前(2016-05-09)回复
      • 嗯 多谢博主
        lkainan8年前(2016-05-09)回复
  6. 没法,不能用了,今天,/etc/init.d/shadowsocks: line 59: 906 Trace/breakpoint trap $BIN -c $CONFIG_FILE > /dev/null start failed,折腾两天了,vps。centos5,6号突然就不行了,
    高兴8年前(2016-05-08)回复
    • 这种现象只在 BandwagonHost 的 VPS 上出现过。 你可以尝试一下,把端口设置为三位数以内再试试看。
      秋水逸冰8年前(2016-05-08)回复
      • 设置为三位和两位都不行,我加您qq,帮我远程一下呗。
        高兴8年前(2016-05-09)回复
        • 在 Bandwagonhost 的 VPS 上出现 Trace/breakpoint trap 现象的,初步认为是 Bandwagonhost 的系统问题。 经过测试发现,和版本升级无关,唯独在 Bandwagonhost 才会出现这个现象。建议临时换成 libev 版,或者可以发 Ticket 找客服解决此事。
          秋水逸冰8年前(2016-05-09)回复
          • 我用的不是bandwagonhost,我用的hosthatch,香港服务器,一直很稳定,还便宜,可能也是4号开始就不行了,我把远程地址和密码qq您,您帮我测试一下呗,好像libev得不支持centos5,最小也是cent6.。
            高兴8年前(2016-05-09)回复
  7. 搬瓦工vps无论安装哪个脚本均出现“Trace/breakpoint trap 现象”,今天试了很多个系统和脚本组合均不行,最后发现把端口位数改为三位,成功安装,不知道是不是端口位数限制问题,同此问题的朋友可以试试。我最后测试的是CentOS 6,Shadowsocks Python版一键安装脚本,端口3位数
    David8年前(2016-05-08)回复
  8. 非常感谢您提供的脚本,但是我想升级最新的1.15版本的时候却发现无法卸载?显示-bash: ./shadowsocks-go.sh: No such file or directory 不知道应该如何解决?
    非常感谢8年前(2016-05-07)回复
    • 你当初下载脚本到哪个目录下了? 就在那个目录下执行该命令即可。 另:如果你的 VPS 是 Bandwagonhost 的话,建议还是别用 Go 版了。换 libev 或 Python 版吧。
      秋水逸冰8年前(2016-05-08)回复
      • 我一直是 Bandwagonhost ,最小配置,一年29的那种,用很久很久了,非常正常呀,而且速度感觉比libev和python快,不知道是不是心理作用。。下载目录忘记啦。。
        非常感谢8年前(2016-05-08)回复
        • 最近在 Bandwagonhost 的系统下运行该版本会出现 Trace/breakpoint trap 现象。 如果你一切正常,建议暂时先不要升级或者重启 VPS
          秋水逸冰8年前(2016-05-08)回复
          • 好的,谢谢你啦,1.14没问题的,无论是重启还是什么,另外1.15更新了什么呢?
            非常感谢8年前(2016-05-08)回复
  9. 按照教程配置好后发现连不上,查了下发现服务端shadowsocks程序没有启动,执行启动命令也无法启动,我这是什么原因导致的?此版本是否有问题?之前的版本一切正常 · ······ 省略 1100K .......... .......... .......... .......... .......... 88% 44.0M 0s 1150K .......... .......... .......... .......... .......... 92% 6.88M 0s 1200K .......... .......... .......... .......... .......... 96% 8.86M 0s 1250K .......... .......... .......... .......... .......... 99% 42.3M 0s 1300K 100% 14.9G=0.2s 2016-05-07 06:22:39 (6.48 MB/s) - `shadowsocks-server-linux32-1.1.5.gz' saved [1 331208/1331208] Decompress shadowsocks-server-linux32-1.1.5.gz success. --2016-05-07 06:22:39-- https://raw.githubusercontent.com/teddysun/shadowsocks_ install/master/shadowsocks-go Resolving raw.githubusercontent.com... ip删 Connecting to raw.githubusercontent.com|23.235.44.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2284 (2.2K) [text/plain] Saving to: `shadowsocks-go' 0K .. 100% 31.5M=0s 2016-05-07 06:22:40 (31.5 MB/s) - `shadowsocks-go' saved [2284/2284] shadowsocks-go install success! starting shadowsocks-go /etc/init.d/shadowsocks: line 59: 634 Trace/breakpoint trap $BIN -c $CONFIG_ FILE > /dev/null 2>&1 start failed(这里就发现有问题) Shadowsocks-go start success!(显示正常启动!) Congratulations, shadowsocks-go install completed! Your Server IP: 删 Your Server Port: 删 Your Password: 删 Your Local Port: 1080 Your Encryption Method: aes-256-cfb Welcome to visit:https://teddysun.com/392.html Enjoy it! [root@liqiwei ~]# /etc/init.d/shadowsocks status(发现没有启动) Could not find PID file /var/run/shadowsocks.pid, shadowsocks-go does not appear to be running [root@liqiwei ~]# /etc/init.d/shadowsocks start(启动不了) starting shadowsocks-go /etc/init.d/shadowsocks: line 59: 724 Trace/breakpoint trap $BIN -c $CONFIG_FILE > /dev/null 2>&1 start failed [root@liqiwei ~]#
    David8年前(2016-05-07)回复
    • 奇怪,我在几个系统下测试都没有重现这个问题 能不能把你的安装日志 shadowsocks-go.log 发来给我看一下?
      秋水逸冰8年前(2016-05-07)回复
      • 2016-05-07 10:51:07 (17.8 MB/s) - `shadowsocks-go' saved [2284/2284] shadowsocks-go install success! starting shadowsocks-go /etc/init.d/shadowsocks: line 59: 1119 Trace/breakpoint trap $BIN -c $CONFIG_ FILE > /dev/null 2>&1 start failed Shadowsocks-go start success! Congratulations, shadowsocks-go install completed! Your Server IP: *** Your Server Port: 8989 Your Password: teddysun.com Your Local Port: 1080 Your Encryption Method: aes-256-cfb Welcome to visit:https://teddysun.com/392.html Enjoy it! [root@localhost ~]# /etc/init.d/shadowsocks restart Could not find PID file /var/run/shadowsocks.pid starting shadowsocks-go /etc/init.d/shadowsocks: line 59: 1128 Trace/breakpoint trap $BIN -c $CONFIG_ FILE > /dev/null 2>&1 start failed [root@localhost ~]# /etc/init.d/shadowsocks status Could not find PID file /var/run/shadowsocks.pid, shadowsocks-go does not appear to be running [root@localhost ~]# ~~重启下VPS然后发现SS不能用了.......结果重装系统T T问题依旧、、、
        MarthinZ8年前(2016-05-07)回复
        • 我刚刚修改了一下启动脚本。 这样,你先卸载,再下载最新版脚本,重新跑一下试试看
          秋水逸冰8年前(2016-05-07)回复
    • 我修改了一下启动脚本。 这样,你先卸载,再下载最新版脚本,重新跑一下试试看
      秋水逸冰8年前(2016-05-07)回复
      • shadowsocks-go install success! starting shadowsocks-go /etc/init.d/shadowsocks: line 59: 1222 Trace/breakpoint trap $BIN -c $CONFIG_FILE > /dev/null start failed Shadowsocks-go start success! Congratulations, shadowsocks-go install completed! Your Server IP: *** Your Server Port: 8989 Your Password: teddysun.com Your Local Port: 1080 Your Encryption Method: aes-256-cfb Welcome to visit:https://teddysun.com/392.html Enjoy it! 现在是这样
        MarthinZ8年前(2016-05-07)回复
    • 经测试和网友反馈来看,安装 Shadowsocks Go 版出现 Trace/breakpoint trap 现象的只在 Banwagonhost 出现,其他家的 VPS 都是一切正常。 /usr/bin/shadowsocks-server --version 这个内置命令的执行结果也是 Trace/breakpoint trap 甚至后来我换成老版本的 1.1.4 后问题亦然,因此建议安装 libev 或 Python 版。 应该可以看出,应该是 Bandwagonhost 的系统模板问题。
      秋水逸冰8年前(2016-05-07)回复
  10. starting shadowsocks-go /etc/init.d/shadowsocks: line 57: 1564 Trace/breakpoint trap $BIN -c $CONFIG_FILE > /dev/null 2>&1 start failed GO版本,用5月4日更新的版本就这样了,请问该如何解决
    ss8年前(2016-05-06)回复
    • 我没法重现这个问题。在新安装的 CentOS 32 和 64 位下都没有重现…… 能不能把你的安装日志 shadowsocks-go.log 发来给我看一下?
      秋水逸冰8年前(2016-05-07)回复
  11. 求助啊大神,使用ss服务网站 一直报这个错 是什么鬼..我应该去哪排查。。 Could not load template file no-server-data or one of its included components. Please contact your proxy administrator. If you are the proxy administrator, please put the required file(s)in the (confdir)/templates directory. The location of the (confdir) directory is specified in the main Privoxy config file. (It's typically the Privoxy install directory).
    st8年前(2016-05-05)回复
  12. 不支持table加密模式啊?
    Joe8年前(2016-05-05)回复
    • table 是最不安全的方式,基本就等同于裸奔。
      秋水逸冰8年前(2016-05-05)回复
  13. 不知道版主听说过kcptun 没?
    os8年前(2016-05-04)回复
  14. 遇到了中间提示插入光盘卡住的问题,解决方法是手动编辑/etc/apt/sources.list文件,注释掉cdrom源
    大球掌8年前(2016-05-01)回复
  15. 大神,又来问问题了,我的go版本已装好,不过最近发现我的VPS的空间100%了,只买了1G空间的VPS。是ss服务器端的问题吗?还是SS需要缓存的问题?之前装过好2个版本的SS,都卸载了,虽然看上去没有卸载干净,不过也不会占很大空间的吧?
    flybook8年前(2016-04-23)回复
    • go 版本身不写日志,所以占用很小的空间,大概最多也就几 MB 所以还是检查是不是别的什么程序在写日志吧。
      秋水逸冰8年前(2016-04-23)回复