debian 配置安装shaowsocks客户端方法
步骤:
cd ~
下载官方 1.21.0 稳定版
cd ~
下载官方 1.21.0 稳定版
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.21.0/shadowsocks-v1.21.0.x86_64-unknown-linux-gnu.tar.xz
解压缩并移动到/usr/local/bin
解压压缩包
tar -xvf shadowsocks-v1.21.0.x86_64-unknown-linux-gnu.tar.xz
将客户端程序 sslocal 移入系统 bin 目录
sudo mv sslocal /usr/local/bin/
赋予执行权限
sudo chmod +x /usr/local/bin/sslocal
创建配置文件
sudo nano /etc/shaowsocks.json
{
"server":"this.example",
"server_port":443,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"你的密码",
"timeout":300,
"method":"chacha20-ietf-poly1305",
"fast_open": true}
server地址可用域名或ip
配置systemd自动启动
sudo nano /etc/systemd/system/shadowsocks-rust.service
[Unit]
Description=Shadowsocks-rust Client
After=network.target
[Service]
Type=simple
User=root
启动前强制清理潜在冲突进程
ExecStartPre=/usr/bin/pkill -9 sslocal || true
ExecStart=/usr/local/bin/sslocal -c /etc/shadowsocks.json
如果程序意外崩溃,5秒后自动重启
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
激活运行;
sudo systemctl daemon-reload
sudo systemctl enable shadowsocks-rust
sudo systemctl start shadowsocks-rust
验证启动状态
systemctl status shadowsocks-rust
看到绿色的 active (running)
除错:
系统级别代理配置:
测试系统配置状态
ALL_PROXY=socks5://127.0.0.1:1080 curl -I https://www.google.com
快捷开关:
nano ~/.bashrc
alias proxyon='export http_proxy=socks5h://127.0.0.1:1080 && export https_proxy=socks5h://127.0.0.1:1080'
alias proxyoff='unset http_proxy && unset https_proxy'
apt永久代理:
sudo nano /etc/apt/apt.conf.d/80proxy
Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
标签:无