Skip to content

Install and Configure nfs

nfs functions as a remote Hard Disk. If you need to access files locally but are stored on a remote server shared using nfs then this nfs will behave as its a Hard Disk setup locally.

We do have use cases for nfs so lets set this up.

# in this lab we will mount the ubuntu ISO to be served via nfs.
# the first part will be to mount the ubuntu ISO files to a folder.
# Copy and paste each row without a # at the begining.


# create the folder to download the iso file to.
mkdir -p /srv/tftp/iso
# Download the ISO
wget -P /srv/tftp/iso https://releases.ubuntu.com/20.04.6/ubuntu-20.04.6-live-server-amd64.iso
#Create folder to mount ISO file
mkdir -p /srv/isoubuntu
# this will mount the ISO file until the server is rebooted
mount -o loop,ro -t iso9660 /srv/tftp/iso/ubuntu-20.04.6-live-server-amd64.iso /srv/isoubuntu
ls /srv/isoubuntu

# to make the iso mounted permanantly
# update the fstab
c
#add following entry
/srv/tftp/iso/ubuntu-20.04.6-live-server-amd64.iso /srv/isoubuntu iso9660 loop 0 0

Validate by rebooting the server and check if the iso files are listed.
ls /srv/isoubuntu


#install nfs 
apk update
apk add nfs-utils

# set nfs to start at boot
rc-update add nfs

# check status
rc-service nfs status

# start nfs service
rc-service rpcbind start
rc-service nfs start


#### revalidate config and validation

#nfs configuration 
# update file with the entry below.
vi /etc/exports

/srv/isoubuntu 192.168.100.1/24(async,ro,no_subtree_check,no_root_squash)
# refresh the nfs with the updated row.

exportfs -arv

#test mount using the following command
mkdir mntnfs
mount 192.168.100.1:/srv/isoubuntu mntnfs

# List files in mount 
ls mntnfs/

Setup alpine1 nfs is complete.

Next step

We will proceed with the tftp server installation

Please continue with

106-alpine1-tftp