基本的にこちらのサイトの通りにすればよい.
Server 側設定 (xx.xx.xx.141)
パッケージインストール
% dnf install -y rpcbind nfs-utils
共有ディレクトリ作成
% mkdir /mnt/disk1
exports記述
% vi /etc/exports
/mnt/disk1 xxx.xxx.xxx.0/24 (rw,no_root_squash,async)
サービス起動
% systemctl enable rpcbind
% systemctl restart rpcbind
% systemctl status rpcbind
→ Activeになっていることを確認
% systemctl enable nfs-server
% systemctl restart nfs-server
% systemctl status nfs-server
→ Activeになっていることを確認
Cliant 側設定 (xx.xx.xx.142)
パッケージインストール
% dnf install -y nfs-utils
マウント先作成
% mkdir /nfs/disk1
ここでマウントしてみるもうまく行かない
% mount -v -t nfs xx.xx.xx.141:/mnt/disk1 /nfs/disk1
mount.nfs: timeout set for Tue Oct 14 22:37:52 2025 mount.nfs: trying text-based options 'vers=4.2,addr=xx.xx.xx.141,clientaddr=xx.xx.xx.142' mount.nfs: mount(2): No route to host
mount.nfs: timeout set for Tue Oct 14 22:37:52 2025 mount.nfs: trying text-based options 'vers=4.2,addr=xx.xx.xx.141,clientaddr=xx.xx.xx.142' mount.nfs: mount(2): No route to host
^C
firewall で nfs サービスの有効が必要でした.
% firewall-cmd --add-service=nfs
success
% mount -v -t nfs xx.xx.xx.141:/mnt/disk1 /nfs/disk1
% ls /nfs/disk1
cad home
無事開通!
/etc/fstabに記述する
% vim /etc/fstab
xx.xx.xx.141:/mnt/disk1 /nfs/disk1 nfs defaults 0 0
ちなみに Ubuntu で nfs を入れるには,ufs-common を使うようです.
% apt install nfs-common