Linux Services NFS Configuration detailed steps

Source: Internet
Author: User

1. Environmental preparedness
以用户名[[email protected] ~] ip:192.168.24.181/24为服务端以用户名[[email protected] ~] ip:192.168.24.132/24为客户端
Server-side configuration 2. Basic Environment configuration Shutdown FIREWALLD Firewall
[[email protected] ~]# systemctl disable firewalld[[email protected] ~]# systemctl stop firewalld
Turn off SELinux
[[email protected] ~]# sed -ri ‘#^SELINUX=#cDELINUX=Disabled‘ /etc/selinux/config[[email protected] ~]# setenforce 0
Install nfs-server//to install the NFS service main program
[[email protected] ~]# yum -y install nfs-utils rpcbind
3. Start nfs-server//start the Rpcbind service and view the RPC registration information
[[email protected] ~]# systemctl start rpcbind[[email protected] ~]# systemctl enable rpcbind[[email protected] ~]# systemctl start nfs-server[[email protected] ~]# systemctl enable nfs-server[[email protected] ~]# rpcinfo -p localhost   program vers proto   port  service    100000    4   tcp    111  portmapper    100000    3   tcp    111  portmapper    100000    2   tcp    111  portmapper    100000    4   udp    111  portmapper    100000    3   udp    111  portmapper    100000    2   udp    111  portmapper
4. View the NFS-related processes running in the system
[[email protected] ~]# ps -ef | egrep "rpc|nfs"
5.NFS server-side configuration shared directory

Edit NFS Master profile, shared directory Linfan to 192.168.24.132/24, read/write, unified user

[[email protected] ~]# vi /etc/exports/data 192.168.24.132/24(rw,sync,all_squash)

Create a directory that needs to be shared

[[email protected] ~]# mkdir /data

Restart the Nfs-server service to see if the shared file exists

[[email protected] ~]# systemctl restart nfs-server[[email protected] ~]# cat /var/lib/nfs/etab/data   192.168.24.132/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,secure,root_squash,all_squash)

NFS Unified to the client for 65534 user rights, see 65534 belongs to which user, recursively give the data directory Nfsnobody

[[email protected] ~]# grep "65534" /etc/passwdnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin[[email protected] ~]# chown -R nfsnobody.nfsnobody /data/[[email protected] ~]# ls /data/ -dldrwxr-xr-x. 2 nfsnobody nfsnobody 6 Aug  2 16:12 /data/
Restart Nfs-server service in effect
[[email protected] ~]# systemctl restart nfs-server
Client 1. Turn off the firewall and turn off SELinux
[[email protected] ~]# systemctl stop firewalld[[email protected] ~]# systemctl disable firewalld[[email protected] ~]# sed -ri ‘#^SELINUX=#cDELINUX=Disabled‘ /etc/selinux/config[[email protected] ~]# setenforce 0
2. Install related services, only start Rpcbind service
[[email protected] ~]# yum -y install nfs-utils rpcbind[[email protected] ~]# systemctl enable rpcbind[[email protected] ~]# systemctl start rpcbind
3. Client view remote server to provide mount information
[[email protected] ~]# showmount -e 192.168.24.181Export list for 192.168.24.181:/data 192.168.24.132/24
4. The client mounts the shared data
[[email protected] ~]# mount -t nfs 192.168.24.181:/data /mnt[[email protected] ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root   17G  6.0G   12G  35% /devtmpfs                 478M     0  478M   0% /devtmpfs                    489M     0  489M   0% /dev/shmtmpfs                    489M   26M  464M   6% /runtmpfs                    489M     0  489M   0% /sys/fs/cgroup/dev/sda1               1014M  125M  890M  13% /boottmpfs                     98M     0   98M   0% /run/user/0192.168.24.181:/data      17G  1.8G   16G  11% /mnt
5. Test whether NFS succeeded client operation create a file under client mnt hello
## [[email protected] ~]# ls /mnt/[[email protected] ~]# cd /mnt/[[email protected] mnt]# touch hello[[email protected] mnt]# lshello
Server-side operation to see if there is a file hello under Data on the server
[[email protected] ~]# ls /datahello

Linux Service NFS configuration detailed steps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.