Fedora remix のインストール
ダウンロード先
https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases
Fedora-Remix-for-WSL-~~~x64_arm64.msixbundle ってのをダウンロードしたら、ダブルクリックでインストール。
最新に更新する
一般ユーザでログインして、su してアップデート
$ sudo su -
# dnf update
# wslfetch
WSL1 のような表示が?PowerShell で見てみると WSL2。良かった良かった。
PS C:\Users\abc123> wsl -l -v
NAME STATE VERSION
* fedoraremix Running 2
PS C:\Users\abc123>
systemd の起動設定
systemd が使えないと面倒なので、systemd の起動設定
Fedora の中で、vi /etc/wsl.conf して下記を追加。起動の度に IP アドレスが変わるので、ホスト名を設定しておくと便利(かも?)
[boot]
systemd = true
[network]
hostname = COLON
忘れていたので、ここで WSL2 の更新
Fedora (WSL) から一度抜けて WSL を再起動しましょう。
ついでに WSL のアップデートも確認してみましょう。
PS C:\Users\abc123> wsl -l --running
Linux 用 Windows サブシステム ディストリビューション:
fedoraremix (既定)
# シャットダウンします
PS C:\Users\abc123> wsl --shutdown
# 落ちたことを確認
PS C:\Users\abc123> wsl -l --running
実行中のディストリビューションはありません。
# 最新バージョンを確認
PS C:\Users\abc123> wsl --update --web-download
更新プログラムを確認しています。
Linux 用 Windows サブシステムの最新バージョンは既にインストールされています。
起動は、Windows Terminal などから Fedora を開いてください。
システムの日本語設定
# 現在のシステムのロケールを確認
[root@COLON ~]# localectl
System Locale: LANG=C.UTF-8
VC Keymap: (unset)
X11 Layout: (unset)
# 日本語パッケージ (ロケール) をインストール
[root@COLON ~]# dnf -y install langpacks-ja
# インストールされているロケールを確認
[root@COLON ~]# localectl list-locales
C.UTF-8
en_AU.UTF-8
en_BW.UTF-8
en_CA.UTF-8
en_DK.UTF-8
en_GB.UTF-8
en_HK.UTF-8
en_IE.UTF-8
en_NZ.UTF-8
en_PH.UTF-8
en_SC.UTF-8
en_SG.UTF-8
en_US.UTF-8
en_ZA.UTF-8
en_ZW.UTF-8
ja_JP.UTF-8
# ロケールを変更する
[root@COLON ~]# localectl set-locale LANG=ja_JP.UTF-8
# 変更されたロケールを表示
[root@COLON ~]# localectl
System Locale: LANG=ja_JP.UTF-8
VC Keymap: (unset)
X11 Layout: (unset)
# 注!シェルのロケールは変わってない
[root@COLON ~]# locale
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
# shell のロケールを変更する (bash)
[root@COLON ~]# export LANG=ja_JP.utf8
[root@COLON ~]$ locale
LANG=ja_JP.utf8
LC_CTYPE="ja_JP.utf8"
LC_NUMERIC="ja_JP.utf8"
LC_TIME="ja_JP.utf8"
LC_COLLATE="ja_JP.utf8"
LC_MONETARY="ja_JP.utf8"
LC_MESSAGES="ja_JP.utf8"
LC_PAPER="ja_JP.utf8"
LC_NAME="ja_JP.utf8"
LC_ADDRESS="ja_JP.utf8"
LC_TELEPHONE="ja_JP.utf8"
LC_MEASUREMENT="ja_JP.utf8"
LC_IDENTIFICATION="ja_JP.utf8"
LC_ALL=
# 日本語マニュアルのインストール
[root@COLON ~]# dnf install man-pages-ja
whitewaterfoundry_fedoraremix 2.1 kB/s | 1.8 kB 00:00
whitewaterfoundry_fedoraremix-source 1.8 kB/s | 1.8 kB 00:01
依存関係が解決しました。
==================================================================================================================================== パッケージ アーキテクチャー バージョン リポジトリー サイズ====================================================================================================================================インストール:
man-pages-ja noarch 20220415-3.fc38 fedora 6.0 M
トランザクションの概要
====================================================================================================================================インストール 1 パッケージ
ダウンロードサイズの合計: 6.0 M
インストール後のサイズ: 5.5 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
man-pages-ja-20220415-3.fc38.noarch.rpm 14 MB/s | 6.0 MB 00:00
------------------------------------------------------------------------------------------------------------------------------------合計 5.1 MB/s | 6.0 MB 00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
準備 : 1/1
インストール中 : man-pages-ja-20220415-3.fc38.noarch 1/1
scriptletの実行中: man-pages-ja-20220415-3.fc38.noarch 1/1
検証 : man-pages-ja-20220415-3.fc38.noarch 1/1
インストール済み:
man-pages-ja-20220415-3.fc38.noarch
完了しました!
[root@COLON ~]#
必要なパッケージをインストール
dnf -y install git locate tcsh vim screen
dnf -y remove nano
dnf -y install gcc-c++ gcc-gfortran
dnf -y install net-tools traceroute telnet bind9-next-utils sharutils
gcc-c++ --- GNU C, C++ コンパイラ
gcc-gfortran --- GNU Fortran コンパイラ
net-tools --- arp, ifconfig, netstat, route など
traceroute --- traceroute
telnet --- telnet
bind9-next-utils --- dig, nslookupなど
sharutils --- uuencode, shar など
repoquery --list <パッケージ名> | grep bin/
などで、パッケージでインストールされたファイルが表示できます。
vim のカラースキームを追加
設定した vimrc に必要な vim の colors をダウンロード
バージョンによってフォルダ名が変わるので注意。個人のディレクトリに入れるなら ~/.vim/colors
以下にダウンロードする。
VIM_COLORS=/usr/share/vim/vim91/colors
wget -P $VIM_COLORS -N https://raw.githubusercontent.com/michalbachowski/vim-wombat256mod/master/colors/wombat256mod.vim
wget -P $VIM_COLORS -N https://raw.githubusercontent.com/romainl/Apprentice/master/colors/apprentice.vim
wget -P $VIM_COLORS -N https://raw.githubusercontent.com/karoliskoncevicius/moonshine-vim/master/colors/moonshine.vim
wget -P $VIM_COLORS -N https://raw.githubusercontent.com/Haron-Prime/Antares/master/colors/antares.vim
普段利用しているドットファイルをインストール
ログインシェルを tcsh へ変更、ドットファイルをインストール
chsh -s /usr/bin/tcsh
chsh -s /usr/bin/tcsh <ユーザ名>
git clone https://github.com/jp-yen/dotfiles.git
install dotfiles/csh.cshrc /etc/csh.cshrc
install dotfiles/screenrc /etc/screenrc
install dotfiles/vimrc /etc/vimrc
sar コマンドのインストール
dnf -y install cronie sysstat
cronie --- conn
sysstat --- sar
有効化されていることを確認
[root@fedoraremix ~]# systemctl status crond
○ crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: enabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
[root@fedoraremix ~]# systemctl status sysstat
○ sysstat.service - Resets System Activity Logs
Loaded: loaded (/usr/lib/systemd/system/sysstat.service; enabled; preset: enabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
ログ採取の設定
10分間隔でログを取得 (*/10 でも良いが、分の末尾が 0 の方が気持ち良い)
23:53 にローテーション (0:00 でも良いが、タイミングがちょっと嫌)
0,10,20,30,40,50 * * * * /usr/lib64/sa/sa1 1 1
53 23 * * * /usr/lib64/sa/sa1 --rotate
ksar : a sar grapher でグラフィカルな表示が可能。
コマンド例
sar -B page in/out
sar -u CPUの負荷
sar -P CPUの負荷
sar -r メモリ
sar -q ALL メモリ
sar -S swap
sar -W swap
sar -d disk
sar -F ディスク使用率
sar -n EDEV --iface-eth0 ネットワークの情報
sar -n DEV --iface-eth0 ネットワークの情報
avahi-daemon で名前解決をできるようにする。
Rendezvous とか Bonjour, Zeroconf, mDNS とか色々言われてます。
ホスト名.local で名前が引けるようになります。 (mDNS 以外で .local ドメインを使っていないこと)
- avahi-tools をインストール
- systemd-resolved が邪魔なので止める。
- /etc/nsswitch.conf の書き換え
- avahi-daemon を起動
- 接続確認
dnf install -y avahi-tools
systemctl disable systemd-resolved
systemctl stop systemd-resolved
vi /etc/nsswitch.conf
systemctl restart avahi-daemon
ping `uname -n`.local -c 2
resolve
や dns
の前に mdns4_minimal [NOTFOUND=return]
を追加する
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
辺りを参照
[root@fedoraremix ~]# dnf install -y avahi-tools
メタデータの期限切れの最終確認: 0:00:11 時間前の 2023年10月28日 18時16分38秒 に実施しました。
依存関係が解決しました。
========================================================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
========================================================================================================================
インストール:
avahi-tools x86_64 0.8-22.fc38 updates 39 k
依存関係のインストール:
avahi x86_64 0.8-22.fc38 updates 300 k
avahi-libs x86_64 0.8-22.fc38 updates 66 k
libdaemon x86_64 0.14-25.fc38 fedora 31 k
トランザクションの概要
========================================================================================================================
インストール 4 パッケージ
ダウンロードサイズの合計: 436 k
インストール後のサイズ: 1.5 M
パッケージのダウンロード:
(1/4): avahi-tools-0.8-22.fc38.x86_64.rpm 182 kB/s | 39 kB 00:00
(2/4): avahi-libs-0.8-22.fc38.x86_64.rpm 297 kB/s | 66 kB 00:00
(3/4): libdaemon-0.14-25.fc38.x86_64.rpm 105 kB/s | 31 kB 00:00
(4/4): avahi-0.8-22.fc38.x86_64.rpm 949 kB/s | 300 kB 00:00
------------------------------------------------------------------------------------------------------------------------
合計 230 kB/s | 436 kB 00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
準備 : 1/1
インストール中 : avahi-libs-0.8-22.fc38.x86_64 1/4
インストール中 : libdaemon-0.14-25.fc38.x86_64 2/4
scriptletの実行中: avahi-0.8-22.fc38.x86_64 3/4
インストール中 : avahi-0.8-22.fc38.x86_64 3/4
scriptletの実行中: avahi-0.8-22.fc38.x86_64 3/4
Created symlink /etc/systemd/system/sockets.target.wants/avahi-daemon.socket → /usr/lib/systemd/system/avahi-daemon.socket.
Created symlink /etc/systemd/system/dbus-org.freedesktop.Avahi.service → /usr/lib/systemd/system/avahi-daemon.service.
Created symlink /etc/systemd/system/multi-user.target.wants/avahi-daemon.service → /usr/lib/systemd/system/avahi-daemon.service.
インストール中 : avahi-tools-0.8-22.fc38.x86_64 4/4
scriptletの実行中: avahi-tools-0.8-22.fc38.x86_64 4/4
/usr/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 はシンボリックリンクではありません
検証 : libdaemon-0.14-25.fc38.x86_64 1/4
検証 : avahi-0.8-22.fc38.x86_64 2/4
検証 : avahi-libs-0.8-22.fc38.x86_64 3/4
検証 : avahi-tools-0.8-22.fc38.x86_64 4/4
インストール済み:
avahi-0.8-22.fc38.x86_64 avahi-libs-0.8-22.fc38.x86_64 avahi-tools-0.8-22.fc38.x86_64 libdaemon-0.14-25.fc38.x86_64
完了しました!
[root@fedoraremix ~]# systemctl disable systemd-resolved
Removed "/etc/systemd/system/dbus-org.freedesktop.resolve1.service".
Removed "/etc/systemd/system/sysinit.target.wants/systemd-resolved.service".
[root@fedoraremix ~]# systemctl stop systemd-resolved
[root@fedoraremix ~]#
hosts: files myhostname resolve [!UNAVAIL=return] dns
という行を
hosts: files myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
と書き換える
IPv6 を使わない場合は
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
とすると少し早くなるかも知れません。
avahi を再起動して接続性を確認します。
[root@fedoraremix ~]# systemctl restart avahi-daemon
[root@fedoraremix ~]# ping `uname -n`.local -c 2
PING fedoraremix.local (172.30.71.47) 56(84) バイトのデータ
64 バイト応答 送信元 fedoraremix (172.30.71.47): icmp_seq=1 ttl=64 時間=0.016ミリ秒
64 バイト応答 送信元 fedoraremix (172.30.71.47): icmp_seq=2 ttl=64 時間=0.030ミリ秒
--- fedoraremix.local ping 統計 ---
送信パケット数 2, 受信パケット数 2, 0% packet loss, time 1055ms
rtt min/avg/max/mdev = 0.016/0.023/0.030/0.007 ms
[root@fedoraremix ~]#
archlinux のドキュメント などを参考に。
netstat コマンドを使わずに開いているポートを確認する
ここでは netstat を入れましたが、入れずに確認する方法があります。
[root@fedoraremix ~]# ss -atn
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 127.0.0.54:53 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 4096 [::]:5355 [::]:*
[root@fedoraremix ~]# ss -anu 2023-10-28 17:34:04
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 127.0.0.54:53 0.0.0.0:*
UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
UNCONN 0 0 127.0.0.1:323 0.0.0.0:*
UNCONN 0 0 0.0.0.0:5355 0.0.0.0:*
UNCONN 0 0 [::1]:323 [::]:*
UNCONN 0 0 [::]:5355 [::]:*
[root@fedoraremix ~]# ss -atnu 2023-10-28 17:34:42
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.54:53 0.0.0.0:*
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:5355 0.0.0.0:*
udp UNCONN 0 0 [::1]:323 [::]:*
udp UNCONN 0 0 [::]:5355 [::]:*
tcp LISTEN 0 4096 127.0.0.54:53 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 4096 [::]:5355 [::]:*
開いているポートと、そのプロセスも併せて確認する場合
[root@fedoraremix ~]# ss -nltup
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:51530 0.0.0.0:* users:(("avahi-daemon",pid=1107,fd=14))
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:* users:(("avahi-daemon",pid=1107,fd=12))
udp UNCONN 0 0 [::]:49423 [::]:* users:(("avahi-daemon",pid=1107,fd=15))
udp UNCONN 0 0 [::1]:323 [::]:*
udp UNCONN 0 0 [::]:5353 [::]:* users:(("avahi-daemon",pid=1107,fd=13))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=110,fd=3))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=110,fd=4))
目的のコマンドが存在しない場合
例えば、nslookup コマンドがどのパッケージに入っているのか知りたい場合
[root@fedoraremix ~]# dnf provides nslookup
メタデータの期限切れの最終確認: 0:03:14 時間前の 2023年11月03日 08時22分36秒 に実施しました。
bind-utils-32:9.18.13-1.fc38.x86_64 : Utilities for querying DNS name servers
Repo : fedora
一致:
ファイル名 : /usr/bin/nslookup
bind-utils-32:9.18.19-1.fc38.x86_64 : Utilities for querying DNS name servers
Repo : updates
一致:
ファイル名 : /usr/bin/nslookup
bind9-next-utils-32:9.19.11-1.fc38.x86_64 : Utilities for querying DNS name servers
Repo : fedora
一致:
ファイル名 : /usr/bin/nslookup
bind9-next-utils-32:9.19.17-1.fc38.x86_64 : Utilities for querying DNS name servers
Repo : updates
一致:
ファイル名 : /usr/bin/nslookup
[root@fedoraremix ~]#
ちなみにバージョンアップデート方法は
新しいバージョンが出る度に Fedora remix の blog に手順が UP されます。
https://www.whitewaterfoundry.com/blog/tag/fedoraremix