NFS Server&Client設定方法「Ubuntu 11」

<概要>
NFSは、「Network File System」の略語です。NFSは、sambaと異なり、NFS経由でリモートファイルがローカルHDDと同じような感覚でファイルの読み・書きが可能です。

<構築例>
Server: Ubuntu 11.10 (192.168.0.100)
Client: Ubuntu 11.04 (192.168.0.110)

<目次>
1.ServerへNFSインストール
2.ClientへNFSインストール
3.サーバ上のNFS Directories作成&エクスポート
4.Clientでのマウント用ディレクトリ作成
5.Clientでのディレクトリマウント
6.マウント内容の確認
7.Clientでのテストファイル作成
8.Clientで作成したファイルをServerで確認
9.Client起動時、自動マウント設定
10.Client再起動&#dfコマンドチェック

<手順>
1.ServerへNFSインストール:
# aptitude install nfs-kernel-server nfs-common portmap

2.ClientへNFSインストール:
# aptitude install nfs-common portmap

3.サーバ上のNFS Directories作成&エクスポート
# mkdir /var/nfs
# chown nobody:nogroup /var/nfs

# vi /etc/exports
/home 192.168.0.100/24(rw,sync,no_root_squash,no_subtree_check)
/var/nfs 192.168.0.100/24(rw,sync,no_subtree_check)
(「no_root_squash」オプション指定は、 「/home」をルートフォルダとする)

[/etc/exports]設定反映
# exportfs -ra

4.Clientでのマウント用ディレクトリ作成
# mkdir -p /mnt/nfs/home
# mkdir -p /mnt/nfs/var/nfs

5.Clientでのディレクトリマウント:
# mount 192.168.0.100:/home /mnt/nfs/home
# mount 192.168.0.100:/var/nfs /mnt/nfs/var/nfs

6.マウント内容の確認:
# df -h
# mount

7.Clientでのテストファイル作成
# touch /mnt/nfs/home/test.txt
# touch /mnt/nfs/var/nfs/test.txt

8.Clientで作成したファイルをServerで確認
# ls -l /home/ <– owner is root # ls -l /var/nfs <– owner is nobody 9.Client起動時、自動マウント設定 # vi /etc/fstab 192.168.0.100:/home /mnt/nfs/home nfs rw,sync,hard,intr 0 0 192.168.0.100:/var/nfs /mnt/nfs/var/nfs nfs rw,sync,hard,intr 0 0 10.Client再起動&#dfコマンドチェック <クライアント・サーバポート表チェック> [NFS Server trouble – mount.nfs access denied] Client# rpcinfo -p localhost program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 58056 status 100024 1 tcp 59253 status Server# rpcinfo -p localhost program vers proto port 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100024 1 udp 48360 status 100024 1 tcp 47104 status 100003 2 tcp 2049 nfs 100003 2 udp 2049 nfs 100021 4 udp 57876 nlockmgr 100021 1 tcp 46706 nlockmgr 100005 1 udp 55458 mountd 100005 1 tcp 53817 mountd

Share Button

コメントを残す


5 + = 14

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>