Lab 4.1 - Setup NFS Server

1. Format disk

fdisk /dev/vdX
partprobe

2. Format disk

mkfs.xfs /dev/vdX1
lsblk

3. Install packages

dnf install -y nfs-utils

4. Enable nfs service

systemctl start nfs-server.service
systemctl enable nfs-server.service
systemctl status nfs-server.service

5. Create NFS directory

mkdir -p  /mnt/nfs-server
ls /mnt

6. Export filesystem share

vim /etc/exports
...
/mnt/nfs-server     *(rw,root_squash)    
...

exportfs -arv

7. Verify export list

exportfs  -s

8. Set firewalld for NFS Server

firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=nfs3
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload

9. Get disk /dev/vdb UUID

blkid

10. Mount /dev/vdb to /mnt/nfs-server/

vim /etc/fstab
...
UUID=7adab6fe-3e33-4a04-a86c-b971294fd682 /mnt/nfs-server/        xfs     defaults        0 0
...

cat /etc/fstab
mount -a

11. Verify mountpoint

chmod -R 777 /mnt/nfs-server
df -hT
mkdir okd-nfs
mount -t nfs 10.6X.6X.3:/mnt/nfs-server okd-nfs

12. Make sure the file exists and unmount

df -hT
touch okd-nfs/test.txt && ls okd-nfs && ls /mnt/nfs-server
umount okd-nfs/

Daftar Materi