centos-部署shadowsocks
环境
- centos7-64
安装
安装pip
yum install m2crypto python-setuptools easy_install pip
安装shadowsocks
pip install shadowsocks
创建
/etc/shadowsocks.json
1
2
3
4
5
6
7
8
9
10{
"server":"0.0.0.0",
"server_port":80,
"local_port":1080,
"password":"password",
"timeout":600,
"method":"table",
"fast_open":true
}打开TCP fast open
vi /etc/sysctl.conf # turn on TCP Fast Open on both client and server side net.ipv4.tcp_fastopen = 3 sysctl -wp
启动server
ssserver -c /etc/shadowsocks.json
防火墙放行
firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload
使用systemd启动
编写service文件
vim /etc/systemd/system/shadowsocks.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14[Unit]
Description=Shadowsocks Server
After=network.target
[Service]
Type=forking
PIDFile=/run/shadowsocks/server.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/shadowsocks
ExecStart=/usr/bin/ssserver --pid-file /var/run/shadowsocks/server.pid --log-file /var/log/shadowsocks.log -c /etc/shadowsocks.json -d start
Restart=on-abort
[Install]
WantedBy=multi-user.target手动启动
systemctl start shadowsocks
加入到开机启动
systemctl enable shadowsocks