Wednesday, 23 February 2022

How to install ngrok on Linux

ngrok is a tool which provides a public URL to the localhost server which is behind the router. It is useful for testing e.g. your web server. 

To install it on Ubuntu, go to download page and download an archive from https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.tgz. Extract its content (ngrok directory) into /usr/local/bin:

$ sudo tar xvzf ~/Downloads/ngrok-stable-linux-amd64.tgz -C /usr/local/bin
ngrok

Let's check that it's indeed in the desired location:

$ ls -la /usr/local/bin | grep ngrok
-rwxr-xr-x  1 root root 30053267 May  4  2021 ngrok

 
 Let's run it:
 
$ ngrok

NAME:
   ngrok - tunnel local ports to public URLs and inspect traffic

DESCRIPTION:
    ngrok exposes local networked services behinds NATs and firewalls to the
    public internet over a secure tunnel. Share local websites, build/test
    webhook consumers and self-host personal services.
    Detailed help for each command is available with 'ngrok help <command>'.
    Open http://localhost:4040 for ngrok's web interface to inspect traffic.

EXAMPLES:
    ngrok http 80                    # secure public URL for port 80 web server
    ngrok http -subdomain=baz 8080   # port 8080 available at baz.ngrok.io
    ngrok http foo.dev:80            # tunnel to host:port instead of localhost
    ngrok http https://localhost     # expose a local https server
    ngrok tcp 22                     # tunnel arbitrary TCP traffic to port 22
    ngrok tls -hostname=foo.com 443  # TLS traffic for foo.com to port 443
    ngrok start foo bar baz          # start tunnels from the configuration file

VERSION:
   2.3.40

AUTHOR:
  inconshreveable - <alan@ngrok.com>

COMMANDS:
   authtoken    save authtoken to configuration file
   credits    prints author and licensing information
   http        start an HTTP tunnel
   start    start tunnels by name from the configuration file
   tcp        start a TCP tunnel
   tls        start a TLS tunnel
   update    update ngrok to the latest version
   version    print the version string
   help        Shows a list of commands or help for one command


We could have extracted ngrok into any directory e.g. default ~/Downloads/ngrok-stable-linux-amd64 but then we'd be able to run it as:

~/Downloads/ngrok-stable-linux-amd64$ ./ngrok

To start using ngrok we need to authenticate our local ngrok agent first. For this, we need to log in to our ngrok account and get authentication token first:

                       

Let's authenticate ngrok agent now (with copy-pasted Authtoken):
 
$ ngrok authtoken 2pCTN...fwvjiUA2
Authtoken saved to configuration file: /home/bojan/.ngrok2/ngrok.yml


Authtoken can be reset any time in our ngrok account. We can check the current value by looking at this configuration file:

$ cat /home/bojan/.ngrok2/ngrok.yml
authtoken: 2pCTN...fwvjiUA2



Let's run it:

$ ngrok http 5000




To stop it, use CTRL-C.


2 comments:

xiwangcadwallader said...

Grayslots Casino Hotel - Mapyro
Grayslots Casino Hotel in 순천 출장안마 Grayslots Casino Hotel is an open-air casino on Paradise Highway 안동 출장안마 near Hollywood, LA. 서산 출장샵 View reviews, 보령 출장안마 photos and ratings for Grayslots Casino 청주 출장샵 Hotel

Taylor said...

I just have to introduce this hacker that I have been working with him on getting my credit score been boosted across the Equifax, TransUnion and Experian report. He made a lot of good changes on my credit report by erasing all the past eviction, bad collections and DUI off my credit report history and also increased my FICO score above 876 across my three credit bureaus report you can contact him for all kind of hacks . Email him here support@wavedrive.tech go on their website wavedrive.tech for more details,Whatsapp No:+14106350697 if you want to chat them up,One thing i can assure you would not regret this at all he is 100% legit