LoginSignup
57
64

More than 3 years have passed since last update.

5分で終わらせるNFSファイル共有

Last updated at Posted at 2017-04-16

5分で終わらせるNFSファイル共有

環境
・Centos7

※serverのIPを192.168.0.1、clientのIPを192.168.0.2とします。

server側

yumでnfs-utilsをインストール

yum -y install nfs-utils

共有するディレクトリを作成しておきます。

mkdir /mnt/public

/etc/exportsを編集

/etc/exports
/mnt/public 192.168.0.2(rw,async,no_root_squash) #rw権限、rootでの接続を許可する場合の設定

ファイアウォールの設定も忘れてはいけません。

firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload

サービスを起動&自動起動の設定。

systemctl start rpcbind
systemctl enable rpcbind
systemctl start nfs-server
systemctl enable nfs-server

client側

yumでnfs-utilsをインストール

yum -y install nfs-utils

マウントするディレクトリを作成しておきます。

mkdir /mnt/hoge

/etc/fstabを編集して、起動時マウントの設定をします。

/etc/fstab
192.168.0.1:/mnt/public /mnt/hoge nfs defaults 0 0

マウントする。

mount -v 192.168.0.1:/mnt/public /mnt/hoge

以上です。お疲れ様でした。

とはいえ

確かに5分で設定を終わらせることは可能ですが、長期的利用するのであれば一つずつ設定を確認して行うほうが良いのには間違いありません。
この記事は設定をある程度理解した上でのチートシートとしての利用をおすすめします。

エラー

mount: wrong fs type, bad option, bad superblock on
nfs-utilsがインストールされていないかも。

mount: can't find /mnt/hoge in /etc/fstab
fstab書きましょう。

mount.nfs: mount: No route to host
firewallを確認してみてください。

57
64
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
57
64