SS协议搭建法

JamesHan Lv2

一、下载 shadowsocks-rust 和 v2ray-plugin 插件

1
2
3
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.20.4/shadowsocks-v1.20.4.x86_64-unknown-linux-gnu.tar.xz

wget https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.3.2/v2ray-plugin-linux-amd64-v1.3.2.tar.gz

二、解压并安装到指定目录

1
2
3
4
5
6
7
apt install xz-utils

mkdir /usr/local/bin/shadowsocks

tar -xf shadowsocks-v1.20.4.x86_64-unknown-linux-gnu.tar.xz -C /usr/local/bin/shadowsocks

tar -xf v2ray-plugin-linux-amd64-v1.3.2.tar.gz -C /usr/local/bin/shadowsocks

三、创建配置文件 config.json

1
vim /usr/local/bin/shadowsocks/config.json

生成密码:

1
openssl rand -base64 32

示例配置(无 TLS):

1
2
3
4
5
6
7
8
{
"server": "0.0.0.0",
"server_port": 443,
"password": "your_password",
"method": "chacha20-ietf-poly1305",
"plugin": "/usr/local/bin/shadowsocks/v2ray-plugin_linux_amd64",
"plugin_opts": "server"
}

示例配置(启用 TLS):

1
2
3
4
5
6
7
8
{
"server": "0.0.0.0",
"server_port": 443,
"password": "your_password",
"method": "chacha20-ietf-poly1305",
"plugin": "/usr/local/bin/shadowsocks/v2ray-plugin_linux_amd64",
"plugin_opts": "server;tls;host=www.example.com;cert=/root/.acme.sh/www.example.com_ecc/fullchain.cer;key=/root/.acme.sh/www.example.com_ecc/www.example.com.key"
}

四、创建 systemd 守护进程配置文件

1
vim /etc/systemd/system/shadowsocks.service

填入以下内容:

1
2
3
4
5
6
7
8
9
10
[Unit]
Description=Shadowsocks Proxy Server
After=network.target

[Service]
ExecStart=/usr/local/bin/shadowsocks/ssserver -c /usr/local/bin/shadowsocks/config.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

五、启动服务

1
2
systemctl daemon-reload
systemctl start shadowsocks

  • 标题: SS协议搭建法
  • 作者: JamesHan
  • 创建于 : 2025-09-30 17:24:20
  • 更新于 : 2025-10-01 10:24:13
  • 链接: https://blog.ai1314.de/posts/163e4502.html
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论