CentOS下shadowsocks-libev一键安装脚本


本文的主要内容是,在已经安装完 Shadowsocks-libev 服务端的情况下,如何手动安装和配置 simple-obfs,以及在此过程中的排错。

首先,使用本站提供的一键脚本安装 Shadowsocks-libev 服务端

2017 年 10 月 14 日更新
Shadowsocks 一键安装脚本(四合一)已经支持在安装 Shadowsocks-libev 时可选安装 simple-obfs 服务端。
※ 注意:脚本仅支持在 autoconf 版本大于或等于 2.67 的系统里安装。
Shadowsocks 一键安装脚本(四合一)

CentOS下shadowsocks-libev一键安装脚本
Debian 下 Shadowsocks-libev 一键安装脚本

其次,手动安装和配置 simple-obfs 服务端

下文以 CentOS 7 的操作为范例。
在用一键脚本安装完 Shadowsocks-libev 服务端的前提下,安装 simple-obfs 服务端所需的依赖包都已安装完毕。
有可能还需要安装一下 git 命令。

# Debian / Ubuntu
apt-get install -y git
# CentOS / Fedora / RHEL
yum install -y git

下载和安装 simple-obfs

cd /opt
git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update --init --recursive
./autogen.sh
./configure --disable-documentation
make && make install

需要特别注意的是,autogen.sh 脚本的配置限制了 autoconf 的版本不能低于 2.67。
如何查看默认 autoconf 的版本号?

autoconf --version

CentOS 7 的 autoconf 版本为 2.69,符合条件。

以下为在 CentOS 6 的操作步骤。
CentOS 6 的 autoconf 版本为 2.63,因此需要用到 EPEL 的 autoconf268 依赖包。

yum install -y autoconf268

然后修改 autogen.sh 内容,将

autoreconf --install --force

修改为

autoreconf268 --install --force

还有一点,在 CentOS 6 下编译出现 error: ev.h: No such file or directory 错误时,原因如下:
CentOS 6 下 ev.h 位于 /usr/include/libev/ev.h,因此需要修改以下代码里关于 ev.h 路径定义的地方。

src/local.h
src/server.h

找到 #include <ev.h> 这一行,修改为 #include <libev/ev.h> 即可通过编译。

一般情况下安装完成后,二进制文件的路径位于

/usr/local/bin/obfs-local
/usr/local/bin/obfs-server

重新配置文件

重新配置 Shadowsocks-libev 的配置文件 /etc/shadowsocks-libev/config.json
添加如下

"plugin":"obfs-server",
"plugin_opts":"obfs=http"

特别注意:请认真参考以下范例,method 那行最后不要缺少逗号,不然启动会报错。
范例如下:

{
    "server":"0.0.0.0",
    "server_port":your_server_port,
    "password":"your_password",
    "timeout":300,
    "method":"your_encryption_method",
    "plugin":"obfs-server",
    "plugin_opts":"obfs=http"
}

然后重新启动 Shadowsocks-libev 即可。

确认 ss-server 和 obfs-server 进程已经正常启动。
命令如下:

ps -ef | grep -v grep | grep "server"

输出结果参考:

/usr/local/bin/ss-server -u -c /etc/shadowsocks-libev/config.json -f /var/run/shadowsocks-libev.pid
/usr/local/bin/obfs-server --obfs http

Windows 客户端的使用方法:
1、下载最新 Windows 客户端
Windows 客户端下载网址:
https://github.com/shadowsocks/shadowsocks-windows/releases

2、下载 obfs-local.zip 
下载网址:
https://github.com/shadowsocks/simple-obfs/releases
下载后,解压出来的文件一定要和 Windows 客户端的 exe 文件放在同一文件夹下

3、客户端配置,如下图

插件:obfs-local
插件选项:obfs=tls
插件参数:obfs-host=www.bing.com
插件选项和插件参数根据你服务端上的配置选择用 http 或者 tls,obfs-host 随便你用什么网址都行。


最新回复 (0)
全部楼主
返回