shadowsocks go 一键安装

本脚本适用环境:

系统支持:CentOS,Debian,Ubuntu
内存要求:≥128M
日期:2015年08月01日

关于本脚本:

一键安装 go 版的 shadowsocks 最新版本 1.1.4。据说 go 版本有 buff 。与 python 版不同的是,其客户端程序能使用多个服务端配置,本脚本安装的是服务端程序。作者默认推荐 aes-128-cfb 加密,基于一致性,脚本使用了 aes-256-cfb 加密方式。

默认配置:

服务器端口:自己设定(如不设定,默认为 8989)
客户端端口:1080
密码:自己设定(如不设定,默认为teddysun.com)

客户端下载:

http://sourceforge.net/projects/shadowsocksgui/files/dist/

使用方法:

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

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

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

1
2
3
4
5
6
7
8
9
Congratulations, shadowsocks-go install completed!
Your Server IP:your_server_ip
Your Server Port:your_server_port
Your Password:your_password
Your Local Port:1080
Your Encryption Method:aes-256-cfb

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

卸载方法:

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

1
./shadowsocks-go.sh uninstall

其他事项:

客户端配置的参考链接:http://teddysun.com/339.html
安装完成后即已后台启动 shadowsocks-go ,运行:

1
/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

多用户多端口配置文件 sample(2015年01月08日):
配置文件路径:vi /etc/shadowsocks/config.json

1
2
3
4
5
6
7
8
9
10
11
{
"port_password":{
"8989":"password0",
"9001":"password1",
"9002":"password2",
"9003":"password3",
"9004":"password4"
},
"method":"aes-256-cfb",
"timeout":600
}

参考链接:
https://github.com/shadowsocks/shadowsocks-go
https://github.com/iMeiji/shadowsocks_install/wiki/shadowsocks-go-%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85

搭建Shadowsocks-Server

之前一直使用的搬瓦工的vps搭建的shadowsocks,但是最近被封掉了。正好手里还有一台阿里云香港服务器,所以就自己搭建了一个,下面是搭建流程。

我是使用shadowsocks-go进行搭建的,是基于golang编写的,所以先需要安装golang环境,请自行安装。

shadowsocks-go项目地址:https://github.com/shadowsocks/shadowsocks-go

安装方式:

1
go get github.com/shadowsocks/shadowsocks-go/cmd/shadowsocks-server

安装完成之后请在:$GOPATH/bin 目录下找到:shadowsocks-server 文件。

然后在该文件同文件夹下创建配置文件:config.json,密码端口请自行修改,我们这里使用的服务端端口为:8388

1
2
3
4
5
6
7
8
9
{
"server":"127.0.0.1",
"server_port":8388,
"local_port":1080,
"local_address":"127.0.0.1",
"password":"helloworld",
"method": "aes-128-cfb",
"timeout":600
}

另外阿里云默认情况下8388端口是不对外开放的,请去阿里云控制到,找到对应的ecs实例,找到该实例的安全组,将8388端口添加到白名单。