How to install ngrok

1 minute read




系统:Ubuntu Ngrok版本

STEP1 build complie

sudo apt-get install build-essential

STEP2 install go language

sudo s apt-get install golang

STEP3 Ngrok relies on mercurial(version control)

    sudo apt-get install mercurial

STEP4 Clone ngrok’s github into your working directory

git clone ngrok
cd ngrok

STEP5 create your own self-signed SSL certificate

openssl genrsa -out base.key 2048
openssl req -new -x509 -nodes -key base.key -days 10000 -subj "/CN=$NGROK_BASE_DOMAIN" -out base.pem
openssl genrsa -out server.key 2048
openssl req -new -key server.key -subj "/CN=$NGROK_BASE_DOMAIN" -out server.csr
openssl x509 -req -in server.csr -CA base.pem -CAkey base.key -CAcreateserial -days 10000 -out server.crt

Replace your domain,if you are planning to run your ngrok tunnels from * subdomain,set the NGROK_BASE_DOMAIN to And if you notice the following files will be generated as a result of the commands that we run earlier above:


yourdomain config

##STEP6 Copy your client certificate file

replace ngrok’s default client certificate file located at assets/client/tls/ngrokroot.crt with the one that you have just created:

    cp base.pem assets/client/tls/ngrokroot.crt

##STEP7 Now build/make the executable for both the server (release-server) and client (release-client),it may takes a while:


GOOS=linux GOARCH=amd64 make release-server release-client GOOS=linux GOARCH=386 make release-server release-client

windows GOOS=windows GOARCH=amd64 make release-server release-client GOOS=windows GOARCH=386 make release-server release-client

##STEP8 Once it is done,the executable will be available inside /bin directory:

ngrok is the client executable and ngrokd is the server executable.You may need to make the file executable first by running the following command:

     chmod +X ngrokd
     chmod +X ngrok

And also,tabke note that the default executable generated is for Linux.

##STEP9 Running Ngrok Server

cp server.crt serverdir_with_ngrokd
cp server.jet serverdir_with_ngrokd

And then you can start ngrok server by running the following command(you may need root permission)

    ./ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="[NGROK_BASE_DOMAIN]" -httpAddr=":8080" -httpsAddr=":8081"

Test Open url

will see Tunnel not found

##STEP10 RUnning Ngrok client

    vim ngrok.conf
erver_addr: ""

trust_host_root_certs: false



    subdomain: "test"


      http: "80"


    remote_port: 2222


      tcp: "22"
ttp: "80"

run command

    ./ngrok -config=ngrok.conf start http ssh

ngrok.exe -subdomain testing -config=ngrok.cfg 80

ngrok.exe -subdomain testing -config=ngrok.cfg start http ssh

./ngrok -config=ngrok.conf start http ssh

Leave a Comment