Ubuntu Server 安装 ngrok 2.0 客户端 作者: 萧禹 时间: 2019-08-23 分类: Ubuntu 访问: 1,937 次 ## 说明 - Ubuntu Server 18.10 - ngrok-2.2.8-linux-arm64 ## 步骤 创建运行 **ngrok** 的用户 *ngrok* $sudo adduser --system --gecos "ngrok Service" --disabled-password --group --home /opt/ngrok ngrok :exclamation:该 *ngrok* 用户以 `/opt/ngrok` 为主目录, 这意味着以 *ngrok* 用户运行的 **ngrok** 会读取 `/opt/ngrok/.norok2` 下的 `ngrok.yml` 文件 切换到 *ngrok* 用户运行一次 ngrok, 此步骤自动生成配置文件 $su --shell /bin/bash --login ngrok $./ngrok authtoken xxxxxxxxxxxxxxxxxxxxxx :exclamation:增加一次授权令牌后下次启动就自动调用上次的授权令牌了 编辑配置(内容根据自身需要更改) $sudo nano /opt/ngrok/.norok2/ngork.yml ``` authtoken: xxxxxxxxxxxxxxxxxxxxxxxxx remote_management: null tunnels: default: proto: http addr: 80 ``` 创建 **ngrok** service $sudo nano /etc/systemd/system/ngrok.service ``` [Unit] Description=ngrok Documentation=man:ngrok After=network-online.target [Service] Type=simple UMask=003 ExecStart=/opt/ngrok/ngrok start --all --config=/opt/ngrok/.ngrok2/ngrok.yml Restart=on-failure # Time to wait before forcefully stopped. TimeoutStopSec=300 [Install] WantedBy=multi-user.target ``` 启动 **ngrok** 的 service $sudo systemctl enable /etc/systemd/system/ngrok.service $sudo systemctl start ngrok $sudo systemctl status ngrok ## 参考 - [ngrok – link documentation](https://ngrok.com/docs/ngrok-link#service) 标签: Ubuntu ngrok systemctl 文章版权:萧禹的博客 - 这个人很懒, 什么都没写 本文链接:https://www.flysfeq.site/index.php/archives/178/ 转载请注明文章原始出处 !
代码示例规范,注释详细,便于复现。
作者对主题的挖掘深入骨髓,展现了非凡的洞察力和理解力。