Set up an NFS Network File System server in CentOST6.6
- NFS Introduction
Network File System (NFS) allows computers on the Network to share resources over TCP/IP networks. In NFS applications, local NFS client applications can transparently read and write files on the remote NFS server, just like accessing local files.
NFS can save local storage space and share some storage devices such as soft drives, CDROM, and Zip. The difference between NFS and Samba is that Samba is generally cross-platform, NFS is easy to use between unix-like systems,
- NFS installation and configuration
Major software packages:
NFS depends on the rpc-bind package. The main installation packages are nfs-utils and rpcbind;
System Service script
/Etc/init. d. nfs
/Etc/init. d/rpcbind
Main configuration file
/Etc/exports
This configuration file determines the NFS shared directory, IP address or network segment, domain, read/write permission, and whether to retain the root permission from the client. For file configuration, see man 5 exports
EXAMPLE
# Sample/etc/exports file
/Master (rw) trusty (rw, no_root_squash)
/Projects proj *. local. domain (rw)
/Usr *. local. domain (ro) @ trusted (rw)
/Home/joe pc001 (rw, all_squash, anonuid = 150, anongid = 100)
/Pub * (ro, insecure, all_squash)
/Srv/www-sync, rw server @ trusted @ external (ro)
/Foo 2001: db8: 9: e54:/64 (rw) 192.0.2.0/24 (rw)
/Build buildhost [0-9]. local. domain (rw)
/Etc/default/portmap
This configuration file is responsible for the rpc port mapped to NFS;
/Etc/hosts. deny
This configuration file determines which IP Lists cannot be accessed;
/Etc/hosts. allow
This configuration file determines which IP lists can be accessed;
Main commands
Showmount e server address
- Software installation and configuration
Software Installation
[Root @ woonx64 ~] # Rpm-qa nfs-utils rpcbind
Rpcbind-0.2.0-11.el6.x86_64
Nfs-utils-1.2.3-54.el6.x86_64
If Not Installed
Yum y install nfs-utils rpcbind
Configure sharing
[Root @ woonx64 Study] # vim/etc/exports
/Study 192.168.239.128 (rw, no_root_squash)
#/Usr/src woon (rw, no_root_squash)
Restart service
View shared information
[Root @ woonx64 Study] # showmount-e 192.168.239.129
Export list for 192.168.239.129:
/Study 192.168.239.128
[Root @ woonx64 Study] #
Mount the nfs shared directory
[Root @ woon ~] # Cd/
[Root @ woon/] # mkdir/nfs
At this time, it cannot be mounted because my/Study is an ntfs partition mounted on the server through the samba service, which may not be supported. Replace it with/root to restart the service and mount it.
[Root @ woon/] #! Show
Showmount-e 192.168.239.129
Export list for 192.168.239.129:
/Root 192.168.239.128
[Root @ woon/] # mount-t nfs 192.168.239.129:/root/nfs/
[Root @ woon/] # cd nfs/
[Root @ woon nfs] # ls
Anaconda-ks.cfg install. log install. log. syslog public template video image
File Download music Desktop