一:安装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. git 的 cat-file 的命令用法

    命令选项 git cat-file 的命令显示版本库对象的内容.类型.及大小信息. -t  Instead of the content, show the object type identifie ...

  2. 使用redis实现生产者消费者模式

    本次主要分享一下使用redis做缓存队列,实现生产者消费者模式. 首先先来看一下redis提供的列表操作接口.像ListRightPush就和符合队列先进先出的原则. 然后围绕这个列表已下单为例简要实 ...

  3. (深度好文)重构CMDB,避免运维之耻

    (深度好文)重构CMDB,避免运维之耻 CMDB,几乎是每个运维人都绕不过去的字眼,但又是很多运维人的痛,因为CMDB很少有成功的,因此我也把它称之为运维人的耻辱. 那么到底错在哪儿了?该如何去重构它 ...

  4. Javascript 小练习

    --------------------------要收获别人五年才能收获的东西,你就要做好准备,遭受别人五人所遭受的坎坷” // -------------------------------*** ...

  5. 一种简单有效的VBA源代码加密办法,支持64位宿主,适用于大部分VBA代码加密

    原始出处:http://www.cnblogs.com/Charltsing/p/EncryptVBACode.html VBA代码加密是个老生常谈的问题,自从本人的VBA Dumper发布之后,在O ...

  6. Solrcloud(Solr集群)

    Solrcloud(Solr集群) Solrcloud介绍: SolrCloud(solr集群)是Solr提供的分布式搜索方案. 当你需要大规模,容错,分布式索引和检索能力时使用SolrCloud. ...

  7. PAT L2-023 图着色问题

    https://pintia.cn/problem-sets/994805046380707840/problems/994805057298481152 图着色问题是一个著名的NP完全问题.给定无向 ...

  8. HTTPS的SSL证书配置

    SSL证书 TOMCAT7.0部署_百度经验https://jingyan.baidu.com/article/7082dc1c65066be40a89bda8.html SSL证书安装指引 - 青春 ...

  9. c#+linux+mono+Redis集群(解决无法连接Redis的问题)

    在linux环境中使用mono来执行c#的程序, 在连接redis的时候遇到了无法连接数据库的错误.如下: Unhandled Exception:StackExchange.Redis.RedisC ...

  10. JS 获取链接中的参数

    1.获取链接全部参数,以对象的形式返回 //获取url中参数 function GetRequest() { var url = location.search; //获取url中"?&qu ...