yum install -y cmake gcc gcc-c++ perl-ExtUtils-MakeMaker mercurial
安装git必备
yum install -y glibc.i686 zlib-devel tcl libcurl-devel gettext-devel asciidoc xmlto texinfo docbook2X
wget tar -C /usr/local -xzf go1.4.2.linux-386.tar.gz
mkdir $HOME/go echo 'export GOROOT=/usr/local/go'>> ~/.bashrc echo 'export GOPATH=$HOME/go'>> ~/.bashrc echo 'export PATH=$PATH:$GOROOT/bin'>> ~/.bashrc source $HOME/.bashrc
yum install -y glibc.i686 zlib-devel tcl libcurl-devel gettext-devel asciidoc xmlto yum install -y texinfo yum install -y docbook2X cd /usr/bin ln -s db2x_docbook2texi docbook2x-texi wget -O git.zip unzip master.zip autoconf ./configure make prefix=/usr all doc info make prefix=/usr install install-doc install-html install-info make install ln -s /usr/local/bin/git /usr/bin/
git clone https://github.com/tutumcloud/ngrok.git ngrok cd ngrok
(w.knsay.com换成你自己的域名)
openssl genrsa -out rootCA.key 2048 openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=w.knsay.com" -days 5000 -out rootCA.pem openssl genrsa -out device.key 2048 openssl req -new -key device.key -subj "/CN=w.knsay.com" -out device.csr openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000 cp rootCA.pem assets/client/tls/ngrokroot.crt cp device.crt assets/server/tls/snakeoil.crt cp device.key assets/server/tls/snakeoil.key
x86使用GOARCH=386 x64则使用amd64
cd /usr/local/go/src/ GOOS=linux GOARCH=386 CGO_ENABLED=0 ./make.bash //env GOOS=linux GOARCH=amd64 GOROOT_BOOTSTRAP=/usr/local/go ./make.bash --no-clean
cd /home/ngrok make release-server release-client //GOOS=linux GOARCH=386 make release-server release-client
Windows配置
windows只需要32位即可不必编译64位
cd /usr/local/go/src/ GOOS=windows GOARCH=386 CGO_ENABLED=0 ./make.bash
cd /home/ngrok //make release-client GOOS=windows GOARCH=386 make release-client
编译好的客户端会在ngrok/bin目录下ngrokd为服务端ngrok为客户端windows_386目录内为windows客户端,服务端与客户端对应,客户端不能连接其它的服务端,服务端也不能被其它的客户端连接,客户端ngrok-c则除外。
/home/bin/ngrokd -domain="x.knsay.com"
/home/bin/ngrokd -domain="x.knsay.com" -httpsAddr=":445" -httpAddr=":82" -httpsAddr=":4443"
nohup /home/bin/ngrokd -domain="x.knsay.com" -httpsAddr=":445" -httpAddr=":80" -tunnelAddr=":4444" &
监听http82端口,https 445 4444端口
本文为看恩吧原创文章,转载无需和我联系,但请注明来自knsay.com