CentOS Shadowsocks C 服務(wù)部署與配置詳解
環(huán)境準(zhǔn)備與依賴安裝
執(zhí)行系統(tǒng)更新確保軟件包為最新版本:
yum update -y && yum install epel-release -y
安裝編譯基礎(chǔ)工具鏈:
yum groupinstall "Development Tools" -y
yum install git libsodium-devel c-ares-devel -y
源碼編譯與安裝
克隆Shadowsocks C項(xiàng)目倉(cāng)庫(kù):
git clone https://github.com/shadowsocks/shadowsocks-libev.git
cd shadowsocks-libev
執(zhí)行編譯安裝流程:
./configure && make
make install
服務(wù)配置與啟動(dòng)
創(chuàng)建配置文件/etc/shadowsocks.json
:
{
"server":"0.0.0.0",
"server_port":8388,
"password":"your_secure_password",
"method":"chacha20-ietf-poly1305",
"timeout":300
}
啟動(dòng)Shadowsocks服務(wù):
ss-server -c /etc/shadowsocks.json -d start
防火墻與安全加固
開放服務(wù)端口并設(shè)置永久生效:
firewall-cmd --permanent --add-port=8388/tcp
firewall-cmd --permanent --add-port=8388/udp
firewall-cmd --reload
建議配置SELinux策略或設(shè)置為寬容模式:
setenforce 0
系統(tǒng)服務(wù)與自動(dòng)啟動(dòng)
創(chuàng)建Systemd服務(wù)文件/etc/systemd/system/ss.service
:
[Unit]
Description=Shadowsocks Server
After=network.target
[Service]
ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
啟用服務(wù)自啟動(dòng):
systemctl enable ss.service
systemctl start ss.service