LoginSignup
0
0

More than 3 years have passed since last update.

Linux/debian系NFS共有サーバー設定

Last updated at Posted at 2019-02-14

RaspberryPi Model B+(raspbian release 9.6 stretch)
Ubuntu 16.04 LTS
Debian GNU/Linux 9 (stretch)
で、確認しました。

まずは
nfs-server側に
$ sudo apt-get install nfs-kernel-server
でinstall

実行は
$ sudo systemctl nfs-kernel-server start
$ sudo /etc/init.d/nfs-kernel-server start

等で起動時にnfs-kernel-serverが実行されるようになります。

[設定]nfs-server側
sudo mkdir /srv/NFS 共有先を作成する。
sudo cp -p /etc/exports /etc/exports.org Install時に出来たオリジナル(exports)を退避して
sudo vi /etc/exports 編集する

[exports編集箇所]
defaultではhostname1 hostname2を変更するくらいです。行頭の#を外す(コメントアウト)。
#/srv/home hostname1(rw,sync,no_subtree_check)

/srv/NFS 192.168.x.x/255.255.255.0(rw,sync,no_subtree_check)にする。

他のディレクトリも設定できます
/home/user 192.168.x.x/255.255.255.0(rw,sync,no_subtree_check)

[設定]nfs-client側
$ sudo apt-get install nfs-common
$ sudo /etc/init.d/nfs-common start

マウントするディレクトリの作成
$ sudo mkdir /mnt/NFS-client

[fstabの編集](必要であれば)
$ sudo cp -p /etc/fstab /etc/fstab.org オリジナルの退避
$ sudo vi /etc/fstab fstabの編集(デリケートなので注意してください)
[fstab]
NFS-server /mnt/NFS-client nfs rw,nosuid,_netdev,noauto,hard,intr 0 0
共有先 マウント場所 fstype option(手動でマウント) 起動時dumpの有無 起動時mountしない
ここで色々とoptionが設定できます。

[コマンド/nfs-client側]
$ sudo mount -t nfs (hostのIPaddress)192.168.x.x:/srv/NFS /mnt/NFS-client

で/mnt/NFS-clientにマウントされるので
$ cd /mnt/NFS-client
で、nfs-serverの共有ディレクトリに移動できます。

$ sudo umount /mnt/NFS-client
で、アンマウントします。

0
0
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
0
0