Ubuntu 20.04 インストーラを /mnt ディレクトリにマウントするときの例。
# mount -t iso9660 -o loop,ro ~/Downloads/ubuntu-ja-20.04-desktop-amd64.iso /mnt
● mount, iso, イメージ, iso image, マウント
主に Linux (Ubuntu, Fedora) 関連の設定メモ&小技集です。たまに Windows 関連ネタも。
(プロンプトの $ は一般ユーザ権限、# は root 権限です。いちいち説明はせんよ。)
Ubuntu 20.04 インストーラを /mnt ディレクトリにマウントするときの例。
# mount -t iso9660 -o loop,ro ~/Downloads/ubuntu-ja-20.04-desktop-amd64.iso /mnt
● mount, iso, イメージ, iso image, マウント
大容量データのダウンロードを高速化できるコマンド aria2。
急ぎで大きいファイルをダウンロードしたいときに便利。
Ubuntu なら apt コマンドでサクッとインストール。
# apt install aria2
使い方。5 セッションでダウンロードする場合。
$ aria2c -x5 URL
イカしてる。
● マルチ, コネクション, multi, connection, HTTP, HTTPS, FTP, SFTP, aria2, 高速, 複数, 並列, curl, wget, 短縮
Raspberry Pi で NTPd を設定していても、起動後に時刻が同期するまでに時間がかかる。
一旦、ntpdate で同期するように設定。
ntpdate をインストール
# apt -y install ntpdate
自動起動するように設定。
# vi /etc/systemd/system/ntpdate.service (下記のように記述) [Unit] Description=Set time with ntpdate After=network.target [Service] # use -u to avoid conflict with ntpd ExecStart=/usr/sbin/ntpdate -u ntp.nict.jp # we may not have network yet, so retry until success Restart=on-failure RestartSec=60s [Install] WantedBy=multi-user.target
ntpdate.service を有効にする。 再起動して、時刻が同期されることを確認。
# systemctl enable ntpdate.service
● Raspberry Pi, Ubuntu, server, ntpdate, 時刻同期, ntp, 起動時
/etc/netplan/50-cloud-init.yaml を編集。
# vi /etc/netplan/50-cloud-init.yaml
(下記のように編集)
network:
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses: [192.168.10.10/24]
gateway4: 192.168.10.1
nameservers:
addresses: [192.168.10.1, 1.1.1.1, 8.8.8.8]
optional: true
version: 2
設定を反映。
# netplan apply
設定の確認。
# ip address ... 2: eth0:mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff inet 192.168.10.100/24 brd 192.168.10.255 scope global eth0 valid_lft forever preferred_lft forever ...
● IPv4, IP アドレス, IP address, 固定, static
Raspberry Pi 4 に Ubuntu server 18.04.4 をインストールしたので、ホスト名を raspi4 にする。
# hostnamectl set-hostname raspi4
確認
# hostnamectl
Static hostname: raspi4
Icon name: computer
Machine ID: a760a1c3601a4049a70cf24254987172
Boot ID: 523853d4411746268f1fd89d9867aa3a
Operating System: Ubuntu 18.04.4 LTS
Kernel: Linux 5.3.0-1022-raspi2
Architecture: arm64
● ubuntu, server, hostname, ホスト名, 変更, hostnamectl
Raspberry Pi 4 で、ようやく ADS-B フィーダーを動かすことができました。
Ubuntu 19.10 server では、dump1090-fa が、なぜかすぐに落ちました。結局、解決できずしばらく放置してたのですが、
Raspberry Pi 4 用 Ubuntu Server 18.04.4 64-bit が出ていので試したところ、動くようになりました。
| Hardware | Raspberry Pi 4 Model B / 4 GB |
| OS | Ubuntu Server 18.04.4 64-bit |
| SD | SanDisk Ultra micro SDHC 32GB Class10 A1 |
| DVB-T | R820T2 & SDR+SMD X-tal 10PPM [DVB-T+FM+DAB/RTL-SDR][RTL2832U+R820T2][High quality USB-CN][広帯域受信用]Blue |
Ubuntu のサイト からイメージを取得。micro SD に書き込む。
$ sudo apt install gddrescue xz-utils
$ unxz ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz
$ sudo ddrescue -D --force ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img /dev/mmcblk0
GNU ddrescue 1.23
Press Ctrl-C to interrupt
ipos: 4539 MB, non-trimmed: 0 B, current rate: 14417 kB/s
opos: 4539 MB, non-scraped: 0 B, average rate: 14834 kB/s
non-tried: 460714 kB, bad-sector: 0 B, error rate: 0 B/s
rescued: 4539 MB, bad areas: 0, run time: 5m 6s
pct rescued: 90.78%, read errors: 0, remaining time: 32s
time since last successful read: 0s
Copying non-tried blocks... Pass 1 (forwards)
デフォルトユーザのログインは、User: ubuntu, Password ubuntu で。
パスワード変えるのと、adduser でユーザ作りました。
SSHd は、最初から入ってました。
あとはお好みで。
$ sudo apt update $ sudo apt upgrade NTP をインストールする。 $ sudo apt remove ntpdate $ sudo systemctl stop systemd-timesyncd.service $ sudo systemctl disable systemd-timesyncd.service $ sudo apt install ntp $ sudo systemctl enable ntp $ sudo systemctl start ntp
(参考)
https://ja.flightaware.com/adsb/piaware/install
https://discussions.flightaware.com/t/piaware-v-3-7-1-on-debian-10-0-buster-amd64-intel-pc/52414
■ Piaware
$ sudo apt install -y git devscripts build-essential debhelper tcl8.6-dev autoconf python3-dev python3-venv virtualenv \ dh-systemd zlib1g-dev tclx8.4 tcllib tcl-tls itcl3 net-tools libboost-system-dev libboost-program-options-dev \ libboost-regex-dev libboost-filesystem-dev $ git clone https://github.com/flightaware/piaware_builder.git $ cd piaware_builder $ ./sensible-build.sh buster $ cd package-buster $ sudo dpkg-buildpackage -b --no-sign $ cd ../ $ sudo dpkg -i piaware_3.8.1_arm64.deb piaware-dbgsym_3.8.1_arm64.ddeb piaware ユーザを手動で作成 $ sudo useradd --system piaware $ sudo touch /etc/piaware.conf 既に feeder id がある場合は、下記を設定。 $ sudo piaware-config feeder-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx $ sudo piaware-config allow-auto-updates yes $ sudo piaware-config allow-manual-updates yes $ sudo systemctl restart piaware 自動起動を有効化 $ sudo systemctl enable piaware
■ dump1090-fa
$ sudo apt install -y git lighttpd build-essential debhelper dh-systemd \ libboost-system-dev libboost-program-options-dev libboost-regex-dev \ libboost-filesystem-dev libsoapysdr-dev soapysdr-module-rtlsdr \ debhelper dh-systemd librtlsdr-dev libusb-1.0-0-dev \ git pkg-config libncurses5-dev lighttpd libbladerf-dev $ git clone https://github.com/flightaware/dump1090.git dump1090-fa $ cd dump1090-fa $ sudo dpkg-buildpackage -b --no-sign $ cd ../ $ sudo dpkg -i dump1090-fa_3.8.1_arm64.deb dump1090-fa-dbgsym_3.8.1_arm64.ddeb $ sudo systemctl restart dump1090-fa
しばらくしたら、下記リンクで Piaware と FlightAware のアカウントを関連付ける。
同じルータ配下の別 PC からブラウザでアクセスすれば OK。
https://flightaware.com/adsb/piaware/claim
更に、MY ADS-B のリンクから、アンテナ設置場所の緯度、経度、高度を設定すれば OK。
tcl-tls のバージョンが古いので、インストールできないと言われた。パッケージの依存関係が壊れた?
$ sudo apt --fix-broken install
$ sudo apt install libssl-dev tcl-dev chrpath
$ git clone http://github.com/flightaware/tcltls-rebuild.git
$ cd tcltls-rebuild
$ ./prepare-build.sh buster
$ cd package-buster
$ sudo dpkg-buildpackage -b --no-sign
$ cd ../
$ sudo dpkg -i tcl-tls_*.deb
$ cd ..
$ sudo dpkg --add-architecture armhf
$ sudo dpkg --print-foreign-architectures
armhf
$ sudo bash -c "$(wget -O - https://repo-feed.flightradar24.com/install_fr24_rpi.sh)"
______ _ _ _ _ _ _____ ___
| ___|| |(_) | | | | | | / __ \ / |
| |_ | | _ __ _ | |__ | |_ _ __ __ _ __| | __ _ _ __`' / /' / /| |
| _| | || | / _` || '_ \ | __|| '__|/ _` | / _` | / _` || '__| / / / /_| |
| | | || || (_| || | | || |_ | | | (_| || (_| || (_| || | ./ /___\___ |
\_| |_||_| \__, ||_| |_| \__||_| \__,_| \__,_| \__,_||_| \_____/ |_/
__/ |
|___/
[main][i]FR24 Feeder/Decoder
[main][i]Version: 1.0.25-3/generic
[main][i]Built on Apr 8 2020 07:06:55 (HEAD-5e8ef0c.git/Linux/static_armel)
[main][i]Running on: ubuntu18.04
[main][i]Local IP(s): 192.168.10.10
[main][i]Copyright 2012-2020 Flightradar24 AB
[main][i]https://www.flightradar24.com
[main][i]DNS mode: PING
Welcome to the FR24 Decoder/Feeder sign up wizard!
Before you continue please make sure that:
1 - Your ADS-B receiver is connected to this computer or is accessible over network
2 - You know your antenna's latitude/longitude up to 4 decimal points and the altitude in feet
3 - You have a working email address that will be used to contact you
4 - fr24feed service is stopped. If not, please run: sudo systemctl stop fr24feed
To terminate - press Ctrl+C at any point
Step 1.1 - Enter your email address (username@domain.tld)
$:●Flightradar24 に登録しているメールアドレスを入力
Step 1.2 - If you used to feed FR24 with ADS-B data before enter your sharing key.
If you don't remember your sharing key, pelase use the retrival form:
https://feed.flightradar24.com/forgotten_key.php
Otherwise leave this field empty and continue.
$:●新規登録であれば、メールで送られてきた sharing key を入力。または既存のものを入力
Verifying sharing key...OK
Step 1.3 - Would you like to participate in MLAT calculations? (yes/no)$:yes
IMPORTANT: For MLAT calculations the antenna's location should be entered very precise!
Step 3.A - Enter antenna's latitude (DD.DDDD)
$:●設置場所の緯度を入力
Step 3.B - Enter antenna's longitude (DDD.DDDD)
$:●設置場所の経度を入力
Step 3.C - Enter antenna's altitude above the sea level (in feet)
$:●設置場所の高度を入力
Using latitude: XX.XXXX, longitude: XXX.XXXX, altitude: XXft above sea level
We have detected that you already have a dump1090 instance running. We can therefore automatically configure the FR24 feeder to use existing receiver configuration, or you can manually configure all the parameters.
Would you like to use autoconfig (*yes*/no)$:● yes を入力
Step 6A - Please select desired logfile mode:
0 - Disabled
1 - 48 hour, 24h rotation
2 - 72 hour, 24h rotation
Select logfile mode (0-2)$:● 2 を入力
Step 6B - Please enter desired logfile path (/var/log/fr24feed):
$:●何も入力せずに Enter
Submitting form data...OK
Congratulations! You are now registered and ready to share ADS-D data with Flightradar24.
+ Your radar id is T-RJFF33, please include it in all email communication with us.
+ Please make sure to start sharing data within one month from now as otherwise your ID/KEY will be deleted.
Thank you for supporting Flightradar24! We hope that you will enjoy our Premium services that will be available to you when you become an active feeder.
To start sending data now please execute:
sudo systemctl start fr24feed
Saving settings to /etc/fr24feed.ini...OK
Settings saved, please run "sudo systemctl restart fr24feed" to use new configuration.
fr24feed を再起動。
$ sudo systemctl restart fr24feed
続いて RadarBox。
RadarBox のアカウントに紐付ける方法は、忘れてしまいました。
通常は、下記を実行するだけなのですが、スクリプト内の lsb_release -c コマンドで、コードネームが bionic となってしまい、
スクリプトが停止してしまいます。
ちょっと修正して、buster と同じ流れにすれば OK。
$ sudo apt install libc6-dev-armhf-cross $ sudo bash -c "$(wget -O - http://apt.rb24.com/inst_rbfeeder.sh)" Don't know how to install for a distribution named で止まってしまう、、、。
inst_rbfeeder.sh を取得して、スクリプトを修正、実行します。
$ wget http://apt.rb24.com/inst_rbfeeder.sh
$ vi inst_rbfeeder.sh
case 文の buster) となっている部分に bionic を追記。
(変更前)
buster)
(変更後)
buster|bionic)
$ sudo sh inst_rbfeeder.sh
■2020/05/04 追記。
buster だと、パッケージの依存関係が解消できずに、rbfeeder をインストールできなくなりました。
stretch に変更するとインストールできました。かなり無理クリ。
$ wget http://apt.rb24.com/inst_rbfeeder.sh
$ vi inst_rbfeeder.sh
case 文の stretch) となっている部分に bionic を追記。
(変更前)
stretch)
(変更後)
stretch|bionic)
$ sudo sh inst_rbfeeder.sh
mlat-client をソースからインストール。
$ sudo apt install python-minimal $ wget https://github.com/mutability/mlat-client/archive/v0.2.11.tar.gz $ tar zxvf v0.2.11.tar.gz $ cd mlat-client-0.2.11/ $ sudo dpkg-buildpackage -b --no-sign $ sudo dpkg -i ../mlat-client_0.2.11_arm64.deb $ sudo ./setup.py install (再起動) $ sudo init 6
設定ファイルのメモを残しておきます。
$ cat /etc/rbfeeder.ini [client] network_mode=true log_file=/var/log/rbfeeder.log key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx sn=XXXXXXXXXXXX [network] mode=raw external_port=30005 external_host=127.0.0.1 [mlat]
dump1090-fa の受信状況をグラフで表示。
http://192.168.x.x/graphs1090/ にアクセス。
$ sudo bash -c "$(wget -q -O - https://raw.githubusercontent.com/wiedehopf/graphs1090/master/install.sh)"
FR24 の MLAT が有効にならない。
fr24feed の起動を遅らせると良いらしい。
参考: https://gato.intaa.net/archives/21762
$ sudo systemctl disable fr24feed $ sudo vi /etc/sytemd/system/fr24feed.service (下記を変更) #After=network-online.target After=rc-local.service (LimitCORE=infinity の次の行に下記を追加) ExecStartPre=/bin/sleep 90 $ sudo systemctl enable fr24feed $ sudo init 6
ADS-B feeder を設置すると、下記プランが無料で利用可能になります。
年間、$ 1 = 108 円 換算で、$ 499.99 + ($ 89.95 × 12) + $399.50 = $ 1,978.89 = 213,720 円 お得です♪
| Service | Plan | $ / month | $ / year |
| Flightradar24 | Business | $ 49.99 | $ 499.99 |
| FlightAware | Enterprise | $ 89.95 | $ - |
| RadarBox | BUSINESS | $ 39.95 | $ 399.50 |
dump1090 の受信状況は下記コマンドで確認できる。
$ nc 127.0.0.1 30002 $ nc 127.0.0.1 30003
● Raspberry Pi 3, raspi3, raspi, DVB-T, Ubuntu MATE 18.04, ADS-B, Flightradar24, FlightAware RadarBox, dump1090-fa
Raspberry Pi 4 に Ubuntu Server 19.10 をインストールして Wi-Fi のセットアップ中。
/etc/network/interfaces で設定するんじゃないのね。
netplan は、/etc/netplan/XX-***.yaml の XX が若い順に後勝ちで処理されるので、
/etc/netplan/98-wifi.yaml を作成。SSID と SSID-PASSWORD は適当に修正。
# vi /etc/netplan/98-wifi.yaml
network:
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
SSID:
password: SSID-PASSWORD
version: 2
設定を反映するのは netplan コマンドで。
# netplan apply
● raspberry pi 4, raspi4, ubuntu, server, 19.10, wi-fi, Wi-Fi, interfaces, netplan, wlan0, 無線 LAN
Proxy サーバ経由で SSH 接続して、Samba サーバにアクセスする手順のメモ。
確認環境: Samba サーバ = Ubuntu 16.04、クライアント = Windows10
まず、概要を説明すると、下記のようになる。
Windows でループバック I/F (10.255.255.1/24) を作成して、
10.255.255.1:445 -> 10.255.255.1:44445 に port proxy して、
Proxy サーバ経由で SSH 接続するときに、ポートフォワード設定をしておいて、
10.255.255.1:44445 -> XX.XX.XX.XX:445 にアクセス。
サーバ PC (Ubuntu 16.04) では、Samba, SSH サーバ が起動していることが前提 (構築手順等の説明省略)。
あと、proxy サーバ経由でその PC にアクセスできること。
まず、Windows PC にループバックアダプタを追加する。
デバイスマネージャを開いて、"操作" -> "レガシハードウェアの追加"。
ハードウェアの追加ウィザードの開始。
一覧から選択したハードウェアをインストールする。
ネットワークアダプター。
Microsoft KM-TEST Loopback Adapter。
わかりやすいように名前を "Loopback" に変えておく。
Loopback のプロパティを開き、Microsoft ネットワーク用ファイルとプリンター共有 のチェックを外す。
インターネット プロトコル バージョン 4 (TCP/IPv4) を開いて、固定 IP アドレスを設定。
IP アドレス = 10.255.255.1
サブネット マスク = 255.255.255.0
詳細設定 -> WINS、NetBIOS over TCP/IP を無効にする。
管理者権限で、コマンドプロンプトを起動する。
SMB ドライバ (サービス) がすでに起動している場合は、下記を実行する。
(自分の PC では必要なかった)
> sc config smb start= demand
portproxy の設定。
> netsh interface portproxy add v4tov4 listenaddress=10.255.255.1 listenport=445 connectaddress=10.255.255.1 connectport=44445
設定内容を確認。
> netsh interface portproxy show v4tov4 Address Port Address Port --------------- ---------- --------------- ---------- 10.255.255.1 445 10.255.255.1 44445
ログイン時に、下記が実行されるように設定する。
設定後、再起動する。
C:\Windows\System32\net.exe start smb
再起動後、設定が下記のようになっていれば OK。
ダメな場合は、タスクスケジューラを開いて、タスクの停止、実行を手動で行うと良いかも。
(場合によっては、社内 LAN 接続ツールの挙動がおかしくなる。その時は、一旦タスクを停止して、接続後、起動する)
> netstat -an | find ":445" TCP 0.0.0.0:445 0.0.0.0:0 LISTENING TCP 10.255.255.1:445 0.0.0.0:0 LISTENING TCP [::]:445 [::]:0 LISTENING
今回は TeraTerm を使ってアクセスしたが、PuTTY でも同様のことができる。
まず、ポートフォワードの設定を行う。
to remote machine のところに、サーバ PC の IP アドレスを入力。
proxy サーバを設定。
SSH でログインする。
TeraTerm で、SSH のコネクションを張っている間、Samba のアクセスが可能となる。
USER の部分は任意で入力。
\\10.255.255.1\USER
● Samba, SSH, proxy, windows10, port foward, smb, teraterm
Ubuntu server のデフォルトは CUI ログインになっていて、キーボードレイアウトも英語になっています。
それを日本語キーボードにする方法。
# dpkg-reconfigure keyboard-configuration ・Generic 105-key (Intl) PC を選択 ・keyboard: Japanese を選択 ・Keyboard Layout: Japanese を選択 ・AltGr 設定: The default for the keyboard layout を選択 ・Compose key: No compose key を選択
● Ubuntu, server, keyboard, english, japanese, 英語, 日本語, キーボード, CUI, console, layout, レイアウト
Oracle Java のサポート有償化に伴い、会社で DavMail を使い続けるには OpenJDK に移行するしかない。
もう待ったなし! ということで。試行錯誤した結果のメモです。
これで Mew が延命できる。
ここから最新版をダウンロードしてインストール。2019/12/19 時点の最新バージョンは 5.4.0-3135。
http://davmail.sourceforge.net/
勇気がいりますが、断行。
ここから最新版をダウンロードしてインストール。2019/12/19 時点の最新バージョンは JDK 13.0.1
https://openjdk.java.net/
下記に展開しました。
C:\Program Files\Java\jdk-13.0.1
下記を設定 (読み替えてください)。
JAVA_HOME=C:\Program Files\Java\jdk-13.0.1 Path=%JAVA_HOME%\bin (追加)
下記を記述。これがわからなくってハマった。
これをやらないと、"A suitable version of Java could not be found on your system, please install Java (64-bit) from http://java.com/en/download/manual.jsp" エラーが出る。
vm.location=%JAVA_HOME%\bin\server\jvm.dll
コマンドプロンプトで、下記を実行。
cd "%JAVA_HOME%\bin" keytool -import -alias "[CA 名]" -keystore "%JAVA_HOME%\lib\security\cacerts" -trustcacerts -file [PKI_FILE_NAME].cer -storepass changeit
■参考
https://sourceforge.net/p/davmail/discussion/644057/thread/e07e7d1836/
● DavMail, OpenJDK, Oracle, Java, 移行, 起動しない, エラー, 有償, 無償, フリー, free