NFSサーバー構築2009/04/05 |
NFSサーバーを構築し、任意のディレクトリを各サーバーで共有できるようにします。 |
|
[1] | NFSサーバーとなるシステム上での設定 |
dlp:~# aptitude -y install nfs-kernel-server dlp:~# vi /etc/exports # 記述 *注 /home 192.168.0.0/24(rw,sync,no_root_squash) #*注 /home → 共有するディレクトリを指定 192.168.0.0/24 → アクセスを受け付けるネットワークの範囲 rw → 読み書き可 sync → 同期する no_root_squash → root特権有効 dlp:~# /etc/init.d/portmap start Starting portmap daemon.... dlp:~# /etc/init.d/nfs-common start Starting NFS common utilities: statd idmapd. dlp:~# /etc/init.d/nfs-kernel-server restart Stopping NFS servers: mountd nfsd. Starting NFS servers: nfsd mountd. dlp:~# update-rc.d portmap defaults Adding system startup for /etc/init.d/portmap ... /etc/rc0.d/K20portmap -> ../init.d/portmap /etc/rc1.d/K20portmap -> ../init.d/portmap /etc/rc6.d/K20portmap -> ../init.d/portmap /etc/rc2.d/S20portmap -> ../init.d/portmap /etc/rc3.d/S20portmap -> ../init.d/portmap /etc/rc4.d/S20portmap -> ../init.d/portmap /etc/rc5.d/S20portmap -> ../init.d/portmap dlp:~# update-rc.d nfs-common defaults Adding system startup for /etc/init.d/nfs-common ... /etc/rc0.d/K20nfs-common -> ../init.d/nfs-common /etc/rc1.d/K20nfs-common -> ../init.d/nfs-common /etc/rc6.d/K20nfs-common -> ../init.d/nfs-common /etc/rc2.d/S20nfs-common -> ../init.d/nfs-common /etc/rc3.d/S20nfs-common -> ../init.d/nfs-common /etc/rc4.d/S20nfs-common -> ../init.d/nfs-common /etc/rc5.d/S20nfs-common -> ../init.d/nfs-common # nfs自動起動一旦削除 dlp:~# update-rc.d -f nfs-kernel-server remove Removing any system startup links for /etc/init.d/nfs-kernel-server ... /etc/rc0.d/K80nfs-kernel-server /etc/rc1.d/K80nfs-kernel-server /etc/rc2.d/S20nfs-kernel-server /etc/rc3.d/S20nfs-kernel-server /etc/rc4.d/S20nfs-kernel-server /etc/rc5.d/S20nfs-kernel-server /etc/rc6.d/K80nfs-kernel-server # 起動順序最遅で再登録 dlp:~# update-rc.d nfs-kernel-server defaults 99 Adding system startup for /etc/init.d/nfs-kernel-server ... /etc/rc0.d/K10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc1.d/K10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc6.d/K10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc2.d/S10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc3.d/S10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc4.d/S10nfs-kernel-server -> ../init.d/nfs-kernel-server /etc/rc5.d/S10nfs-kernel-server -> ../init.d/nfs-kernel-server |
[2] | NFSクライアント上での設定 |
www:~# /etc/init.d/portmap start Starting portmap daemon.... www:~# mount -t nfs dlp.srv.world:/home /home [ 94.278216] RPC: Registered udp transport module. [ 94.278225] RPC: Registered tcp transport module. www:~# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/hda1 5040 382 4403 8% / tmpfs 257 0 257 0% /lib/init/rw udev 10 1 10 0% /dev tmpfs 257 0 257 0% /dev/shm /dev/hda5 1008 34 924 4% /tmp /dev/hda3 5040 1062 3723 23% /usr /dev/hda4 10080 205 9364 3% /var dlp.srv.world:/home 100794 188 95486 1% /home # ↑ NFSサーバーのホームディレクトリがマウントされている www:~# vi /etc/fstab # 最終行に追記:マウントするホームディレクトリをNFSサーバーのものに変更 proc /proc proc defaults 0 0 /dev/hda1 / ext3 defaults,errors=remount-ro 0 1 /dev/hda5 /tmp ext3 defaults 0 2 /dev/hda3 /usr ext3 defaults 0 2 /dev/hda4 /var ext3 defaults 0 2 /dev/hda2 none swap sw 0 0 /dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0 dlp.srv.world:/home /home nfs defaults
0 2 |
|