In this article, we will see how to install NGROK on Ubuntu 22.04 LTS (Jammy Jellyfish). ngrok makes developers or testers life easy by providing access to your locally hosted applications through secure tunnel. You don’t have to deploy your application anymore to perform different kinds of testing. You just have to run the application on your localhost and then run a command to open the tunnel which will allow anyone who would like to test your application to access it over the internet using a unique URL generated by ngrok.
So, ngrok basically brought localhost to use on public Internet with no cost involved. It uses OAUTH 2.0 to secure your applications. It supports OAuth tunnels with major providers such as Google, Github, and Microsoft. ngrok comes with real time inspection interface dashboard which provides information about all the requests sent and response received.
The beauty of ngrok is that it does not require you to change any existing network settings or open any new ports on your router. It uses current network configuration. It is also very easy to install and use on almost all the famous platforms. Here we will see the steps to install ngrok on Ubuntu 22.04 LTS based systems.
Also Read: How to Install NGROK on Ubuntu 20.04 LTS (Focal Fossa)
a) You should have a running Ubuntu 22.04 LTS
Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have wget
and curl
utility available in your System.
d) You should have tar
utility installed in your System.
e) You should also have snap
utility installed in case you are going to install ngrok as snap package.
Before installing any new packages, it is essential to look for all the available updates from default Ubuntu repo and install them by using sudo apt update && sudo apt upgrade
command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 https://brave-browser-apt-release.s3.brave.com stable InRelease
Hit:3 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [894 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [43.0 kB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [40.0 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [101 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [651 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [973 kB]
Get:14 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [289 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:16 http://in.archive.ubuntu.com/ubuntu jammy-backports/main amd64 DEP-11 Metadata [4,912 B]
Get:17 http://in.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [15.5 kB]
Fetched 3,350 kB in 8s (421 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
..............................................................
In the next step, you can install ngrok package by using any of the below methods depending on availability of tools and your needs and requirements.
a) Using Binary Package
If you are looking to install ngrok binary file then you need to get the latest stable linux package by using below wget
command. It will download the compressed file in current working directory.
cyberithub@ubuntu:~$ wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz --2023-08-27 14:08:09-- https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz Resolving bin.equinox.io (bin.equinox.io)... 54.237.133.81, 18.205.222.128, 54.161.241.46, ... Connecting to bin.equinox.io (bin.equinox.io)|54.237.133.81|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8829222 (8.4M) [application/octet-stream] Saving to: ‘ngrok-v3-stable-linux-amd64.tgz’ ngrok-v3-stable-linux-amd64.tgz 100%[============================================================================>] 8.42M 2.00MB/s in 4.8s 2023-08-27 14:08:15 (1.76 MB/s) - ‘ngrok-v3-stable-linux-amd64.tgz’ saved [8829222/8829222]
After downloading the package, you need to extract the binary under /usr/local/bin
path using below tar
command.
cyberithub@ubuntu:~$ sudo tar xvzf ngrok-v3-stable-linux-amd64.tgz -C /usr/local/bin ngrok
b) Using APT
If you are looking to install ngrok package from apt package manager then first you have to visit the official website and get the latest command to download and add public ascii key as shown below.
cyberithub@ubuntu:~$ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null
[sudo] password for cyberithub:
Then you have to add the repo information in ngrok.list
under /etc/apt/sources.list.d
directory path using below command.
cyberithub@ubuntu:~$ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list deb https://ngrok-agent.s3.amazonaws.com buster main
Update the package cache by using sudo apt update
command as shown below. This will load all the packages information from the added repo.
cyberithub@ubuntu:~$ sudo apt update Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease Hit:2 https://brave-browser-apt-release.s3.brave.com stable InRelease Hit:3 https://artifacts.elastic.co/packages/8.x/apt stable InRelease Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease Get:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] Get:6 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Get:7 https://ngrok-agent.s3.amazonaws.com buster InRelease [20.3 kB] Get:8 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB] Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [43.0 kB] Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [40.0 kB] Get:11 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [101 kB] Get:12 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [289 kB] Get:13 http://in.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B] Get:14 http://in.archive.ubuntu.com/ubuntu jammy-backports/main amd64 DEP-11 Metadata [4,896 B] Get:15 http://in.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [15.5 kB] Get:16 https://ngrok-agent.s3.amazonaws.com buster/main amd64 Packages [2,799 B] Get:17 https://ngrok-agent.s3.amazonaws.com buster/main i386 Packages [2,513 B] Fetched 857 kB in 9s (93.4 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done
Then install ngrok package by using sudo apt install ngrok
command as shown below. This will download and install the package along with all its dependencies.
cyberithub@ubuntu:~$ sudo apt install ngrok Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: ngrok 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 6,499 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 https://ngrok-agent.s3.amazonaws.com buster/main amd64 ngrok amd64 3.3.3 [6,499 kB] Fetched 6,499 kB in 5s (1,431 kB/s) Selecting previously unselected package ngrok. (Reading database ... 241624 files and directories currently installed.) Preparing to unpack .../archives/ngrok_3.3.3_amd64.deb ... Unpacking ngrok (3.3.3) ... Setting up ngrok (3.3.3) ...
c) Using Snap
Finally, if you have snap utility available in your system then you can also install ngrok as snap package from snap store by using sudo snap install ngrok
command as shown below.
cyberithub@ubuntu:~$ sudo snap install ngrok ngrok (v3/stable) 3.3.1 from Kyle Wenholz (kyle-ngrok) installed
After successful installation, you can check the current installed ngrok version by using ngrok --version
command as show below.
cyberithub@ubuntu:~$ ngrok --version ngrok version 3.3.3
Then you have to run ngrok config add-authtoken
command to add your authtoken to the default ngrok.yml
configuration file. This will grant you access to more features and longer session times.
NOTE:
cyberithub@ubuntu:~$ ngrok config add-authtoken 7JLRVM4nWok9AihPardBrw_8JLwivdoNjqOsd9b9NWxOP Authtoken saved to configuration file: /home/cyberithub/snap/ngrok/108/.config/ngrok/ngrok.yml
Now to start a HTTP tunnel forwarding to your local Port 80
, run ngrok http 80
command as shown below.
cyberithub@ubuntu:~$ ngrok http 80 ngrok (Ctrl+C to quit) Take our ngrok in production survey! https://forms.gle/aXiBFWzEA36DudFn6 Session Status online Session Expires 1 hour, 59 minutes Update update available (version 3.3.4, Ctrl-U to update) Terms of Service https://ngrok.com/tos Version 3.3.1 Region United States (us) Latency 22ms Web Interface http://127.0.0.1:4040 Forwarding https://be77-72-106-53-91.ngrok.io -> http://localhost:80 Connections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00
Now you have to go to Desktop
and open your favorite web browser. In the URL section, provide 127.0.0.1:4040
and press Enter
. You will see a dashboard open like below where it will provide you the tunnel URLs and should show status as online
. You can provide this tunnel URL to anyone who would like to access and test your locally deployed application.
You can also check the configuration and metrics status by clicking on Status
as shown below. You can see all the connections information from here along with your tunnel configuration.
Once you are done using Ngrok, you can choose to uninstall it from your system by using any of the below methods.
a) Remove binary file
If you are using binary file, then all you need to do is to remove the file by using sudo rm -rf /usr/local/bin/ngrok
command as shown below.
cyberithub@ubuntu:~$ sudo rm -rf /usr/local/bin/ngrok
b) Using APT
If you installed package using apt package manager then you have to run sudo apt remove ngrok
command to remove the package from your system.
cyberithub@ubuntu:~$ sudo apt remove ngrok Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: ngrok 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Y (Reading database ... 241626 files and directories currently installed.) Removing ngrok (3.3.3) ... dpkg: warning: while removing ngrok, directory '/usr/local' not empty so not removed
c) Using Snap
If you installed ngrok as snap package then to remove you have to run sudo snap remove ngrok
command as shown below.
cyberithub@ubuntu:~$ sudo snap remove ngrok ngrok removed
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…