Home  >  Article  >  php教程  >  Linux NFS server setup

Linux NFS server setup

WBOY
WBOYOriginal
2016-07-06 14:25:231578browse

Linux NFS server construction

1. NFS: NFS (Network File System) is a network file system. It is one of the file systems supported by FreeBSD. It allows computers on the network to communicate with each other. Share resources over a TCP/IP network.
In NFS applications, local NFS client applications can transparently read and write files located on the remote NFS server, just like accessing local files.
2. Install the NFS server: sudoapt-get install nfs-kernel-server;
3. Configure /etc/exports: sudo vim /etc/exports;
Directories and permissions allowed for Ubuntu NFS mounting It is defined in the file /etc/exports.
Share the folder /home/student/xushan directory under the root directory.
Add the following line at the end of the /etc/exports file: /home/student/xushan *(rw,sync,no_root_squash)

*: represents allowing all network segments to access,

rw: is read and write permissions,

sync: is data is written to the memory and hard disk synchronously,

no_root_squash: is Ubuntu nfs The permissions of the user of the client's shared directory. If the client uses the root user, then the client has root permissions for the shared directory.
4. NFS restart service
$sudo /etc/init.d/portmap restart
$sudo /etc/init.d/nfs-kernel-server restart
5. Test Ubuntu NFS
At this time, you can run the following command to display the shared directory: $showmount -e
Or you can use the following command to mount it on the local disk, for example, mount /home/student/xushan
to Under /mnt: $sudo mount -t nfs 192.168.1.117:/home/student/xushan /mnt
You can run the df command to check whether the mount is successful.
(In this way, the directory created under the /mnt directory will also appear under /home/student/xushan)
After viewing, you can use the following command to uninstall: $ sudo umount /mnt
Note: When using the uninstall command , exit the mounted directory first, and then execute the uninstall command, otherwise the device will be busy and cannot be uninstalled
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn