NFS
NFS, network File system. A system shares directories and files with others on the network. By using NFS, users and programs can access local
file access to files on the system.
Span style= "margin:0px; padding:0px; max-width:100%; Color:rgb (0, 0, 0); font-size:14px; " >
advantages: Save disk space
Composition: one server and one or more clients
1. Install, open
[[email protected] ~]# Systemctl start NFS
[[email protected] ~]# Systemctl start NFS Open service
Add a Firewall Policy
List Firewall status
2. Shared directory
[Email protected] ~]# mkdir/public/nfs-p # #建立共享目录
[Email protected] ~]# mkdir/public/nfs/file # #建立共享文件
[Email protected] ~]# vim/etc/exports
[Email protected] ~]# EXPORTFS-RV
Exporting *:/public/nfs
Exports content
Test
Client
Mount
3.autofs (Auto Mount tool)
Automatically mounts successfully when there is a need for direct access to/net
Install, open (client)
[Email protected] ~]# yum install autofs.x86_64-y
[Email protected] ~]# systemctl start AutoFS
View the root directory of AutoFS
Auto-mount to/net
[Email protected] nfs]# vim/etc/auto.master
Permanent Mount
[Email protected] nfs]# Vim/etc/auto.nfs
[Email protected] nfs]# systemctl restart Autofs.service
4. Some configuration of the shared directory
To shared directory permissions
Server (117 host) Exports/public/nfs * (SYNC,RW) # #共享给所有人可读可写
[Email protected] ~]# Vim/etc/exports
[Email protected] ~]# EXPORTFS-RV # #将刚编辑内容刷新并加载
Exporting *:/public/nfs
Test (in Test host)
Server (117 host) Exports/public/nfs 172.25.254.0/24 (sync) # #共享给172.25.254.0/24 Network Segment Read-only
[Email protected] ~]# vim/etc/exports
[Email protected] ~]# EXPORTFS-RV
Exporting *:/public/nfs
Test (in Test host)
Server (117 host) Exports/public/nfs * (SYNC,NO_ROOT_SQUASH,RW) # #共享给所有人, when the customer segment uses root mount does not convert user identity
[Email protected] ~]# vim/etc/exports
[Email protected] ~]# EXPORTFS-RV
Exporting *:/public/nfs
Test (in Test host)
Server (117 host) Exports/public/nfs * (sync,rw,anonuid=1001,anongid=1001) # #共享给uid =1001,gid=1001 users can read and write
[Email protected] ~]# vim/etc/exports
[Email protected] ~]# EXPORTFS-RV
Exporting *:/public/nfs
Test (in Test host)
Linux--nfs Network file sharing