Simple NFS server configuration
Go directly to the step;
1. Network Connectivity
Virtual machines, development boards, and hosts must all be in the same LAN. The Development Board can be directly linked to the host using a network cable or through a router (if connected to the router, it will be convenient, can access the Internet); if your host is connected to a wireless network, it is possible to ping the virtual machine and the host and the development board to the same LAN. You may be able to ping both the VM and the host (bridging mode), but you cannot ping the host and the virtual machine on the Development Board, because the three of them are not in the same LAN, although the ip address and gateway you set are in the same LAN (192.168.1.1), the essence is that the virtual machine and host are in the same LAN. The solution is to first disable the wireless network of the host, and then restart the network (service network restar) in the virtual machine so that the three systems can ping each other. After you start the wireless network, the network between the Development Board and the virtual machine will not be affected, but in this case, the virtual machine will not be able to access the Internet.
The following operations are performed on the server, that is, the virtual machine:
2. install the software package
First, link the VM to the Internet. (If you do not know how to configure the VM network, you can check the network configuration commands in Linux.) install two software packages: yum install-y nfs-utils portmap;
Start in sequence:
Service portmap start; if the error portmap: unrecognized service is displayed (this service cannot be found), try service rpcbind start; this is because the package name has changed;
Service nfs start; start the nfs service
Service nfslock start; start the nfs lock service
3. Modify the script
Vim/etc/exports
/Home/nfs * (sync, ro, no_root_squash);/home/nfs indicates the directory to be shared with the Development Board (client; * indicates that all hosts can share this directory (you can specify an IP segment for sharing). The following are synchronization, read/write permissions, and logon without the root permission. You can check the details, the simplest configuration is described here;
Exportfs-ra can apply the configuration in the/etc/exports file. exportfs-v displays the NFS output directory on the server.
The following operations are performed on the client, that is, the Development Board:
4. Directly mount the Directory
Mount-t nfs 192.168.1.150:/home/nfs/mnt/share; mount the/home/nfs directory in the virtual machine to the/mnt/share directory on the Development Board;
If
"Svc: failed to register lockdv1 RPC service (errno 5 ).
Lockd_up: makesock failed, error =-5 "error. Try the following command;
Mount-t nfs-o nolock 192.168.1.150:/home/nfs/mnt/share
Unmount is the same as other unmount commands: umount/mnt/share (Be sure to exit the directory first, otherwise the error "Device or resource busy" will occur );