Ubuntu、Debian下Shadowsocks一键搭建
文章目录
- 测试环境:
- 安装:
- 问题
如果你想在后台运行 Shadowsocks,可以使用 Supervisor, 它可以方便地监控和控制任何程序,实现开机自动启动和后台运行。
下面是 Debian 和 Ubuntu 上的配置方法(如果你是 Linux 新手, 不需要 SELinux,也不了解防火墙配置,也弄不清楚 RHEL 和 CentOS 的版本机制,那就用 Debian 或 Ubuntu 吧,别折腾了),顺便,推荐使用bandwagon的超低价VPS搭建:
最低年付3.99美元:搬瓦工超低价SSD VPS
测试环境:VPS:Bandwagon 5G PROMO V2
系统:Ubuntu 14.04 x86
安装后内存使用率:47.63/512 MB
安装:执行(使用putty等SSH客户端)
PuTTY:Telnet、SSH、rlogin、纯TCP以及串行接口连接软件
apt-get update
apt-get install python-pip python-m2crypto supervisor
pip install shadowsocks
编辑(可以使用winscp等FTP客户i端进行编辑) /etc/shadowsocks.json为:
WinSCP:Windows 环境下使用的 SSH 的开源图形化 SFTP 客户端
{
"server":"0.0.0.0",
"server_port":7325,
"local_port":1080,
"password":"my password",
"timeout":600,
"method":"aes-256-cfb"
}
记得改密码和服务端端口,不要用默认的。
编辑 /etc/supervisor/conf.d/shadowsocks.conf为:
[program:shadowsocks]
command=ssserver -c /etc/shadowsocks.json
autorestart=true
user=nobody
如果端口 < 1024,把上面的 user=nobody 改成 user=root。
在 /etc/default/supervisor 最后加一行:
ulimit -n 51200
执行
service supervisor start
supervisorctl reload
就好了。
问题如果遇到问题,可以检查日志:
supervisorctl tail -f shadowsocks stderr
如果修改了 shadowsocks 配置 /etc/shadowsocks.json, 可以重启 shadowsocks:
supervisorctl restart shadowsocks
如果修改了 Supervisor 的配置文件 /etc/supervisor/*, 可以更新 supervisor 配置:
supervisorctl update