Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos7 configures nfs shared storage service

Shulou Source: shulou.com Published: 2022-06-02 07:07:38 10月03日 Update

Nfs is a network file system, which needs to rely on rpc for process scheduling.

Note that nfs only verifies id, verifies the user name, and can only provide file sharing services on class unix os. Because of its fragile authentication mechanism, it is not suitable to work on internet, so it is very feasible to use it in the intranet.

The nfs server needs to make sure that these two packages install nfs-utils rpcbind correctly.

For ubuntu servers, there are two packages for nfs-common,nfs-kernel-server, and rpcbind is installed by default.

Yum-y install nfs-utils rpcbind

Edit the shared directory configuration file / etc/exports

/ var/www/html 192.168.10.0 rw,async,no_root_squash 24 (ro) # multiple network segments or hosts are separated by spaces / var/www 192.168.10.0 amp 24 (ro,sync,root_squash)

Parameters: ro means read-only, rw means read-write, sync synchronous write * that is, write to memory and hard disk at the same time, async asynchronism * is temporarily stored in memory. No_root_squash means that if the user connected by the client is root, the directory on the server is also root permission. Please do not open it. It is dangerous. If the client is root, it is recommended to turn it on.

Http://cloud.yesky.com/info/332/1460300332.shtml

Http://www.pcpop.com/article/6054830.shtml

Start the nfs service and set it to boot

Service rpcbind start # or systemctl start rpcbindservice nfs start # or systemctl startnfs # ubuntu server is service startnfs-kernel-server startchkconfig rpcbind on # or systemctl enable rpcbindchkconfig nfs on # or systemctl enable nfs

Configure firewalls to release response ports or services

Firewall-cmd-permanent-add-service=nfsfirewall-cmd-permanent-add-service=rpc-bindfirewall-cmd-permanent-add-service=mountdfirewall-cmd-reloadfirewall-cmd-list-all # View resources in the firewalld direction

Client mount

Showmount-e nfs_server_ip: view the available mount points on the nfs server

Client mount operation

Mount-t nfs nfs_server:/var/www/html / bendikongmulu or mount-t nfs nfs_server:/var/www/html / bendikongmulu-o proto=tcp

If there is no error, it will succeed. Of course, the client can use df-h to check whether it has been mounted. Here, the client can switch to the local mount point to see the files on the server (note that if the directory shared by the server is empty, the client cannot view it).

Tags: Service client client file user directory end authentication configuration two memory server permissions feasible dangerous successful fragile host between parameters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL OPPO Reno Redmi NVidia