Ubnt EdgeRouter ER-X属于mipsel构架,与EdgeRouter ER-L的SS安装包不共用。
1、在虚拟机中安装ubuntu-14.04.5-desktop-amd64 LTS
2、添加所需的源
vi /etc/apt/sources.list
deb http://www.emdebian.org/debian stable main
3、更新源索引
apt-get update
4、安装必须的libgmp3c2依赖
wget http://th.archive.ubuntu.com/ubuntu/pool/universe/g/gmp4/libgmp3c2_4.3.2+dfsg-2ubuntu1_amd64.deb
dpkg -i libgmp3c2_4.3.2+dfsg-2ubuntu1_amd64.deb
5、安装emdebian源的签名,避免警告
wget http://ftp.us.debian.org/debian/pool/main/e/emdebian-archive-keyring/emdebian-archive-keyring_2.0.3_all.deb
dpkg -i emdebian-archive-keyring_2.0.3_all.deb
6、安装mipsel交叉编译的主要组件,并更新软件包
apt-get install gcc-4.3-mipsel-linux-gnu libgmp3c2-mipsel-cross
apt-get install zlib1g-mipsel-cross zlib1g-dev-mipsel-cross
apt-get install gcc python-pip python-m2crypto git
apt-get install asciidoc //这个包很大
apt-get update
apt-get upgrade
7、编译SS所需的组件openssl
wget http://openssl.org/source/openssl-1.0.2h.tar.gz
export CC=mipsel-linux-gnu-gcc
export CXX=mipsel-linux-gnu-cpp
export AR=mipsel-linux-gnu-ar
export RANLIB=mipsel-linux-gnu-ranlib
./Configure no-asm shared --prefix=/usr/local/openssl_mips linux-mips32
8、下载shadowsocks-libev源码编译
git clone https://github.com/shadowsocks/shadowsocks-libev.git
./configure --host=mipsel-linux-gnu --with-openssl=/usr/local/openssl_mips --prefix=/usr/local/shadowsocks-libev/ --disable-ssp
9、编译过程中按照提示安装所需要的依赖,完成后使用file命令查看编译完成的可执行文件。上传到ER-X中,赋予执行权限后,可以正常执行。