On CentOS
Installing the NFS Server
- Log in to the storage node as an administrator and run the following command to install the NFS server:
yum install nfs-utils -y
- Fix the NFS-related ports and configure a firewall for the ports as required.
- Run the following commands to create a shared directory (for example, /data/atlas_dls) and change the directory permission:
mkdir -p /data/atlas_dls chmod 750 /data/atlas_dls/
- Run the vi /etc/exports command to add the content below to the end of the file to configure the allowed IP address as required and harden related permission settings:
/data/atlas_dls service_IP_address (with necessary permissions)
- Run the following commands to start rpcbind:
systemctl restart rpcbind.service systemctl enable rpcbind
- Run the following command to check whether rpcbind is started:
systemctl status rpcbind
If the following information is displayed, the service is running properly:
[root@centos ~]# systemctl status rpcbind ● rpcbind.service - RPC bind service Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-01-15 15:54:44 CST; 28s ago Main PID: 63008 (rpcbind) CGroup: /system.slice/rpcbind.service └─63008 /sbin/rpcbind -w Jan 15 15:54:44 centos39 systemd[1]: Starting RPC bind service... Jan 15 15:54:44 centos39 systemd[1]: Started RPC bind service. - After rpcbind is started, run the following commands to start the NFS service:
systemctl restart nfs systemctl enable nfs
- Run the following command to check whether the NFS service is started:
systemctl status nfs
If the following information is displayed, the service is running properly:
[root@centos ~]# systemctl status nfs-server.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled) Drop-In: /run/systemd/generator/nfs-server.service.d └─order-with-mounts.conf Active: active (exited) since Fri 2021-01-15 15:56:15 CST; 8s ago Main PID: 67145 (code=exited, status=0/SUCCESS) CGroup: /system.slice/nfs-server.service Jan 15 15:56:15 centos39 systemd[1]: Starting NFS server and services... Jan 15 15:56:15 centos39 systemd[1]: Started NFS server and services. - Run the following command to check the mounting permission of the shared directory (for example, /data/atlas_dls):
cat /var/lib/nfs/etab
If the following information is displayed, the service is running properly:
[root@centos ~]# cat /var/lib/nfs/etab /data/atlas_dls * (rw, ... displays the configured permission.)
Installing the NFS Client
- Log in to another server as an administrator and run the following command to install the NFS client:
yum install nfs-utils -y
- Run the following commands to start rpcbind:
systemctl restart rpcbind.service systemctl enable rpcbind
- After rpcbind is started, run the following commands to start the NFS service:
systemctl restart nfs systemctl enable nfs
Parent topic: Installing NFS