HostUS VPS 搭建 SS

购买一波三折,一切开始之前,先 ping 主机,不通就找客服换 IP

环境为CentOS 7,HostUS的Debian有点莫名其妙,SSH连不上去,可能是主机SSH配置有问题

#ssh root@$IP

#yum update

Python版本需要大于2.6

#yum install m2crypto python-setuptools vim

#easy_install pip

#pip install shadowsocks

#vim /etc/shadowsocks.json

{
    "server":"$IP",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
        "$PORT":"$PASSWORD"
    },
    "timeout":600,
    "method":"aes-256-cfb"
}

创建systemd,方便日后维护

#vim /etc/systemd/system/shadowsocks.service

[Unit]
Description=Shadowsocks
 
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
 
[Install]
WantedBy=multi-user.target

后来重装系统后发现有问题, 好像又没法自启了, 可以试试下面这个

[Unit]
Description=Shadowsocks Server
After=network.target
 
[Service]
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/shadowsocks
ExecStartPre=/bin/chown nobody:nobody /run/shadowsocks
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
Restart=on-abort
User=nobody
Group=nobody
UMask=0027
 
[Install]
WantedBy=multi-user.target

#systemctl enable shadowsocks

#systemctl start shadowsocks

不是activity的话就说明有问题

#systemctl status shadowsocks

猜你喜欢

转载自www.cnblogs.com/seliote/p/9313564.html
今日推荐