本文最后更新于 2019年2月16日 请注意相关内容可能已过时
登录VPS机器以后执行一下命令,一行一个命令的执行,如果是以root权限登录的,命令前面的sudo就去掉。
-
1,关闭防火墙
systemctl stop firewalld systemctl disable firewalld
-
2,编译环境准备、解决依赖
yum install epel-release -y yum install gettext gcc pcre-devel autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel
-
3,安装 Libsodium
export LIBSODIUM_VER=1.0.16
wget https://loukky.com/files/libsodium-1.0.16.tar.gz
mv libsodium-1.0.16.tar.gz libsodium-$LIBSODIUM_VER.tar.gz
tar xvf libsodium-$LIBSODIUM_VER.tar.gz
pushd libsodium-$LIBSODIUM_VER
./configure --prefix=/usr && make
sudo make install
popd
sudo ldconfig
-
4,安装 MbedTLS
export MBEDTLS_VER=2.16.0 wget https://loukky.com/files/mbedtls-2.16.0-gpl.tgz mv mbedtls-2.16.0-gpl.tgz mbedtls-$MBEDTLS_VER-gpl.tgz tar xvf mbedtls-$MBEDTLS_VER-gpl.tgz pushd mbedtls-$MBEDTLS_VER make SHARED=1 CFLAGS=-fPIC sudo make DESTDIR=/usr install popd sudo ldconfig
-
5,下载 Shadowsocks-libev 源码
cd ~ git clone https://github.com/shadowsocks/shadowsocks-libev.git cd shadowsocks-libev git submodule update --init --recursive
-
6,开始编译 Shadowsocks-libev
cd ~/shadowsocks-libev ./autogen.sh && ./configure --prefix=/usr/local/shadowsocks-libev && make && make install
-
-
7,安装 Simple-obfs
-
git clone https://github.com/shadowsocks/simple-obfs.git cd simple-obfs git submodule update --init --recursive ./autogen.sh ./configure && make make install
-
8,配置文件,加入simple-obfs支持
vim /etc/shadowsocks-libev/config.json
复制一下内容到打开的文件里面去。
按ESC,然后输入:wq保存
{ "server":"0.0.0.0", "server_port":远程端口号, "local_port":1080, "password":"你要设置的密码", "timeout":600, "method":"加密方式", "plugin": "obfs-server", "plugin_opts": "obfs=http" }
加密方式有一下几种。任选一种:
rc4-md5, aes-128-gcm, aes-192-gcm, aes-256-gcm, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-ctr, aes-192-ctr, aes-256-ctr, camellia-128-cfb, camellia-192-cfb, camellia-256-cfb, bf-cfb, chacha20-ietf-poly1305, xchacha20-ietf-poly1305, salsa20, chacha20 and chacha20-ietf. The default cipher is chacha20-ietf-poly1305.
推荐使用aes-128-gcm就可以了。
-
9,Shadowsocks-libev Systemd 配置文件
- vim /etc/systemd/system/shadowsocks-libev.service
- 把下面的复制到这个文件里面去
# This file is part of shadowsocks-libev. # # Shadowsocks-libev is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This file is default for RPM packaging. See also # /etc/sysconfig/shadowsocks-libev for environment variables. [Unit] Description=Shadowsocks-libev Default Server Service Documentation=man:shadowsocks-libev(8) After=network.target [Service] Type=simple #EnvironmentFile=/etc/sysconfig/shadowsocks-libev User=nobody Group=nobody LimitNOFILE=32768 ExecStart=/usr/local/shadowsocks-libev/bin/ss-server -c /etc/shadowsocks-libev/config.json $DAEMON_ARGS CapabilityBoundingSet=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target
-
10,Systemd 启动 Shadowsocks-libev
systemctl enable shadowsocks-libev.service systemctl start shadowsocks-libev.service systemctl status shadowsocks-libev.service
-
11,BBR安装
这里使用的是秋水一冰大神的一键安装脚本
注意:BBR是通过更新内核来开启的,所以如果你的VPS是openvz的话,是不支持修改内核的,下面的命令是亦不支持openvz。
使用root用户登录,运行以下命令:
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
如果你想使用命令来启动的话
在第八步写好配置文件以后。返回根目录运行
cd /usr/local/bin/ nohup ss-server -c /etc/shadowsocks-libev/config.json -6 -u &
也可以新建一个文件把这个写入进去,每次开机以后手动输入
.(注意有个小数点)你建立的文件名
就可以了。
参考链接:https://github.com/shadowsocks/shadowsocks-libev