How To Install and Configure NFS Server On Ubuntu 24.04 | Simple Guide
14K views
Nov 23, 2024
Learn how to install and configure an NFS (Network File System) server on Ubuntu 24.04 in this easy-to-follow tutorial! NFS is a powerful way to share files and directories across a network. Follow these steps to get started: ### **Steps Covered:** 1️) **Install Updates:** Keep your system up to date by running: sudo apt update && sudo apt upgrade -y 2️) **Install NFS Server:** Install the NFS server package: sudo apt install nfs-kernel-server -y 3️) **Create and Configure Shared Directory:** Set up the directory to share: sudo mkdir -p /var/nfs_share sudo chmod 777 /var/nfs_share 4️) **Configure NFS Exports:** Edit the configuration file to define access rules: sudo vi /etc/exports Example entry:
View Video Transcript
0:01
hey there welcome back to our channel in
0:03
today's video we will explain how to
0:05
install and configure NFS server on
0:08
Ubuntu
0:09
24.4 NFS is an excellent choice for
0:12
sharing folders between the system in a
0:14
network whether you are setting up a lab
0:17
managing server data or working in a
0:19
cloud environment this tutorial has got
0:21
to cover what is NFS NFS stands for
0:24
Network file system it allows you to
0:27
share the files and directories over the
0:29
network and as if they were local it's
0:31
lightweight reliable and perfect for
0:33
Linux environments let's dive in before
0:36
we start andure we have the followings a
0:39
running ubu 24.4 instance local user
0:43
with pseudo privileges two systems in
0:45
the same network for
0:47
testing once ready let's move on I have
0:50
already taken the SSS session of my
0:52
Ubuntu instance this is the IP address
0:55
of my ubu
0:57
24.4 system
1:00
all right the first step is to install
1:02
all the available updates for
1:05
that run the
1:25
command next install the NFL server
1:28
package for that run the
1:55
command once install let's create and
1:58
configure the directories that you want
2:00
to share via NFS in my case I will be
2:03
sharing /w/ NFS undor share
2:12
folder make sure that folder exists if
2:15
it doesn't exist create the folder using
2:18
the mkd command
2:31
next set the required permissions on
2:33
this
2:45
folder next configure the NFS exports by
2:48
editing the NFS configuration file that
2:50
is /c/
2:58
exports in this F file put the entries
3:01
something like
3:04
this this is the path of the directory
3:07
on the NFS server that will be shared
3:11
this is the subnet of client machine
3:14
means the machines which are on this
3:16
network will be allowed to access this
3:19
NFS share these are the permissions for
3:23
this NFS share here RW means clients on
3:30
this subnet will able to access this NFS
3:33
share with Rite permissions sync ensures
3:37
here that changes made by the clients
3:39
are returned to the disk immediately on
3:41
the
3:43
server no underscore subtree uncore
3:46
check means it disables the subtree
3:49
check it will skip checking the entire
3:52
file hierarchy of an exported directory
3:54
disabling this improves the performance
3:57
reduce the potential access issues
3:58
especially for n
4:01
directories in case you want to allow
4:04
this share to a specific IP
4:07
address for
4:10
that you need to replace this subnet
4:13
with the single
4:23
IP so using this entry this share will
4:27
be allowed only to this IP address
4:29
address with these
4:31
permissions if you want to allow this
4:34
NFS share based on the fqdn or the host
4:39
name of the client machine for
4:42
that need to put the
4:45
entry something like this you need to
4:47
replace this IP address with the host
4:50
name of the client machine let's say
4:55
db. example.com
5:00
if you want to allow all the machines on
5:04
this example.com in that case you need
5:07
to replace this DB with the star so
5:10
entry would be something like
5:20
this okay I'm deleting the Bel three
5:25
entries now save and close the file
5:30
in order to make these changes into the
5:32
effect I need to run the command sudu
5:35
space export FS iph
5:40
a now check which Shares are
5:48
exported all right the next step is to
5:52
allow the NFS port in the firewall this
5:55
is only applicable in case firewall is
5:58
enabled on your Ubuntu system let's
6:01
verify it whether the firewall is
6:03
enabled or not for that run the command
6:06
sudu UF W
6:11
status output confirms that firewall is
6:14
running here so I need to allow the NFS
6:18
port for that run the command
6:22
sudu
6:24
ufw allow
6:30
from subnet of your client
6:33
machines in my case it is
6:37
192.168
6:41
1.024 to any port and then
6:45
NFS hit
6:47
enter reload these changes for that run
6:51
sudu
6:53
ufw reload
7:00
now check the status
7:06
again this entry confirms that NFS Port
7:09
that is 2049 is allowed for this subnet
7:14
we are done with the NFS installation
7:16
and configuration part let's move to the
7:18
client machine try to mount the NFS
7:20
share
7:22
there we are using rhl L as NFS client
7:26
on the client machine install the NFS
7:29
client package first run the command so
7:32
do
7:35
dnf
7:37
install ands
7:47
iils now mount an F share using the
7:51
mount
7:56
command then so do Mount
8:02
IP address of your NFL
8:07
server colon followed by the NFS
8:11
share /w/ NFS
8:18
share and the mount directory in my case
8:20
Mount directory SL MNT so hit enter run
8:25
DF Capital
8:27
th/ MN
8:31
great the output confirms
8:34
that remote NFS share of type
8:39
nfs4 is mounted on/ MNT
8:44
folder all right let's try to create a
8:48
sample file under this NFS
8:58
share all right right now go back to the
9:01
NFS
9:05
server do LS
9:13
share this mounting of NFS share on this
9:18
client machine is not persistent across
9:20
the reboot whenever we reboot this
9:22
machine this NFS share will not be
9:24
mounted automatically in order to mount
9:27
the NFS share permanently we need to add
9:31
the entry in the FST
9:52
file so this is my remote NFS R IP and
9:56
this is the NFS share path and this is
10:00
the Mount point on which this NFS share
10:02
will be mounted type of this file system
10:05
is NFS and the we are specifying the
10:09
defaults
10:12
entries save and close the
10:15
file and then the command sud do space
10:20
Mount minus a and type DF command
10:27
again all right
10:30
this confirms that our NFS is mounted
10:33
successfully on the MNT
10:37
folder that's all from this video
10:39
tutorial I hope you have found it useful
10:41
and informative please do like the video
10:44
and subscribe to our channel for more
10:46
Tech tutorials thank you bye have a nice
10:49
day see you in the next video
#File Sharing & Hosting