I. install and configure the NFS server
1>To enable the NFS server to provide services, you must startInet, Portmap, NFS, and mountThese four daemon processes are maintained in the background.
2>Plan the partitions or directories to be shared
3>Define client Parameters
4>Configure the NFS master configuration file:/etc/exports
5> Restart the NFS service 1,Configure the syntax of the/etc/exports file # Vi/etc/exports /Export Dir-maproot = daemon host2 /Nvidir2-ro-network 192.168.1.0 Or use the following format /Optional dir host3 (option) /Optional dir 192.168.1.12/24 (option) The first section is the shared directory, which must be an absolute path. Section 2: some parameters, such as-maproot = daemon, indicate that if the visitor is a root user, the access is converted to a daemon user;-Ro: indicates the read-only permission. Section 3: indicates the client that can be accessed. It can be a host such as host2 or a network segment. The host can be represented by a domain name or an IP address. The domain name supports wildcards, it does not include vertices. For example, * .example.net can be e1.example.net or e2.example.net, but it cannot be s1.e1.example.net. The third format indicates that parameters such as read/write and read-only can be written in brackets and separated by commas. 2,Activate service Portmap and NFS After Portmap is activated, the SunRPC service with the Port Number 111 is displayed. # Service Portmap restart # Service NFS restart 3,Client Configuration 3.1Enable the Portmap service 3.2 Use the mount command to mount the shared directory # Mount-T type-O option device dir # Mount-T nfs-O hard 192.168.1.22:/folder DIR/tmp # Remote On host 192.168.1.22 Of /Export dir Directory mounted to local /Tmp Directory
3.3 In addition to mounting by using the mount command, you can also use/etc/fstab mounting or autofs mounting.. Ii. NFS server configuration instance
NFS server configuration:
1,Check whether the following software packages are installed on the server. # Rpm-Qa | grep NFS Nfs-utils-1.0.9-16.e15 Nfs-utils-lib-1.0.8-7.2
2,Configure the NFS server configuration file: /Etc/exports/Sharedir: the shared directory. The permission is restricted by RW and local permissions. 192.168.1.22/24: Allow access from all machines in the 192.168.1.0 network segment
# Vim/etc/exports # Cat/etc/exports/export dir 192.168.1.22/24 (RW)
3,Restart the NFS service # Service NFS restart NFS client Configuration: 1,Confirm to install the Portmap package # Rpm-Qa | grep Portmap Portmap-4.0-65.2.2.1 2,Enable the Portmap service # Service Portmap restart 3,View the shared directory of an NFS server 192.168.1.22: IP address of the NFS server # Showmount-e 192.168.1.22 Export list for 192.168.1.22: /Optional dir 192.168.1.22/24 4,Shared directory for mounting servers -T nfs: The file system format of the mounted file, which can be omitted. # Mount-t nfs 192.168.1.22:/1_dir/mnt
At this point, a simple NFSSet up the server.
NFSThe server is LinuxThe simplest server configuration. Let's start from the simplest !!!