Linux 安装 shadowsocks 服务器

内容纲要

安装 python

centos 8 已经自带 pytho3,如果你的 linux 版本较低,先升级 python

安装 Shadowsocks

pip install shadowsocks

启动停止

# 启动服务
# -p 端口,默认 8388
# -k 密码,默认 password
ssserver -p 8388 -k password -m aes-256-cfb --user nobody -d start

# 停止服务
ssserver -d stop

查看日志

tail -f /var/log/shadowsocks.log

错误处理

因为系统环境差异,在运行 ssserver 时可能会爆出以下错误

loading libcrypto from libcrypto.so.1.1
Traceback (most recent call last):
  File "/usr/local/bin/ssserver", line 11, in <module>
    load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'ssserver')()
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/server.py", line 34, in main
    config = shell.get_config(False)
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/shell.py", line 262, in get_config
    check_config(config, is_local)
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/shell.py", line 124, in check_config
    encrypt.try_cipher(config['password'], config['method'])
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 44, in try_cipher
    Encryptor(key, method)
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 83, in __init__
    random_string(self._method_info[1]))
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 109, in get_cipher
    return m[2](method, key, iv, op)
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py", line 76, in __init__
    load_openssl()
  File "/usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl
    libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
  File "/usr/lib64/python3.6/ctypes/__init__.py", line 356, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib64/python3.6/ctypes/__init__.py", line 361, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib64/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

这是因为 openssl 版本升级造成的不兼容

函数 EVP_CIPHER_CTX_cleanup 在 1.1.0 版本中替换成为 EVP_CIPHER_CTX_reset

根据错误提示,将 /usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py 里的 EVP_CIPHER_CTX_cleanup 替换为 EVP_CIPHER_CTX_reset 即可

Linux 安装 shadowsocks 服务器

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Scroll to top
粤ICP备2020114259号 粤公网安备44030402004258