- CentOS 8 under WSL2
- Disable Docker Desktop
cat > /etc/wsl.conf << 'EOF'
[boot]
systemd=true
[user]
default=yourname
[wsl2]
networkingMode=mirrored
autoProxy=true
EOF# Install packages
sudo dnf update -y
sudo dnf install nfs-utils -y
# Create share
sudo mkdir -p /srv/nfs/shared
sudo chown nobody:nobody /srv/nfs/shared
sudo chmod 755 /srv/nfs/shared
# Configure exports
echo '/srv/nfs/shared *(rw,sync,no_subtree_check,no_root_squash,no_all_squash,insecure)' | sudo tee -a /etc/exports
sudo exportfs -arv
# Start services
sudo systemctl enable rpcbind
sudo systemctl start rpcbind
sudo systemctl enable nfs-server
sudo systemctl start nfs-server
# Check status
sudo systemctl status rpcbind
sudo systemctl status nfs-server
sudo systemctl status rpc-statd
sudo systemctl status nfs-mountd
sudo systemctl status nfs-idmapd
sudo ss -tuln | grep -E ':(111|2049|20048)'
sudo showmount -e localhost
sudo nfsstat -s
# Stop services (optional)
sudo systemctl stop nfs-server rpcbind
sudo systemctl stop rpcbind.socketConfigure static ports (optional)
# sudo nano /etc/sysconfig/nfs # sudo systemctl restart nfs-server rpcbind RQUOTAD_PORT=875 LOCKD_TCPPORT=32803 LOCKD_UDPPORT=32769 MOUNTD_PORT=892 STATD_PORT=662 STATD_OUTGOING_PORT=2020
Configure version (optional)
# sudo nano /etc/nfs.conf # sudo systemctl restart nfs-server [nfsd] vers4=y vers3=n vers2=n
# Install utilities
sudo dnf install nfs-utils -y
# Create mount
sudo mkdir -p /mnt/nfs-share
sudo chmod 775 /mnt/nfs-share
# Test connection
showmount -e NFS_SERVER_IP
# Mount share (vers=4.1 for Ubuntu 24.04)
sudo mount -v -t nfs -o vers=4.0,tcp,noresvport,actimeo=0,nocto,lookupcache=none NFS_SERVER_IP:/srv/nfs/shared /mnt/nfs-share