Linux CentOS 7 - NFS Configuration
Setup:
2 systems, sysmtem1 and system2 in the example.com domain;IP address of interface ens33 on system1: 192.168.189.140/24
IP address of interface ens33 on system2: 192.168.189.141/24
CentOS version 7.6
Export a public directory on system1 with read-only access to system2.example.com
On system1.example.com:
yum install nfs* -yvim /etc/sysconfig/nfs
RPCNFSDARGS="-V4.2"
systemctl enable nfs-server
systemctl start nfs-server
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --reload
mkdir /public
chmod 777 /public
getsebool -a | grep nfs (no changes required on default settings)
semanage fcontext -a -t public_content_t '/public(/.*)?'
restorecon -RFv /public
vim /etc/exports
/public *.example.com(ro,sync)
exportfs -var
systemctl restart nfs-server
showmount -e localhost
On system2.example.com:
yum install -y nfs-utilsvim /etc/sysconfig/nfs
RPCNFSDARGS="-V4.2"
mkdir /mnt/public
vim /etc/fstab
192.168.189.141:/public /mnt/public nfs defaults 0 0
Verify results
1) on system1:touch /public/123
on system2:
ll /mnt/public
should show file 123
2) on system2:
touch /mnt/public/456
should give an error
If you experience any problem with this configuration, please let me know.
Commenti
Posta un commento