Ubuntu21.04にNFS サーバーをインストールする

1.nfsサーバーをインストール

root@ubuntu:~# apt -y install nfs-kernel-server
略
Creating config file /etc/exports with new version

Creating config file /etc/default/nfs-kernel-server with new version
man-db (2.9.4-2) のトリガを処理しています ...
libc-bin (2.33-0ubuntu5) のトリガを処理しています ..

2.nfsサーバーの設定
root@ubuntu:~# vim /etc/idmapd.conf
6行目
修正前
# Domain = localdomain
修正後
Domain = ドメイン名

3.マウント設定

root@ubuntu:~# vim /etc/exports
最終行に下記を追記
/home/data 10.0.0.0/24(rw,no_root_squash)

オプション
rw: 読み込みと書き込むを許可
ro:読み込みを許可
root_squash:root UID/GID を anonymous UID/GID にマッピングする
no_root_squash:root を anonymous UID/GID にマッピングしない

4.共有ディレクトリを作成
root@ubuntu:~# mkdir /home/data

5.nfsサーバーを再起動
root@ubuntu:~# systemctl restart nfs-server

Ubuntu 21.04

Posted by arkgame