Skip to content

Instantly share code, notes, and snippets.

@SalahHamza
Last active November 7, 2024 15:35
Show Gist options
  • Save SalahHamza/799cac56b8c2cd20e6bfeb8886f18455 to your computer and use it in GitHub Desktop.
Save SalahHamza/799cac56b8c2cd20e6bfeb8886f18455 to your computer and use it in GitHub Desktop.
How to install ngrok on linux subsystem for windows

Ngrok

Overview

ngrok allows you to expose a web server running on your local machine to the internet.

Read more about ngrok in the official docs.

Installation

  1. Go to your root directory
cd
  1. download ngrok .zip file
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip

if by any chance the url has been changed go to ngrok download page and copy the url of the linux .zip file.

  1. unzip the file
unzip ngrok-stable-linux-amd64.zip

in case you don't have unzip installed, you can do that like this

sudo apt install unzip
  1. if you pass in this command ./ngrok you'll see this output
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 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.2.8

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

this means that ngrok is working well

  1. all you need to do is specify a port where your website is servered so that you expose it to the internet. Example
./ngrok http 8000

passing the above command will produce this output

ngrok by @inconshreveable
Session Expires               7 hours, 59 minutes
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://********.ngrok.io -> localhost:8000
Forwarding                    https://*******.ngrok.io -> localhost:8000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00  
@Mikehoncho85
Copy link

I need your help like all the time...lol. this was quick and great dude thanks

@c7b
Copy link

c7b commented Jan 20, 2023

Great comment; it helps me out. For me, following the instructions where

  1. https://ngrok.com/download
  2. Install ngrok via Apt
    curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
  3. ngrok config add-authtoken <token>

@David3D-AndweM
Copy link

I can not locate were it is installed it does not list after installation on my WSL .I installed using apt

@Dimp0
Copy link

Dimp0 commented Apr 8, 2023

I can not locate were it is installed it does not list after installation on my WSL .I installed using apt

Bro u are lost far away ...

@Milescoded
Copy link

Am getting this any help: inflating: ngrok

@Srimadesh167
Copy link

thanks

@SalahHamza
Copy link
Author

SalahHamza commented Jun 26, 2023

Updated this comment because localtunnel doesn't seem to be maintained anymore

@russorat
Copy link

russorat commented Mar 5, 2024

PM from ngrok here. I've updated this gist here: https://gist.github.com/russorat/8cc98b35da004b2298365d08d208e4c1

For anyone facing version issues, the updated download link is https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz

you will also need to sign up for a free account at https://ngrok.com/signup and install your authtoken with the command ngrok config add-authtoken <TOKEN>

@rangoo20000
Copy link

ngrok and your installation doc saved me out of buying VPS ...!! :* :-)

@socraticprogrammer
Copy link

For install the version 3 of Ngrok, I do this steps in my WSL - Ubuntu:

  1. wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
  2. sudo tar -xvzf ./ngrok-v3-stable-linux-amd64.tgz -C /usr/local/bin

Now, just run ngrok --help to see if the tool is installed correctly.

@SAMCyber675
Copy link

Good !

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