Ubuntu deploys NFS

NFS stands for Network File-System, which enables file sharing between different machines and different systems through the network. Through NFS, you can access remote shared directories just like accessing local disks. NFS is just a file system without transmission function. It is implemented based on the RPC (Remote Procedure Call) protocol and adopts the C/S architecture.

1.Install the NFS package

sudo apt-get install nfs-kernel-server # Install NFS server
sudo apt-get install nfs-common # Install NFS client

2.Add NFS shared directory

sudo vim /etc/exports

(If you need to set the “/nfsroot” directory as an NFS shared directory, please add the following line at the end of the file:)

/nfsroot *(rw,sync,no_root_squash) # * Indicates that systems with any network segment IP are allowed to access the NFS directory

(Create a new “/nfsroot” directory and set the most loose permissions for this directory:)

sudo mkdir /nfsroot
sudo chmod -R 777 /nfsroot
sudo chown ipual:ipual /nfsroot/ -R # ipual is the current user, -R means recursively change all files in this directory

3.Start the NFS service

sudo /etc/init.d/nfs-kernel-server start
Or
sudo /etc/init.d/nfs-kernel-server restart

(When the NFS service has been started, if the “/etc/exports” file is modified, the NFS service needs to be restarted to refresh the NFS shared directory.)

4.Test the NFS server

sudo mount -t nfs 192.168.0.192:/nfsroot /mnt -o nolock

(192.168.0.192 is the host ip, /nfsroot is the host shared directory, and /mnt is the device mounting directory. If the command runs without error, the NFS mount is successful. You should see the /nfsroot directory in the /mnt directory of the host Content (you can create a new test directory under the nfsroot directory first), if you need to uninstall it)

5.Unmount

umount /mnt

6.Ubuntu mount

sudo mount -t nfs 192.168.12.123:/nfsroot /mnt

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

%d 博主赞过: