文章

手动编译安装shadowsocks-libev。

  编辑于:2018-05-06
文章目录

前言

最近有传说shadowsocksr可能被探查,这里记录一下shadowsocks-libev的安装。该版本的特点是内存占用小(600k左右),低 CPU 消耗,甚至可以安装在基于 OpenWRT 的路由器上。

安装

安装相关依赖

apt-get -y --no-install-recommends install gettext build-essential autoconf automake libtool openssl libssl-dev zlib1g-dev libpcre3-dev libev-dev libc-ares-dev

安装mbedtls

wget https://tls.mbed.org/download/mbedtls-2.7.0-gpl.tgz
tar xf mbedtls-2.7.0-gpl.tgz
cd mbedtls-2.7.0
make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install

安装libsodium

wget https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz
tar zxf libsodium-1.0.16.tar.gz
cd libsodium-1.0.16
./configure --prefix=/usr && make && make install

安装shadowsocks-libev

wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v3.1.3/shadowsocks-libev-3.1.3.tar.gz
tar zxf shadowsocks-libev-3.1.3.tar.gz
mv shadowsocks-libev-3.1.3 shadowsocks
cd shadowsocks
./configure --disable-documentation
make && make install

设置shadowsocks

vi config.json

{
    "server":"0.0.0.0",
    "server_port":端口,
    "local_address":"127.0.0.1",
    "local_port":1080,
    "password":"密码",
    "timeout":600,
    "method":"chacha20-ietf-poly1305"  #加密方式
}

设置自启

这个自启设置文件适用于DEBIAN8/ubuntu16.04以上
vi /etc/systemd/system/shadowsocks.service

[Unit]
Description=Shadowsocks server
After=network.target

[Service]
ExecStart=/usr/local/bin/ss-server -c /root/shadowsocks/config.json 
Restart=always

[Install]
WantedBy=multi-user.target

启动
systemctl enable shadowsocks && systemctl start shadowsocks
参考链接:https://shadowsocks.be/4.html

评论加载中