一:安装PIP,由于安装的是python 版本的ss,所以需要先安装PIP;

$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
$ python get-pip.py

二:安装ss

$ pip install --upgrade pip
$ pip install shadowsocks

三:创建配置文件,创建文件所在目录:/etc

#创建文件命令,
$ vi /etc/shadowsocks.json
#若进入了etc目录
$ vi shadowsocks.json

  配置文件内容:

单端口:
 {
 "server":"0.0.0.0",            --服务器IP,直接用0.0.0.0也可【如果阿里云服务器是香港服务器,配置文件中IP地址需要填写内网IP,其它地区不用】
 "server_port":8888,            --端口端口
 "local_address": "127.0.0.1",  --本地地址,可省略
 "local_port":1080,             --本地端口,可省略
 "password":"password",         --密码
 "timeout":300,                 --超时时间,可省略
 "method":"aes-256-cfb",        --加密策略,有多重策略,具体自查
}
多端口:
{
    "server":"0.0.0.0",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{           --每个端口对应一个密码
        ":"password1",
        ":"password2",
        ":"password3"
    },
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open":false
}

四:启动ss

#启动
ssserver -c /etc/shadowsocks.json -d start
#停止
ssserver -c /etc/shadowsocks.json -d stop
#重启
ssserver -c /etc/shadowsocks.json -d restart

#查看是否成功启动
ps -ef | grep shad

五:配置自动启动服务,新建启动脚本文件vi /etc/systemd/system/shadowsocks.service,内容如下:

[Unit]
Description=Shadowsocks

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json

[Install]
WantedBy=multi-user.target

  通过以下命令注册,启动服务

$ systemctl enable shadowsocks
$ systemctl start shadowsocks

  启动后可以查看服务状态

$ systemctl status shadowsocks -l

  若是成功启动

● shadowsocks.service - Shadowsocks
   Loaded: loaded (/etc/systemd/system/shadowsocks.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-08-13 18:03:41 CST; 1h 29min ago
 Main PID: 9567 (ssserver)
   CGroup: /system.slice/shadowsocks.service
           └─9567 /usr/bin/python2 /usr/bin/ssserver -c /etc/shadowsocks.json

六:firewalld防火墙

centos7用的firewalld,若不进行设置,可能会导致SS无法使用,如果是阿里云服务器,则可以在阿里云管理后台设置安全组;

# 开放端口
$ firewall-cmd --permanent --add-port=18381-18385/tcp
# 修改规则后需要重启
$ firewall-cmd --reload 

  

centos 7创建ss服务(方式一)的更多相关文章

  1. centos 7创建ss服务(方式二)

    一:安装pip yum install python-pip 如果没有python包则执行命令:yum -y install epel-release: 二:安装SS pip install shad ...

  2. Centos 7创建一个服务

    首先创建服务文件 vim /etc/systemd/system/node.service #内容如下 [Unit] Description=ethereum-go Monitor Daemon Af ...

  3. CentOS VPS创建pptpd VPN服务

    原文地址http://www.hi-vps.com/wiki/doku.php?id=xen_vps_centos6_install_pptpd CentOS VPS创建pptpd VPN服务 Xen ...

  4. 创建Windows服务(Windows Services)N种方式总结

    最近由于工作需要,写了一些windows服务程序,有一些经验,我现在总结写出来.目前我知道的创建创建Windows服务有3种方式:a.利用.net框架类ServiceBaseb.利用组件Topshel ...

  5. (转)创建Windows服务(Windows Services)N种方式总结

    转自:http://www.cnblogs.com/aierong/archive/2012/05/28/2521409.html 最近由于工作需要,写了一些windows服务程序,有一些经验,我现在 ...

  6. BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第13章节--使用业务连接服务创建业务线解决方式 SP Apps中的BCS

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第13章节--使用业务连接服务创建业务线解决方式  SP Apps中的BCS         之前的联系中,你安装了一个业 ...

  7. 使用.NET Core中创建Windows服务(一) - 使用官方推荐方式

    原文:Creating Windows Services In .NET Core – Part 1 – The "Microsoft" Way 作者:Dotnet Core Tu ...

  8. 使用.NET Core创建Windows服务(二) - 使用Topshelf方式

    原文:Creating Windows Services In .NET Core – Part 2 – The "Topshelf" Way 作者:Dotnet Core Tut ...

  9. 使用.NET Core创建Windows服务 - 使用.NET Core工作器方式

    原文:Creating Windows Services In .NET Core – Part 3 – The ".NET Core Worker" Way 作者:Dotnet ...

随机推荐

  1. python第四章:函数--小白博客

    Python函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.你已经知道Python提供了许多内建函数,比如print().但你也可 ...

  2. NYOJ-16-矩形嵌套 记忆化搜索

    #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> ...

  3. D2. Great Vova Wall (Version 2)

    l链接 [https://codeforces.com/contest/1092/problem/D2] 题意 和D1一样只是不能竖直放了 分析 水平放的话,就只可能是相邻等时才可以,而且你会发现 只 ...

  4. Nice Garland CodeForces - 1108C (思维+暴力)

    You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ...

  5. 一个6亿的表a,一个3亿的表b,通过外间tid关联,你如何最快的查询出满足条件的第50000到第50200中的这200条数据记录

    1.如果A表TID是自增长,并且是连续的,B表的ID为索引 select * from a,b where a.tid = b.id and a.tid>500000 limit 200; 2. ...

  6. numpy中random的使用

    import numpy as np a=np.random.random()#用于生成一个0到1的随机浮点数: 0 <= n < 1.0print(a)0.772000903322952 ...

  7. openstack-KVM-存储配置

    一.块存储设备 1.存储设备类型 IDE SCSI 软盘 U盘 virtio磁盘(KVM使用类型) 2.查看存储设备 lspci | grep IDE lspci | grep SCSI lspci ...

  8. CMMI摘要

    CMMI_百度百科https://baike.baidu.com/item/CMMI CMMI分为哪几个等级?CMMI等级介绍_百度经验https://jingyan.baidu.com/articl ...

  9. MyEclipse配置tomcat报错 - java.lang.UnsupportedClassVersionError: org/apache/lucene/store/Directory : Unsupported major.minor version 51.0

    1 开发Servlet程序时,MyEclipse配置好tomcat与JDK之后,启动时控制台报下列错误: 1 java.lang.UnsupportedClassVersionError: org/a ...

  10. [转帖]wifi 4G 和 蓝牙的区别

    作者:沈万马链接:https://www.zhihu.com/question/64739486/answer/225227838来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...