少しまえにUbuntu Desktop と Windows11 のデュアルブート環境を作りました。
その際にGRUBメニューでの切り替えがやりやすいようにRaspberryPiにリモートKVM TinyPilotを導入していましたので、その件を掘り下げます。
目次
リモートKVM TinyPilot
有名なトコロでPIKVMというシステムがあるのですが、その開発メンバーの方?が公開されているTinyPilot。
PIKVMと悩んだのですが、TinyPilotはRaspberryPiの純正OSのまま行けるようなので、こちらを選んだ次第です。
動作の動画
何はともあれ、動画のほうが動作は分かりやすいでしょう。
必要なもの
・Raspberry Pi 4 Model B/2G
・HDMI to CSI C790 もしくは HDMI キャプチャーボード
・HDMIケーブル
インストールのやりかた
本系のGITが一番分かりやすいですが、一応日本語で書いておきます。
本家のGIT
OSを焼く
RaspberryPiやってる人なら皆さんお使いの『Raspberry Pi Imager』でOS焼きます。
バージョンは Bullseye (32-bit) 指定です。
最新のOSを焼いて試した時がダメだったような・・・。
インストールコマンド
curl \ --silent \ --show-error \ https://raw.githubusercontent.com/tiny-pilot/tinypilot/master/get-tinypilot.sh | \ bash - && \ sudo reboot
これで勝手にインストールされます。
HDMI to CSI C790 使う場合
if ! grep --silent '^dtoverlay=tc358743$' /boot/config.txt; then echo 'dtoverlay=tc358743' | sudo tee --append /boot/config.txt fi
公式で↑のように書いてありますが、/boot/config.txt に直接書いても大丈夫。
(sudo apt remove --yes tinypilot || true) && \ curl \ --silent \ --show-error \ https://raw.githubusercontent.com/tiny-pilot/tinypilot/master/get-tinypilot.sh | \ bash - && \ sudo reboot
パスワード認証の追加
ネットワーク内でIP叩くと誰でも入れちゃうんで、それが嫌ならhtpasswdを導入。
sudo htpasswd /etc/nginx/.htpasswd admin New password: Re-type new password: Adding password for user admin
admin の部分はお好みで
#設定ファイルを編集 sudo nano /etc/nginx/conf.d/tinypilot.conf #location部分に追記 location / { proxy_pass http://tinypilot; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; }
SSL導入
#自己証明書 色々対話型で出るけどエンター連打でOK sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/cert/private.key -out /etc/nginx/cert/cert.pem #設定ファイルを編集 sudo nano /etc/nginx/conf.d/tinypilot.conf #80はコメントアウトしちゃっても良いし、そのままでもOK #443からを追記です #listen 80; #listen [::]:80; listen 443 ssl default_server; listen [::]:443 ssl default_server; ssl_certificate /etc/nginx/cert/cert.pem; ssl_certificate_key /etc/nginx/cert/private.key;
上手くいかない時は、パーミッション変えてみると良い。
sudo chmod 644 /etc/nginx/cert/cert.pem sudo chmod 600 /etc/nginx/cert/private.key
テストして問題無ければnginxを再起動。
まぁ 自分だけだし、 nginx -t はやらないでも平気だけど。
sudo nginx -t sudo systemctl restart nginx
こんな感じで完成。
感想
凄く良い!
超便利!
意外と初期セットアップだけモニター繋ぐのが面倒だったり、キーボードもね。
あとSSHする時にネットワーク外になってる時とかにも便利なんです。
便利なのでもう一つ作ろうかなーとか思いました。
開発者に感謝!!
ではでは。