Shadowsocks服务端安装配置(C&Python版本)

点击上方蓝字▲关注我们吧!

python版本安装

yum install m2cryptopip install shadowsockspip install git+https://github.com/shadowsocks/shadowsocks.git@masterwget https://download.libsodium.org/libsodium/releases/LATEST.tar.gztar zxf LATEST.tar.gzcd libsodium*./configuremake && make install# 修复关联echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.confldconfig

配置

单端口:vi   /etc/ssserver.json{"server":"132.215.100.103","server_port":2626,"password":"xxxxxxxx","timeout":600,"method":"chacha20"}多端口:{    "server":"132.215.100.103",    "port_password": {                "2626": "xxxxxxxx",                "2627": "dddddddd"    },    "timeout":600,    "method":"chacha20"}

系统优化

#vi /etc/security/limits.conf* soft nofile 51200* hard nofile 51200ulimit -n 51200#vi /etc/sysctl.conffs.file-max = 51200net.core.rmem_max = net.core.wmem_max = net.core.netdev_max_backlog = net.core.somaxconn = 4096net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_time = 1200net.ipv4.ip_local_port_range = 10000 65000net.ipv4.tcp_max_syn_backlog = 8192net.ipv4.tcp_max_tw_buckets = 5000net.ipv4.tcp_fastopen = 3net.ipv4.tcp_mem = 25600 51200 net.ipv4.tcp_rmem = 4096 87380 net.ipv4.tcp_wmem = 4096 65536 net.ipv4.tcp_mtu_probing = 1net.ipv4.tcp_congestion_control = hyblasysctl -p#启动ssserver -c /etc/ssserver.json -d start#带日志启动/usr/local/bin/python3.6 /usr/local/bin/ssserver -c /etc/shadowsocks-libev/ssserver.json -d start --log-file /var/log/sss.log

C版本安装

#编译安装yum -y install gcc automake autoconf libtool make m2crypto autoconf libtool curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel gettext-devel pcre-devel asciidoc xmlto git   mbedtls-devel libsodium-develyum install 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$ ./autogen.sh && ./configure && make$ sudo make install#rpm安装wget https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo -P /etc/yum.repos.d/yum install shadowsocks-libev.x86_64 -ysystemctl enable shadowsocks-libevsystemctl start shadowsocks-libev

配置

cat /etc/shadowsocks-libev/config.json {    "server":"0.0.0.0",    "server_port":2627,    "password":"xxxx",    "timeout":600,    "method":"chacha20"}#C版本有黑名单功能:vi all.acl#[reject_all][white_list]127.0.0.1::110.0.0.0/8172.16.0.0/12192.168.0.0/160.0.0.0/0#启动/usr/local/bin/ss-server -u -c /etc/shadowsocks-libev/config.json -f /var/run/shadowsocks-libev.pid --acl /etc/shadowsocks-libev/all.acl