■■■■■ サーバー
■NFSサービスのインストール
■エクスポートポイントの作成
# mkdir /mnt/nfsserv/
■テストファイル作成
# vi /mnt/nfsserv/text.txt
■エクスポートポイント(NFS用の共有)設定
とりあえずテスト環境なので、誰でも触れるようにしてみる
# vi /etc/exports
/mnt/nfsserv/ *(rw,async,no_root_squash)
■以下のコマンドで反映される
/usr/sbin/exportfs -ra
■サービスを起動して有効化します。
# systemctl start rpcbind
# systemctl start nfs-server
■OS起動時に自動的に有効にするコマンド
# systemctl enable rpcbind
# systemctl enable nfs-server
■■■■■ クライアント
■NFSサービスのインストール
■マウントポイントを作成
# mkdir /mnt/nfsclient/
■サービスを起動して有効化します。
# systemctl start rpcbind
■NFSv3でマウント
オプションを付けないとNFSv4でマウントします。
# mount -t nfs -o vers=3 192.168.184.3:/mnt/nfsserv/ /mnt/nfsclient/
■■■■■ Macのクライアントから接続
■手動マウント
$ sudo mkdir -p /Volumes/NFS
echo testpassword | sudo -S mount_nfs -P 192.168.0.10:/var/www/vhost/sample.com/html /Data/Script/nfs
参考)