Radxa ROCK 5A + UbuntuでNAS(NFSサーバ)を構築する
SD Cardから起動したら
sudo apt update && sudo apt upgrade -y
でパッケージ更新。更新中に
Configuration file '/etc/default/u-boot'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** u-boot (Y/I/N/O/D/Z) [default=N] ?
のように聞かれたら、そのままエンターキーを押す。
ホスト名を変更する。
echo '127.0.1.1 k8s-master' | sudo tee -a /etc/hosts
sudo hostnamectl set-hostname k8s-master
固定IP設定のためにipup/ipdownをnetplanで置き換える。
sudo apt install netplan.io -y
sudo apt purge ifupdown -y
IPを固定する。
# IP固定
sudo tee /etc/netplan/99-fixed-ip.yaml <<EOF
network:
ethernets:
eth0:
dhcp4: false
addresses: [192.168.11.100/22]
nameservers:
addresses: [1.1.1.1]
routes:
- to: default
via: 192.168.11.1
version: 2
EOF
外付けHDD/SSDをUSB接続して、lsblkでデバイスファイル名を確認。
必要なパッケージをインストールする。
sudo apt install -y nfs-kernel-server btrfs-progs
共有ディレクトリを作成する。
sudo mkdir /export/nfs/home-kubernetes -p
sudo chown nobody:nogroup /export/nfs/home-kubernetes
自動マウント設定を追加する。
echo -e '/dev/sda\t/export/nfs/home-kubernetes\tbtrfs\tdefaults,noatime\t0\t2' | sudo tee -a /etc/fstab
NFSエクスポートの設定(環境により値は異なる)
sudo tee -a /etc/exports <<EOF
/export/nfs/home-kubernetes 192.168.11.100(rw,sync,no_subtree_check,,no_root_squash)
/export/nfs/home-kubernetes 192.168.11.101(rw,sync,no_subtree_check,no_root_squash)
/export/nfs/home-kubernetes 192.168.11.102(rw,sync,no_subtree_check,no_root_squash)
/export/nfs/home-kubernetes 192.168.11.103(rw,sync,no_subtree_check,no_root_squash)
EOF
NFSサーバを再起動
注意:enableにはしないこと。エラーがあると起動しなくなるため。
sudo systemctl start nfs-server
sudo systemctl status nfs-server
お好みでLEDの消灯設定をする。