shadowsocks-libev/rust+obfs
本文将介绍shadowsocks-libev和shadowsocks-rust的一键脚本安装,以及搭载shadowsocks-simple-obfs插件的使用。可能有人会问为什么ss这么易封的协议还要介绍搭建,但其实ss这种古老的协议有它的优势在,且其配合各种插件的使用,并不会那么容易就被封禁。下面将介绍秋水逸冰(Teddysun)大佬编译的脚本搭建方法,此处仅介绍Debian系安装方式:
一、添加Teddysun Shadowsocks Repository公钥
apt-get update
apt-get -y install lsb-release ca-certificates curl gnupg
curl -fsSL https://dl.lamp.sh/shadowsocks/DEB-GPG-KEY-Teddysun | gpg --dearmor --yes -o /usr/share/keyrings/deb-gpg-key-teddysun.gpg
chmod a+r /usr/share/keyrings/deb-gpg-key-teddysun.gpg
二、安装Teddysun Shadowsocks Repository
1、 Debian 10~12系统
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/deb-gpg-key-teddysun.gpg] https://dl.lamp.sh/shadowsocks/debian/ $(lsb_release -sc) main" >/etc/apt/sources.list.d/teddysun.list
2、 Ubuntu 20.04 / 22.04 / 24.04系统
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/deb-gpg-key-teddysun.gpg] https://dl.lamp.sh/shadowsocks/ubuntu/ $(lsb_release -sc) main" >/etc/apt/sources.list.d/teddysun.list
三、重建 repo 缓存
apt-get update
四、安装shadowsocks-libev
注意:由于 Debian / Ubuntu 官方也存在相同的 shadowsocks-libev 软件包,所以要想安装由我提供的 shadowsocks-libev,则需要指定完整的版本号才能安装。其他软件则不受影响。
1、 Debian 10~12系统
apt-get install -y shadowsocks-libev=3.3.5-12~debian.10~buster
apt-get install -y shadowsocks-libev=3.3.5-12~debian.11~bullseye
apt-get install -y shadowsocks-libev=3.3.5-12~debian.12~bookworm
2、 Ubuntu 20.04 / 22.04 / 24.04系统
apt-get install -y shadowsocks-libev=3.3.5-12~ubuntu.20.04~focal
apt-get install -y shadowsocks-libev=3.3.5-12~ubuntu.22.04~jammy
apt-get install -y shadowsocks-libev=3.3.5-12~ubuntu.24.04~noble
其它控制命令:
ss-server -h //查看版本号
/etc/shadowsocks/shadowsocks-libev-config.json //默认配置文件路径
/usr/lib/systemd/system/shadowsocks-libev-server.service //服务端 service 文件
systemctl enable shadowsocks-libev-server --now //开机自启+启动
systemctl start shadowsocks-libev-server
systemctl stop shadowsocks-libev-server
systemctl status shadowsocks-libev-server
journalctl -u shadowsocks-libev-server --output cat -f
五、安装shadowsocks-rust
注:无需指定版本,可直接安装。
apt-get install -y shadowsocks-rust
其它控制命令:
ssservice --version //查看版本号
/etc/shadowsocks/shadowsocks-rust-config.json //默认配置文件路径
/usr/lib/systemd/system/shadowsocks-rust-server.service //服务端 service 文件
systemctl enable shadowsocks-rust-server --now //开机自启+启动
systemctl start shadowsocks-rust-server
systemctl stop shadowsocks-rust-server
systemctl status shadowsocks-rust-server
journalctl -u shadowsocks-rust-server --output cat -f
六、安装simple-obfs
shadowsocks-libev/rust有许多插件可安装,这里介绍最简单常用的obfs,该插件目前已经废弃,不再更新,但其实用性依然很强。
apt-get install -y shadowsocks-simple-obfs
成功安装后,执行以下命令查看版本号:
obfs-server -h
obfs-local -h
七、修改配置文件
1、shadowsocks-libev
查看当时配置文件:
cat /etc/shadowsocks/shadowsocks-libev-config.json
修改配置文件:
cat > /etc/shadowsocks/shadowsocks-libev-config.json <<EOF
{
"server":"0.0.0.0", //ipv6改为::0
"server_port":65031,
"password":"opp33QlG2TRNOB18xt288A==",
"timeout":300,
"method":"aes-256-gcm",
"fast_open":true,
"nameserver":"8.8.8.8",
"mode":"tcp_only",
"plugin":"obfs-server",
"plugin_opts":"obfs=http"
}
EOF
如果主用ipv6,可无需添加obfs (ipv6不易被墙)。
cat > /etc/shadowsocks/shadowsocks-libev-config.json <<EOF
{
"server":"::0",
"server_port":65031,
"password":"opp33QlG2TRNOB18xt288A==",
"timeout":300,
"method":"aes-256-gcm",
"fast_open":true,
"nameserver":"8.8.8.8",
"mode":"tcp_only"
}
EOF
修改完后重启服务即可
systemctl restart shadowsocks-libev-server
2、shadowsocks-rust
查看当时配置文件:
cat /etc/shadowsocks/shadowsocks-rust-config.json
修改配置文件:
cat > /etc/shadowsocks/shadowsocks-rust-config.json <<EOF
{
"server":"0.0.0.0",
"server_port":65032,
"password":"opp33QlG2TRNOB18xt288A==",
"timeout":300,
"method":"aes-128-gcm",
"fast_open":true,
"nameserver":"8.8.8.8",
"mode":"tcp_only",
"plugin":"obfs-server",
"plugin_opts":"obfs=http"
}
EOF
如果主用ipv6,可无需添加obfs (ipv6不易被墙)。
cat > /etc/shadowsocks/shadowsocks-rust-config.json <<EOF
{
"server":"::",
"server_port":65032,
"password":"opp33QlG2TRNOB18xt288A==",
"timeout":300,
"method":"aes-128-gcm",
"fast_open":true,
"nameserver":"8.8.8.8",
"mode":"tcp_only"
}
EOF
修改完后重启服务即可
systemctl restart shadowsocks-rust-server
Done, have fun!