CentOS終端環(huán)境部署Shadowsocks代理
環(huán)境準(zhǔn)備
執(zhí)行以下命令安裝必要組件:
yum install -y python-pip
pip install shadowsocks
代理配置
創(chuàng)建配置文件/etc/shadowsocks.json
:
{
"server":"your_server_ip",
"server_port":8388,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"your_password",
"timeout":300,
"method":"aes-256-cfb"
}
服務(wù)啟停
啟動(dòng)代理服務(wù):
sslocal -c /etc/shadowsocks.json -d start
終止服務(wù)時(shí)執(zhí)行:
sslocal -d stop
網(wǎng)絡(luò)驗(yàn)證
通過curl測(cè)試代理連通性:
curl --socks5 127.0.0.1:1080 http://httpbin.org/ip
開機(jī)自啟
創(chuàng)建systemd服務(wù)文件/usr/lib/systemd/system/sslocal.service
:
[Unit]
Description=Shadowsocks Client
After=network.target
[Service]
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
激活服務(wù):
systemctl enable sslocal
systemctl start sslocal
應(yīng)用適配
配置全局代理:
export ALL_PROXY=socks5://127.0.0.1:1080
驗(yàn)證環(huán)境變量:
env | grep -i proxy