Gói NFS server đã có sẵn trong Centos:
You also need to have the RPC rpcbind package installed :
1 |
#yum install rpcbind |
All NFS server exports need to be defined in /etc/exports file.
1 2 |
/home *(rw,sync) # exportfs -a |
allow NFS mounts of the /home directory with read/write access from any host/ip
có thể export thông qua webmin : Networking > NFS exports
Make sure the required nfs, nfslock, and rpcbind daemons are both running:
1 2 3 4 5 6 7 |
# chkconfig nfslock on # chkconfig nfs on # chkconfig rpcbind on # service rpcbind start # service nfslock start # service nfs start |
Check all services running correctly
1 |
#rpcinfo -p |
Setting firewall cho các service;
Kiểm tra kết quả :
Trước khi sử dung mount , client cần thiết lập các số gói sau:
# service rpcbind start
# service netfs start
# service nfslock start
1 2 3 4 |
<em># mount -o nfsvers=4 10.1.1.200:/home/nfs /home/nfs_local</em> mount: mount to NFS server failed: timed out (retrying). => do version không tương thích (có thể là version ở server và client khác nhau) => cần có thêm tham số version <em>nfsvers=4 </em> hoặc sử dụng nfs-utils: Nghĩa là client phải cai dặt gói này. <em># mount.nfs 10.1.1.200:/home/nfs /home/nfs_local</em> |
Accessing NFS Server Directories from the Client
1 2 3 4 |
edit file <tt>/etc/fstab</tt> nfs-server:/export/home /export/home nfs rw,soft,bg,nolock 0 0 Auto mount (If using the Linux GUI desktop and mounting Linux home directories to an NFS server you may have to mount with the option "<tt>nolock</tt>") : nếu gặp lỗi mount.nfs: mount to NFS server '192.168.100.108:/export/home/' failed: timed out, giving up thì cần phải check lại firewall, port kết nối tới NFS server : cụ thể cần mở cổng cho các gói dịch vụ sau: portmapper (111), nfs (2049) và mountd (764) |
Chú ý: các bước thực hiện trên được thực hiện trên Centos (Server). Các bước này có thể thực hiện trên các Distro khác với 1 số thay đổi nhỏ.