Skip to content

Instantly share code, notes, and snippets.

@truebit
Last active October 5, 2021 07:55
Show Gist options
  • Save truebit/7bf8dd01418dcb204346 to your computer and use it in GitHub Desktop.
Save truebit/7bf8dd01418dcb204346 to your computer and use it in GitHub Desktop.
install shadowsocks-libev on CentOS 6

shadowsocks-libev install on CentOS 6

Latest update:

2016/12/10 add prce dependency

2016/07/13 remove latest dependencies that is not needed for compile: asciidoc xmlto

2019/03/06 change shadowsocks resource; add shadowsocks new dependencies build

2019/06/06 fix python2.6 build error in MbedTLS

Content

HostUs with HK IP address is best for Beijing ChinaUnicom network. and it is pre-installed with CentOS 6 and you cannot change. Here below is a simple guide.

# build environment
yum install build-essential autoconf libtool cmake openssl-devel pcre-devel gcc wget c-ares-devel libev-devel -y
# build shadowsocks-libev dependencies
# 1. libsodium
export LIBSODIUM_VER=1.0.17
wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VER.tar.gz
tar xf libsodium-$LIBSODIUM_VER.tar.gz
cd libsodium-$LIBSODIUM_VER
./configure --prefix=/usr && make
make install
cd -
ldconfig
# 2. MbedTLS
export MBEDTLS_VER=2.16.0
wget https://tls.mbed.org/download/mbedtls-$MBEDTLS_VER-gpl.tgz
tar xf mbedtls-$MBEDTLS_VER-gpl.tgz
cd mbedtls-$MBEDTLS_VER
cmake -DENABLE_TESTING=Off
make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install
cd -
ldconfig
# download shadowsocks-libev and build + install
export SHADOWSOCKS_LIBEV_VER=3.2.4
wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SHADOWSOCKS_LIBEV_VER}/shadowsocks-libev-${SHADOWSOCKS_LIBEV_VER}.tar.gz
tar zxf shadowsocks-libev-$SHADOWSOCKS_LIBEV_VER.tar.gz
cd shadowsocks-libev-$SHADOWSOCKS_LIBEV_VER
./configure --disable-documentation
make && make install
cd -
# add init.d service
mkdir -p /etc/shadowsocks-libev
cp ./rpm/SOURCES/etc/init.d/shadowsocks-libev /etc/init.d/shadowsocks-libev
## modify /usr/bin to /usr/local/bin as libev installed to /usr/local/bin by default
sed -i 's|/usr/bin/|/usr/local/bin/|g' /etc/init.d/shadowsocks-libev
chmod +x /etc/init.d/shadowsocks-libev
# modify config
cp ./debian/config.json /etc/shadowsocks-libev/config.json
## explanation:
##{
##    "server":"127.0.0.1", #you vps ip addr
##    "server_port":8838, # vps server port open for ss connection
##    "local_port":1080, # local port connect to ss
##    "password":"yourpasswordforshadowsocks",
##    "timeout":600, #connection timeout
##    "method":"chacha20" # obfuscation method, you could also use 'rc4-md5'(fast, but less secure than chacha20) or 'aes-256-cfb'(slow on router)
##}
vi /etc/shadowsocks-libev/config.json
# start service
/etc/init.d/shadowsocks-libev start
@la88962
Copy link

la88962 commented Aug 23, 2017

CentOS 6.8
./configure --disable-documentation
bash: ./configure: 沒有此一檔案或目錄
help me Thx

@truebit
Copy link
Author

truebit commented Nov 17, 2017

@la88962 你没有cd进去吧?

@roycclu
Copy link

roycclu commented Jun 3, 2018

cd 进去还是没有哦

@truebit
Copy link
Author

truebit commented Mar 6, 2019

shadowsocks 改编译方式了,我稍后更新下吧。感谢支持

@truebit
Copy link
Author

truebit commented Mar 6, 2019

2019/Mar/9 已更新最新版ss-libev编译

@lssmoon2019
Copy link

MBEDTLS_VER-gpl.tgz 这个下载后始终无法解压

Copy link

ghost commented Jun 5, 2019

make SHARED=1 CFLAGS=-fPIC
之后出现错误:
Gen test_suite_aes.cbc.c
File "scripts/generate_test_code.py", line 949
with open(helpers_file, 'r') as help_f, open(platform_file, 'r') as
^
SyntaxError: invalid syntax
make[1]: *** [test_suite_aes.cbc.c] Error 1
make: *** [tests] Error 2

@truebit
Copy link
Author

truebit commented Jun 5, 2019 via email

@truebit
Copy link
Author

truebit commented Jun 6, 2019

MBEDTLS_VER-gpl.tgz 这个下载后始终无法解压

脚本可能当时没写$符号。现在应该没问题了

@truebit
Copy link
Author

truebit commented Jun 6, 2019

make SHARED=1 CFLAGS=-fPIC
之后出现错误:
Gen test_suite_aes.cbc.c
File "scripts/generate_test_code.py", line 949
with open(helpers_file, 'r') as help_f, open(platform_file, 'r') as
^
SyntaxError: invalid syntax
make[1]: *** [test_suite_aes.cbc.c] Error 1
make: *** [tests] Error 2

fixed

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