1、安装ShadowSocks
CentOS 8的版本
# dnf install python3
# pip3 install shadowsocks
适合CentOS 8以下的版本
# yum install python-setuptools && easy_install pip
# pip install shadowsocks
2、创建配置文件/etc/shadowsocks.json
# touch /etc/shadowsocks.json
# vim /etc/shadowsocks.json
{ "server":"xx.xx.xx.xx", "server_port": 8899, "local_address": "127.0.0.1", "local_port":1080, "password":"MyPass", "timeout":600, "method":"aes-256-cfb" }
备注:加密方式官方默认使用aes-256-cfb,推荐使用rc4-md5,因为 RC4比AES速度快好几倍。
各字段说明:
server: 服务器IP server_port: 服务器端口 local_port: 本地端端口 password: 用来加密的密码 timeout: 超时时间(秒) method: 加密方法,可选择 “bf-cfb”, “aes-256-cfb”, “des-cfb”, “rc4″等
3、使用配置文件在后台运行shadowsocks服务
# ssserver -c /etc/shadowsocks.json -d start
出现错误,下面解决办法

vim打开文件openssl.py
# vim /usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py
路径不同根据报错路径而定
修改libcrypto.EVP_CIPHER_CTX_cleanup.argtypes
:%s/cleanup/reset/
:x
以上两条为VIM命令, 替换文中libcrypto.EVP_CIPHER_CTX_cleanup.argtypes 为libcrypto.EVP_CIPHER_CTX_reset.argtypes 共两处,并保存再运行服务即可。
备注:若无配置文件,在后台可以使用一下命令运行:
# ssserver -p 8899 -k MyPass -m rc4-md5 -d start
4、停止服务
# ssserver -c /etc/shadowsocks.json -d stop
5、客户端可以在这里下载
https://github.com/shadowsocks
6、如果服务器开启了防火墙,需要开放你配置的端口:
开启配置的服务端口:
# firewall-cmd --zone=public --add-port=端口号/tcp --permanent
关闭配置的服务端口:
# firewall-cmd --zone=public --remove-port=端口号/tcp --permanent
重启防火墙:
# firewall-cmd --reload
查看防火墙开启的端口,应该可以看到处于开启中:
# firewall-cmd --list-ports
一定记得重启shadowsocks:
# ssserver -c /etc/shadowsocks.json -d restart