• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Module 9 – Ngrok Run on Background Raspberry Pi – Raspbian Lite OS

Q&A Forum › Category: Home Automation › Module 9 – Ngrok Run on Background Raspberry Pi – Raspbian Lite OS
0 Vote Up Vote Down
i.manolov_pvdesign asked 6 years ago

Hello, thanks for the good course (Home Automation).

I installed the Ngrok on Raspberry Pi 3 Model B+, but I need some your help.

I followed the steps of Module 9 to install the Ngrok and got my unique link!

I put it in the browser and connected to my dashboard of Node Red and the tunnel works!

After, I restarted the operating system (Raspbian) and the tunnel did not work.

I think, the Ngrok is off, but I do not know how to turn on the Ngrok server ?

How to run the Ngrok server automatically, after restarting the operating system ?

How to change a region in the Ngrok settings, because I’m in europe ?

This free version of the Ngrok,  how long will the tunnel work in hours ?

Thanks,

Best regards!
Ivaylo Manolov.

10 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Ivaylo, thanks for bringing that up because I definitely need to add that part to the course.

First, you need to install a software called screen, so that your command can be executed in the background. To install screen:

sudo apt install screen

Then, if you would run the ngrok software with:

screen -d -m ./ngrok http -auth="yourusername:yourpassword" 1880

You would see anything in the Terminal, but your tunnel would be running in the background.
In order to start ngrok in the boot, you need to edit the file .bashrc:

sudo nano /home/pi/.bashrc

Scroll to the end of that file and add this next line:

screen -d -m /home/pi/./ngrok http -auth="yourusername:yourpassword" 1880

Control+X, then Enter and Y. Reboot your Pi and your tunnel should start automatically. If you login into the ngrok.com website, you’ll see the URL that you need to access and if the tunnel is active or not.

The tunnel should run indefinitely, but you can’t customize the URL when the Pi restarts.

I hope that helps!

0 Vote Up Vote Down
Bob Jakicic answered 6 years ago

Hi, this works on my Pi 3 BUT only after I SSH into the Pi.  Ngrok will not display my Tunnels Online until I do this.  Any idea why this is necessary?  Thanks, Bob

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Bo?

  • dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/

The rc.local should solve your problem

0 Vote Up Vote Down
Bob Jakicic answered 6 years ago

Thanks Rui.  I already figured out how to use SYSTEMD.  It works great.
Bob

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Thanks for letting me know!

0 Vote Up Vote Down
Claudio answered 4 years ago

Hi there,
I have the same problem and went to the suggested site: dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/
You mention that the rc.local should solve the problem, but I do not understand this: Add commands to execute the python program, preferably using absolute referencing of the file location (complete file path are preferred)
What should be the command when Ngrok should run when the RBPi starts up?  
Sorry i´m new to this!
Cheerio Claudio

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

You need to understand a little bit of linux so you can modify a text file with a command line application. On that linked web site they use “nano”. I’m pretty old school so when I learned *nix some 40 years ago I used “ed” and then “vi”.
 
See if you can find a linux tutorial and then a nano tutorial.

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

Hello Claudio, what do you mean by same problem? If you use the method:

sudo nano /home/pi/.bashrc

Does it work for you when you open the SSH connection? 

0 Vote Up Vote Down
Claudio answered 4 years ago

Hi Rui,
There is nothing wrong with your description.
now it is working.
After rebooting I overlooked the fact that I should use the new URL provided in the NGROK tunnel online followed by /ui
Sorry for the hassle

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

I’m glad it’s working now, you can always find the latest URL when you login at Ngrok online Dashboard.
Regards,
Rui

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.