Posted On August 13, 2021

How to Install NFS Server on Ubuntu 21.04

kimconnect 0 comments
blog.KimConnect.com >> Linux >> How to Install NFS Server on Ubuntu 21.04

Installing NFS Server

# Include prerequisites
sudo apt update -y # Run updates prior to installing
sudo apt install nfs-kernel-server # Install NFS Server
sudo systemctl enable nfs-server # Set nfs-server to load on startups
sudo systemctl status nfs-server # Check its status

# check server status
root@worker03:/home/brucelee# sudo systemctl status nfs-server
● nfs-server.service - NFS server and services
     Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2021-08-13 04:25:50 UTC; 18s ago
    Process: 2731 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
    Process: 2732 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
   Main PID: 2732 (code=exited, status=0/SUCCESS)

Aug 13 04:25:49 linux03 systemd[1]: Starting NFS server and services...
Aug 13 04:25:50 linux03 systemd[1]: Finished NFS server and services.

# Prepare an empty folder
sudo su # enter root
nfsShare=/nfs-share
mkdir $nfsShare # create folder if it doesn't exist
chown nobody: $nfsShare
chmod -R 777 $nfsShare # not recommended for production

# Edit the nfs server share configs
vim /etc/exports
# add these lines
/nfs-share x.x.x.x/24(rw,sync,no_subtree_check,no_root_squash,no_all_squash,insecure)

# Export directory and make it available
sudo exportfs -rav

# Verify nfs shares
sudo exportfs -v

# Enable ingress for subnet
sudo ufw allow from x.x.x.x/24 to any port nfs

# Check firewall status - inactive firewall is fine for testing
root@worker03:/home/brucelee# sudo ufw status
Status: inactive

How to Install NFS Client on Ubuntu 21.04

# Install prerequisites
sudo apt update -y
sudo apt install nfs-common

# Mount the nfs share
remoteShare=server.ip.here:/nfs-share
localMount=/mnt/testmount
sudo mkdir -p $localMount
sudo mount $remoteShare $localMount

# Unmount
sudo umount $localMount

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Problem: NextCloud Would Not Start Due to Versioning Variance

This issue has occurred when NextCloud has been upgraded after deployment. Its source docker container…

Installing VMWare Tools on Linux Guest Virtual Machines

Installation Process # Installing VMWare Tools mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom cp /mnt/cdrom/VMwareTools-*.tar.gz /tmp/ cd…

How to fix outdated and unsupported Ubuntu versions

rooty@FOGSERVER01$ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 13.10Release: 13.10Codename: saucyUbuntu 13.10 (Saucy…