Ubuntu 16.04下安装ss服务端

来源:互联网 发布:java链表实现 编辑:程序博客网 时间:2024/05/22 02:20

1.安装python

apt-get update

apt-get install python-gevent python-pip

2.安装ShadowSocks

pip install shadowsocks

 

3.新建一个配置文件

vim /etc/ss.json

{

    "server":"local ip",

    "server_port":8888,

    "local_port":1080,

    "password":"12345678",

    "timeout":600,

    "method":"aes-256-cfb"

}

 

4.配置启动  

 

Vi /etc/systemd/system/ssserver.service

 

[Unit]

Description=ss server

 

[Service]

Type=forking

User=root

PAMName=login

PIDFile=/root/.ss/%H.pid

ExecStartPre=/usr/local/bin/ssserver -c /etc/ss.json -d stop > /dev/null 2>&1

ExecStart=/usr/local/bin/ssserver -c /etc/ss.json -d start > /dev/null 2>&1

[Install]

WantedBy=multi-user.target 

 

 

接下来,让系统知道新的单元文件。 

sudo systemctl daemon-reload

启用单位文件。 

sudo systemctl enable ssserver.service

停止ss服务器的当前实例(如果它仍在运行)。 

/usr/local/bin/ssserver -c /etc/ss.json -d stop

然后启动它,因为您将启动任何其他systemd服务。 

sudo systemctl start ssserver.service

您可以验证它以此命令开始: 

sudo systemctl status ssserver.service