Skip to content

Instantly share code, notes, and snippets.

@aa65535
Last active April 7, 2024 13:03
Show Gist options
  • Save aa65535/ea090063496b0d3a1748 to your computer and use it in GitHub Desktop.
Save aa65535/ea090063496b0d3a1748 to your computer and use it in GitHub Desktop.
shadowsocks-libev install at Debian or CentOS

Debian

cd /tmp
# 编译环境准备&安装依赖包
apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev asciidoc xmlto git
# 克隆源码
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
cd shadowsocks-libev
./autogen.sh
./configure --prefix=/usr && make
make install
# 准备必须的文件
mkdir -p /etc/shadowsocks-libev
cp ./debian/shadowsocks-libev.init /etc/init.d/shadowsocks-libev
cp ./debian/shadowsocks-libev.default /etc/default/shadowsocks-libev
cp ./debian/config.json /etc/shadowsocks-libev/config.json
chmod +x /etc/init.d/shadowsocks-libev
# 编辑配置文件
vim /etc/shadowsocks-libev/config.json
# 添加开机自启动服务
update-rc.d shadowsocks-libev defaults
# 启动服务
service shadowsocks-libev start

CentOS

cd /tmp
# 编译环境准备&安装依赖包
yum install -y gcc make libtool build-essential git
yum install -y yum install gettext gcc autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel
# 克隆源码
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
cd shadowsocks-libev
./autogen.sh
./configure --prefix=/usr && make
make install
# 准备必须的文件
mkdir -p /etc/shadowsocks-libev
cp ./rpm/SOURCES/etc/init.d/shadowsocks-libev /etc/init.d/shadowsocks-libev
cp ./debian/config.json /etc/shadowsocks-libev/config.json
chmod +x /etc/init.d/shadowsocks-libev
# 编辑配置文件
vim /etc/shadowsocks-libev/config.json
# 添加开机自启动服务
chkconfig --add shadowsocks-libev
chkconfig shadowsocks-libev on
# 启动服务
service shadowsocks-libev start
#!/bin/sh
yum install -y wget gettext autoconf libtool automake make asciidoc xmlto zlib-devel libev-devel c-ares-devel pcre-devel
mkdir -p ~/shadowsocks-src && cd ~/shadowsocks-src || exit 1
rm -rf libsodium-* mbedtls-* simple-obfs shadowsocks-libev
wget -O libsodium-stable.tar.gz https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar xzf libsodium-stable.tar.gz
pushd libsodium-stable/
./configure --prefix=/usr && make || exit 1
make install
popd
ldconfig
export MBEDTLS_VER=2.13.0
wget https://tls.mbed.org/download/mbedtls-$MBEDTLS_VER-gpl.tgz
tar xzf mbedtls-$MBEDTLS_VER-gpl.tgz
pushd mbedtls-$MBEDTLS_VER
make SHARED=1 CFLAGS=-fPIC || exit 1
make DESTDIR=/usr install
popd
ldconfig
git clone --recursive https://github.com/shadowsocks/simple-obfs.git
pushd simple-obfs
./autogen.sh
./configure --prefix=/usr && make || exit 1
make install
popd
git clone --recursive https://github.com/shadowsocks/shadowsocks-libev.git
pushd shadowsocks-libev
./autogen.sh
./configure --prefix=/usr && make || exit 1
make install
cp ./debian/shadowsocks-libev.default /etc/default/shadowsocks-libev || exit 1
. /etc/default/shadowsocks-libev
mkdir -p $(dirname $CONFFILE) || exit 1
# 此处配置根据需要修改
cat <<-EOF >$CONFFILE
{
"server": "0.0.0.0",
"server_port": 8388,
"password": "barfoo!",
"method": "chacha20-ietf-poly1305",
"plugin": "obfs-server",
"plugin_opts": "obfs=tls",
"mode": "tcp_and_udp"
}
EOF
grep -v '=no' ./debian/shadowsocks-libev.service >/etc/systemd/system/shadowsocks-libev.service || exit 1
popd
systemctl --system daemon-reload
systemctl enable shadowsocks-libev
systemctl start shadowsocks-libev
@xuexiaoao
Copy link

这个是客户端还是服务端的ssr呢,有点搞不清楚

@HarrisonXi
Copy link

@xuexiaoao 这是纯C实现的服务端,应该是最轻量的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment