How to Install and Use Ngrok in Termux (Complete Guide)

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. In this article, I will give you commands to install Ngrok in Termux, with basic ngrok commands that you can use in Termux.

Ngrok in Termux Installation and Basic Commands
Ngrok in Termux Installation and Basic Commands

What is Ngrok

Ngrok is a tool that creates a safe tunnel for the 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 webtools using development services such as, GitHub, Stripe, and more.

How to install Ngrok in Termux

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

Now download offical Ngrok file in your Termux by typing this command:

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

Step 4: Unzip the Ngrok File

The downloaded file will be in .tgz format, you need to extract it by typing this command:

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

After extracting the file, you can able to start Ngrok in your Termux by typing this 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 is successfully installed
Ngrok is successfully installed

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

Authentication token is required to use Ngrok in Termux. You can create Ngrok authentication token for Termux by visiting Ngrok website. Below I have given some simple steps to create Ngrok authentication token.

How to create ngrok authentication token

  • Go to the official Ngrok website ngrok.com.
  • Now create a account by clicking on get started 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

Now you need to set the Ngrok authentication token in Termux. You can easily setup the Ngrok authentication token by using this command:

ngrok authtoken YOUR_AUTH_TOKEN

Use ngrok authtoken command with your Ngrok authentication token.

Now 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 4040

This will start a secure tunnel for your local server running on port 4040.

Ngrok Usage Commands

Ngrok Basic Commands
Ngrok Basic Commands

Here are the some basic Ngrok usage commands for Termux:

1. View the Ngrok Dashboard

Dashboard will show you requests and responses of your tunnel, you can access the dashboard by using this url:

http://127.0.0.1:4040

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

In this article, I have provided the commands to install and setup Ngrok in Termux. I 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 *