使用版本
1 2 3 CentOS Linux release 7.6.1810 (Core) Linux ecs-w0xX6 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Shadowsocks Libev 3.3.5
一、手动编译安装
参考:
- https://github.com/shadowsocks/shadowsocks-libev#fedora—rhel
- https://b.awei.pub/2019/03/shadowsocks-libev/
1. 安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 yum install epel-release -y yum install git gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y git clone https://github.com/shadowsocks/shadowsocks-libev.git cd shadowsocks-libev git submodule update --init --recursive sh autogen.sh ./configure --disable-documentation make && make install
2. 配置systemctl 管理
+ 添加服务配置
1 2 cp shadowsocks-libev/rpm/SOURCES/systemd/shadowsocks-libev.service /usr/lib/systemd/system/ cp shadowsocks-libev/rpm/SOURCES/systemd/shadowsocks-libev.default /etc/sysconfig/shadowsocks-libev
注意检查 shadowsocks-libev/rpm/SOURCES/systemd/shadowsocks-libev.service 文件
1 ExecStart=/usr/bin/ss-server -c "$CONFFILE" $DAEMON_ARGS
/usr/bin/ss-server 改成 ss-server 的安装目录 默认是在 /usr/local/bin/ss-server
1 ExecStart=/usr/local/bin/ss-server -c "$CONFFILE" $DAEMON_ARGS
+ 操作命令
1 2 3 4 systemctl enable shadowsocks-libev systemctl start shadowsocks-libev systemctl stop shadowsocks-libev systemctl status shadowsocks-libev
相关问题和方案
1. This system doesn’t provide enough entropy to quickly generate high-quality random numbers.
参考
1 2 3 4 5 6 7 8 2020-10-23 22:27:03 INFO: binding to outbound IPv4 addr: 127.0.0.1 2020-10-23 22:27:03 INFO: using tcp fast open 2020-10-23 22:27:03 INFO: UDP relay enabled 2020-10-23 22:27:03 INFO: initializing ciphers... chacha20 2020-10-23 22:27:03 INFO: This system doesn't provide enough entropy to quickly generate high-quality random numbers. Installing the rng-utils/rng-tools, jitterentropy or haveged packages may help. On virtualized Linux environments, also consider using virtio-rng. The service will not start until enough entropy has been collected.
解决方案:
1 2 yum install -y rng-tools rngd -r /dev/urandom
2. tcp fast open 未开启
如果未开启tcp fast open 会出现如下报错
1 2020-10-23 22:27:04 ERROR: fast open is not supported on this platform
解决方案:
1 echo 1 > /proc/sys/net/ipv4/tcp_fastopen
3. ss-sever 升级到3.2.0+ 时 fast_open_connect: Invalid argument
参考
1 2 2020-10-23 23:29:15 ERROR: fast_open_connect: Invalid argument 2020-10-23 23:29:15 ERROR: getpeername: Transport endpoint is not connected
解决方案:
删除配置中的 local_address local_port
其他
centos7 记得配置防火墙
1 2 3 firewall-cmd --permanent --add-port={PORT/tcp,PORT/udp} firewall-cmd --reload firewall-cmd --list-all