centos7 部署ssserver

时间:2022-02-08 02:33:31

centos7 部署*服务端

为什么要选centos7?

以后centos7 肯定是主流,在不重要的环境还是尽量使用新系统吧

centos7 的坑

默认可能会有firewall 或者iptables启动  需要配置或者关闭,为了省事,我选择关闭
#查看所有的可用服务
systemctl list-unit-files |grep service |grep enable
#关闭服务
systemctl stop ipatables
#开机不启动
systemctl disable iptables

安装

需要Python和pip 这个安装就不多说了
安装*
pip install *
这会给python的bin下面装上 ssserver(ss的服务端) sslocal(ss的代理)
在你的目录下创建
*  下面再创建标准目录  bin, conf, log
把sslocal、ssserver 拷贝到 */bin 下面
然后在*/conf下面创建ss.conf 或者ss.conf 本质是个json文件 .conf是个人习惯
编辑这个文件

{
"server":"你的IP",
"server_port":8888,
"local_port":1080,
"password":"1234567890",
"timeout":600,
"method":"aes-256-cfb",
"workers":16
}

然后尝试启动
/home/nick/*/bin/ssserver -c /home/nick/*/conf/ss.conf

没问题的话,加上后台启动就可以用了。

运行

一般情况下,这种程序我一般都会选择使用supervisor守护进程启动
所以
pip install supervisor 安装supervisor
具体部署和ss基本一样

配置
[program:ssserver]
command=/home/nick/*/bin/ssserver -c /home/nick/*/conf/ss.conf
diretory=/home/nick/*
user=nick

/home/nick/superctl update  加载配置文件

这样就完成了。