16:NFSを設定する。

Date 2012-9-6 13:36:16 | Topic: CentOS 6.3(6.4)に挑戦

nfs-utilsは最初からインストールされていたので、/etc/idmapd.conf を設定する。
Domain = kinryokai.net ←コメントを外し、自分のドメインにする。

/etc/exports は
/Download/NfsDir 192.168.xxx.0/24(rw,no_root_squash,no_all_squash) 

この意味は、このサブホストの /Download/NfsDir を他のホストから見えるように、アクセスできるホストは192.168.xxx. つまりlocal network からだけ、RWモードで、rootを許可し、そのままの権限でアクセスさせる。
# service rpcbind start
rpcbind を起動中: [ OK ]
# service nfslock start
NFS statd を起動中: [ OK ]
# service nfs start
NFS サービスを起動中: [ OK ]
NFS クォータを起動中: [ OK ]
NFS mountd を起動中: [ OK ]
NFS デーモンを起動中: [ OK ]

とそれぞれのサービスをスタートさせる。
上記はCentos6の時、Centos5は service rpcbind start がservice portmap start になる。
私は今だけ使うので、再起動後に有効にする必要は無いので chkconfig には設定を加えなかった。
ここからはNFSクライアント側の設定
nfs-utils はインストール済みだったので、/etc/idmapd.conf を設定する。
Domain = kinryokai.net ←コメントを外し、自分のドメインにする。

クライアント側で必要なサービスを走らせる。
下記はCentos5の時、Centos6では portmap の代わりに rpcbind と rpcidmapd をstartする。
# service portmap start
portmap を起動中: [ OK ]
# service nfslock start
NFS statd を起動中: [ OK ]
# service netfs start
その他のファイルシステムをマウント中: [ OK ]
# mount -t nfs -o rw web.kinryokai.net:/Download/NfsDir /test1
mount: mount to NFS server 'web.kinryokai.net' failed: System Error: Connection refused.
とエラーが出た。そう言えば web.kinryokai.net を簡易DNSであるdnsmasqが走っているホストの /etc/hosts に設定をしていなかったので、設定後、dnsmasq を再起動するとマウント出来た。



This article comes from 錦稜会 KINRYOKAI
https://www.kinryokai.net

The URL for this story is:
https://www.kinryokai.net/article.php?storyid=150