admin

Debian 12 编译安装shadowsocks-rust过程(Deepseek写的)
1.更新系统,并确定架构确定架构 (通常是 x86_64)apt update && apt up...
扫描右侧二维码阅读全文
17
2026/02

Debian 12 编译安装shadowsocks-rust过程(Deepseek写的)

1.更新系统,并确定架构确定架构 (通常是 x86_64)

apt update && apt upgrade -y
uname -m

2. 下载最新版本(去 GitHub Releases 复制最新版链接(根据架构选择要下载的版本),此处以 v1.21.2 为例)

cd /tmp
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.21.2/shadowsocks-v1.21.2.x86_64-unknown-linux-gnu.tar.xz

3. 解压并安装到 /usr/local/bin

sudo mkdir -p /usr/local/bin/ss-rust
sudo tar -xJf shadowsocks-v1.21.2.x86_64-unknown-linux-gnu.tar.xz -C /usr/local/bin/ss-rust

4. 将目录加入PATH(方便直接运行)

echo 'export PATH=$PATH:/usr/local/bin/ss-rust' >> ~/.bashrc
source ~/.bashrc

5. 验证安装

ssserver -V

6. 生成 AEAD-2022 密钥(现代加密推荐)

 Shadowsocks-Rust 支持新一代的 AEAD-2022 加密协议,需要使用工具生成特定格式的密钥,而不是随意设一个密码
# 生成密钥(以 2022-blake3-aes-256-gcm 为例)
ssservice genkey -m "2022-blake3-aes-256-gcm"
# 命令行会输出一串类似 "U4x7Pp9e7YpZ0cZb..." 的密钥,请务必复制保存好

如果不使用AEAD-2022,可以跳过这一步

7. 创建配置文件

# 创建配置目录
sudo mkdir -p /etc/shadowsocks-rust

# 编辑配置文件
sudo nano /etc/shadowsocks-rust/config.json

8.在配置文件中填入以下内容(将password的 your_generated_key 替换为你生成的完整长密钥,method也替换成实际用的协议)

{
    "server": "::",
    "server_port": 8388,
    "password": "your_generated_key",
    "method": "2022-blake3-aes-256-gcm",
    "timeout": 300,
    "mode": "tcp_and_udp"
}

监听 "::" 可以同时支持 IPv4 和 IPv6 连接 。

9.配置 systemd 服务以实现开机自启

sudo nano /etc/systemd/system/shadowsocks-rust.service

写入以下内容:

[Unit]
Description=Shadowsocks Rust Server
After=network.target
Wants=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks-rust/config.json
Restart=on-failure
RestartSec=5
# 基础安全加固
NoNewPrivileges=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target

然后,启动并启用服务:

sudo systemctl daemon-reload
sudo systemctl enable --now shadowsocks-rust
sudo systemctl status shadowsocks-rust # 查看运行状态
# 查看实时日志
journalctl -u shadowsocks-rust -f

10.重启服务器

reboot
Last modification:February 17th, 2026 at 01:36 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment