Raspberry Piにngrokをインストール

自宅に置いているRaspberry Piにリモートから簡単にアクセス出来るようにするためにngrokを導入。

インストール方法

まずStable版のnode.jsをインストールするためにnode.jsのバージョン管理を行うパッケージ 'n' をインストールする。

> sudo npm install n -g

次に 'n' を使ってStable(LTS)版のnode.jsをインストールする。

> sudo n lts

aptでインストールした不要となった node.jsとnpmを削除する。

> sudo apt purge -y nodejs npm

npmでngrokをインストールする。普通にインストールするとエラーになるのでオプションを指定する。

> sudo npm install ngrok -g --unsafe-perm=true --allow-root

ngrokが動作するか確認する

> ngrok http 8080
ngrok by @inconshreveable                                                       (Ctrl+C to quit)
                                                                                               
Session Status                online                                                            
Session Expires               1 hour, 59 minutes                                                
Version                       2.3.40                                                            
Region                        United States (us)                                                
Web Interface                 http://127.0.0.1:4040                                             
Forwarding                    http://b193-60-120-124-xxx.ngrok.io -> http://localhost:8080      
Forwarding                    https://b193-60-120-124-xxx.ngrok.io -> http://localhost:8080     
                                                                                               
Connections                   ttl     opn     rt1     rt5     p50     p90                       
                             0       0       0.00    0.00    0.00    0.00   

この記事が気に入ったらサポートをしてみませんか?