Skip to content

Instantly share code, notes, and snippets.

@ardyantohermawan
Created November 7, 2017 06:30
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save ardyantohermawan/04f3f79b17399949e24e18c653595902 to your computer and use it in GitHub Desktop.
Save ardyantohermawan/04f3f79b17399949e24e18c653595902 to your computer and use it in GitHub Desktop.
Ngrok Service Ubuntu 16.04
#!/bin/bash
# download
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
# unzip
unzip ngrok-stable-linux-amd64.zip
# move to /usr/local/bin
sudo mv ngrok /usr/local/bin
# create directory
sudo mkdir -p /opt/ngrok/systemd/system/
# export authtoken
export TOKEN="authtoken from dashboard"
# create config file
echo "authtoken: $TOKEN" | sudo tee /opt/ngrok/ngrok.yml
# create systemd script
echo "[Unit]
Description=ngrok script
[Service]
ExecStart=/usr/local/bin/ngrok tcp --region=ap --config=/opt/ngrok/ngrok.yml 22
Restart=always
[Install]
WantedBy=multi-user.target" | sudo tee /opt/ngrok/systemd/system/ngrok.service
# copy systemd script
sudo cp /opt/ngrok/systemd/system/ngrok.service /etc/systemd/system/ngrok.service
# reload daemon
sudo systemctl daemon-reload
# enable service
sudo systemctl enable ngrok.service
# start service
sudo systemctl start ngrok.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment