centos 7创建ss服务(方式一)
一:安装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服务(方式一)的更多相关文章
- centos 7创建ss服务(方式二)
一:安装pip yum install python-pip 如果没有python包则执行命令:yum -y install epel-release: 二:安装SS pip install shad ...
- Centos 7创建一个服务
首先创建服务文件 vim /etc/systemd/system/node.service #内容如下 [Unit] Description=ethereum-go Monitor Daemon Af ...
- CentOS VPS创建pptpd VPN服务
原文地址http://www.hi-vps.com/wiki/doku.php?id=xen_vps_centos6_install_pptpd CentOS VPS创建pptpd VPN服务 Xen ...
- 创建Windows服务(Windows Services)N种方式总结
最近由于工作需要,写了一些windows服务程序,有一些经验,我现在总结写出来.目前我知道的创建创建Windows服务有3种方式:a.利用.net框架类ServiceBaseb.利用组件Topshel ...
- (转)创建Windows服务(Windows Services)N种方式总结
转自:http://www.cnblogs.com/aierong/archive/2012/05/28/2521409.html 最近由于工作需要,写了一些windows服务程序,有一些经验,我现在 ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第13章节--使用业务连接服务创建业务线解决方式 SP Apps中的BCS
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第13章节--使用业务连接服务创建业务线解决方式 SP Apps中的BCS 之前的联系中,你安装了一个业 ...
- 使用.NET Core中创建Windows服务(一) - 使用官方推荐方式
原文:Creating Windows Services In .NET Core – Part 1 – The "Microsoft" Way 作者:Dotnet Core Tu ...
- 使用.NET Core创建Windows服务(二) - 使用Topshelf方式
原文:Creating Windows Services In .NET Core – Part 2 – The "Topshelf" Way 作者:Dotnet Core Tut ...
- 使用.NET Core创建Windows服务 - 使用.NET Core工作器方式
原文:Creating Windows Services In .NET Core – Part 3 – The ".NET Core Worker" Way 作者:Dotnet ...
随机推荐
- 面试 16:栈的压入压出队列(剑指 Offer 第 22 题)
我们今天继续来看看周五留下的习题: 面试题:输入两个整数序列,第一个序列表示栈的压入顺序,请判断二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如:压入序列为{1,2,3,4,5},那{ ...
- LeetCode 832. Flipping an Image
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resu ...
- 一、Xadmin------安装
翻译:http://xadmin.readthedocs.io/en/docs-chinese 1.安装方法: 1)pip install django-xadmin 2)通过源文件安装,我是通过这种 ...
- python 获取gearbest地址库代码
import requests import json # 用来去掉多余的字符,并格式化 def geshihua(str): s = None if "/**/_get_country(& ...
- 最短路DAG
边权皆为正时,有最短路DAG. 最短路DAG代表了从原点到每个点的所有最短路. 最短路树个数=最短路DAG生成树个数.用DAG生成树计数即可.复杂度\(O(n+m)\).
- python获取当前日期时间
转载自:https://www.cnblogs.com/wenBlog/p/6023742.html 在Python里如何获取当前的日期和时间呢?在Python语言里,我们可以通过调用什么模块或者类函 ...
- Of Study
Bacon Reading maketh a full man; conference a ready man; and writing an exact man. And therefore, if ...
- mysql uuid() 相同 重复
mysql select UPPER(REPLACE(uuid(),'-','')) from xxxtable 得到相同的uuid的问题 - LWJdear的博客 - CSDN博客 https:// ...
- oracle导出用户下单表或者多表,导入到别的服务器用户下
导出 exp 用户名/密码 file=存放dmp的名称的目录 statistics=none tables =(表名,表名,表名) exp creditfw/credit file=d:\te ...
- Vue+iview实现添加删除类
<style> .tab-warp{ border-bottom: solid 1px #e0e0e0; overflow: hidden; margin-top: 30px; posit ...