Ngrok in Termux – Installation Guide and Usage Commands

Ngrok is a tool that is used to create a secure tunnel from your local device to the internet. This article provides a step-by-step guide on installing and using Ngrok in Termux.
5/5 - (4 votes)

Are you an Android user and looking to create your device an online server where you can share scripts and files? Well, you can create your Android device a local server with the help of Termux application. This post will guide you to install and use ngrok in Termux where you can create a local server.

Ngrok in Termux installation and basic commands

What is Ngrok

Ngrok is a tool that is used to create a secure tunnel from your local device to the internet. This means you can expose your local server which is usually only accessible on your device to the public web. Ngrok will generate and give you a unique public URL for your shared files that anyone can access with the link.

Why Use Ngrok?

Ngrok is particularly useful for developers who want to:

  • Access their applications remotely without complex setups.
  • Share their localhost applications with others.
  • Test webhooks from services like GitHub, Stripe, or Twilio.

How to install Ngrok in Termux

How to install Ngrok in Termux

You can easily install Ngrok in Termux just by following some simple commands. Below we have provided the easiest way to install Ngrok in Termux. You just need to copy the commands and paste them into Termux one by one.

Step 1: Update Termux Packages

Start by updating and upgrading installed packages to ensure you have the latest versions:

apt update && apt upgrade -y

Step 2: Install Required Packages

Next you need to install the wget package in Termux to download the Ngrok file directly from your Termux:

pkg install wget -y

Step 3: Extract the Ngrok File

You can download Ngrok directly from its official website in your Termux by running this command:

wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz

Step 4: Unzip the Ngrok File

Since the downloaded file is in .tgz format, use the following command to extract it:

tar -xvzf ngrok-v3-stable-linux-arm64.tgz

After running these commands Ngrok will be successfully installed in your Termux.

You can check Ngrok is successfully installed or not by running the following command:

./ngrok

If this command shows you the Ngrok usage commands then ngrok is successfully installed in your Termux. For example here you can see the screenshot:

Ngrok started

Now let’s move on to the next steps like how to setup ngrok authentication token and how to use ngrok in Termux on android.

Step 5: Create and Setup Ngrok Auth Token

To use Ngrok, you need to sign up for a free account on the Ngrok website. After signing up, you’ll receive an authentication token. Here are the steps to create ngrok authentication token.

How to create ngrok authentication token

  • Open your browser and go to the official Ngrok website ngrok.com.
  • Now create a Ngrok account by clicking on the signup for free button.
  • After creating the account you will find the Ngrok authentication token by clicking on the three lines at the top left side on the homepage where you will see a (Your Authtoken) option.
  • Copy your Ngrok authentication token.

Setup Your Ngrok authentication token in Termux

After getting your Ngrok authentication token you will need to set it up with Termux. Here is the command to add your Ngrok authentication token in Termux:

ngrok authtoken YOUR_AUTH_TOKEN

Use ngrok authtoken command with your Ngrok authentication token.

After creating and adding Ngrok authentication token in Termux you are ready to use it. Let’s see how you can use ngrok in Termux along with some Ngrok basic commands.

Step 6: Start Ngrok

As the Ngrok is installed and authenticated, you can start it with this command:

ngrok http 8000

This command will create a secure tunnel to your local server running on port 8000.

Ngrok Usage Commands

Ngrok basic commands

Here are the some basic Ngrok usage commands for Termux:

1. View the Ngrok Dashboard

After running the Ngrok command, you’ll see a forwarding URL. You can access the Ngrok web dashboard to view requests and responses at:

http://127.0.0.1:8000

2. Change the Port

To expose a different port, simply change the port number in the command:

./ngrok http PORT_NUMBER

3. Kill an Ngrok Session

If you need to terminate your Ngrok session, you can do so by pressing Ctrl+C in the terminal running Ngrok.

4. List Active Tunnels

To view active tunnels, you can use:

./ngrok tunnels

5. Get Help

For a list of all available Ngrok commands and options:

./ngrok help

Summary

This guide provides a step-by-step guide on installing and using Ngrok in Termux. We have written this article as simple as possible so that you can easily understand. By reading this article, you can install and use ngrok in Termux just by running some simple commands. Also, we have provided some basic Ngrok commands that you can use in Termux to improve your Ngrok tunneling skill.

Conclusion

Ngrok in Termux is perfect for Android devices which allows to access files and applications for anyone on the internet with a specific URL. Whether you’re a developer or an ethical hacker Ngrok unlocks secure tunneling on Android devices. With the help of this article, you now have the knowledge to install Ngrok, create ngrok account, and setup the Ngrok authentication token in Termux. 

SHARE THIS POST

Leave a Reply

Your email address will not be published. Required fields are marked *