虽然现在有V2Ray、Trojan这种隐蔽性更强的网络工具,但是Shadowsocks-libev作为一个轻量化的工具还是很适合性能不强的设备使用(最近比较容易被封)。
1、安装shadowsocks
安装dnf
DNF (short for “DaNdiFied Yum”) is the next upcoming major version of Yum, a package manager for RPM-based Linux distributions, such as RHEL, CentOS, and Fedora. DNF is first introduced in Fedora 18, and it has became the default package manager from Fedora 25 version.
1
2
| $ yum install epel-release
$ yum install dnf
|
启用repo
1
2
| $ dnf install dnf-plugins-core
$ dnf copr enable librehat/shadowsocks
|
也可以从Fedora Copr下载repo,并放到/etc/yum.repos.d/。
安装shadowsocks-libev
1
2
| $ dnf update
$ dnf install shadowsocks-libev
|
2、编辑配置文件
/etc/shadowsocks-libev/config.json
1
2
3
4
5
6
7
8
9
10
| {
"server":"0.0.0.0",
"server_port":8388,
"local_port":1080,
"password":"password",
"timeout":600,
"method":"aes-256-cfb",
"mode":"tcp_and_udp",
"fast_open": false
}
|
shadowsocks-libev不支持多端口号
3、启动服务
1
2
3
| $ systemctl enable shadowsocks-libev #设置开机启动
$ systemctl start shadowsocks-libev
$ systemctl status shadowsocks-libev #查看服务状态
|
4、开放防火墙端口
1
2
| $ firewall-cmd --zone=public --add-port=8388/tcp --permanent
$ firewall-cmd --zone=public --add-port=8388/udp --permanent
|
使防火墙规则生效
1
| $ systemctl restart firewalld
|
5、如何排查错误
- 查看shadowsocks-libev是否正确启动并监听相应端口
1
2
| $ netstat -lnp | grep ss-server
$ netstat -autn
|
- 查看shadowsocks-libev日志
1
| $ journalctl -u shadowsocks-libev
|
可以使用增加-f命令显示更新日志
- 查看通过ss-server启用了那些服务
1
| $ ps ax | grep ss-server
|
6、前台运行服务
可以使用ss-server前台运行服务
例如:
1
| $ ss-server -s 0.0.0.0 -p 8383 -k password -u -m aes-256-gcm
|
参考
- CentOS安装shadowsocks-libev服务端
- Shadowsocks – libev 服务端的部署
- 自己搭建Shadowsocks服务器