版权声明:未经书面许可,禁止盗用发表 https://blog.csdn.net/u013003052/article/details/85214348
以下内容以学习为目的,请勿用作其它
python环境确认
首先确认系统上安装了python和pip
运行以下指令确认:
$ whereis python
$ whereis pip
如果没有安装则需要安装, 缺什么就安装什么原则:
-
先安装扩展源EPEL,是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。如果已经安装跳过此步骤。
-y参数表示,当安装过程提示选择,全部默认为"yes"。$ yum -y install epel-release
-
安装python,如果你已经有了,跳过此步骤。
$ yum -y install python
-
安装pip,如果你已经有了,跳过此步骤。
$ yum -y install pip
安装shadowsock
-
安装
$ pip install shadowsocks
-
创建配置文件/etc/shadowsocks.json
server_port: 表示你要使用的端口,云服务器上实例的安全组,需要注意相对应的端口已经开放。如果没有开,如要上云服务器配置安全组规则。(→阿里云ECS安全组规则配置)
method: 表示对称加密的方式,使用AES密码反馈模式模式加密,cfb密码反馈模式模式。可选aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4, table(→AES全面解析){ "server": "0.0.0.0", "server_port": 8388, "password": "uzon57jd0v869t7w", "method": "aes-256-cfb" }
-
新建启动脚本文件/etc/systemd/system/shadowsocks.service
提示:你可以选择vi或者vim新建这个文件。
[Unit] Description=Shadowsocks [Service] TimeoutStartSec=0 ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json [Install] WantedBy=multi-user.target
-
执行以下命令启动 shadowsocks 服务
$ service shadowsocks start
-
查看状态
$ service shadowsocks status
-
如果要开机启动,将service shadowsocks start写入/etc/rc.local
同时对rc.local增加运行权限$ chmod +x /etc/rc.local