Add install/uninstall scripts

This commit is contained in:
Vincent Hsu 2019-02-15 16:46:50 +08:00
parent fabd6e9979
commit d246db2f5f
3 changed files with 49 additions and 5 deletions

View File

@ -1,15 +1,23 @@
# Installation
Step 1: Place [`ngrok`](https://ngrok.com/download) in `/opt/ngrok/`.
Step 1: Place [`ngrok`](https://ngrok.com/download) in `/opt/ngrok/`
Step 2: Get `authtoken` from ngrok website, then add it to `/opt/ngrok/ngrok.yml`.
Step 2: Get `authtoken` from ngrok website, then add it to `/opt/ngrok/ngrok.yml`
Step 3. Modify your own configrations in `/opt/ngrok/ngrok.yml`.
Step 3: Add `ngrok.service` to `/etc/systemd/system/`
Step 4: Add `ngrok.service` to `/lib/systemd/system/`.
Step 5: Start ngrok service by typing:
Step 4: Start ngrok service by typing:
```
systemctl daemon-reload
systemctl enable ngrok.service
systemctl start ngrok.service
```
or just execute `install.sh` on Linux x64 platform.
```
chmod +x install.sh
./install.sh <your_authtoken>
```

25
install.sh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
if (( $EUID != 0 )); then
echo "Please run as root"
exit 1
fi
if [ -z "$1" ]; then
echo "./install.sh <your_authtoken>"
exit 1
fi
git clone https://github.com/vincenthsu/systemd-ngrok.git
cd systemd-ngrok
cp ngrok.service /lib/systemd/system/
mkdir -p /opt/ngrok
cp ngrok.yml /opt/ngrok
sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
cd /opt/ngrok
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
systemctl enable ngrok.service
systemctl start ngrok.service

11
uninstall.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
if (( $EUID != 0 )); then
echo "Please run as root"
exit 1
fi
systemctl stop ngrok.service
systemctl disable ngrok.service
rm /lib/systemd/system/ngrok.service
rm -rf /opt/ngrok