Access Network Attached Storage in RHEL - RHCSA (RH134).pdf

support8872 556 views 24 slides Sep 28, 2024
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

Slides on how to access network attached storage - Part of RHCSA (RH134) syllabus


Slide Content

Access network-attached
storage

Network File System(NFS)
●Function: Defines how files are stored and retrieved from storage
devices across a network

●Usage: Allows system administrators to share portions of a filesystem
over a network for remote access

●Client Access: Authorized clients can mount NFS shares (shared file
systems)

●Communication: Uses Remote Procedure Calls (RPCs) to route file
access requests between clients and server

Source: (20) Network File System (NFS) in Linux | LinkedIn

NFS Server configuration
Install NFS Server Package
●Command: yum install nfs-utils libnfsidmap

Role of rpcbind in NFS
●NFS registers its services with rpcbind with
○Program number for NFS
○Port used

●When NFS client queries the rpcbind for NFS port

●rpcbind returns server’s port number

●Client connects to the NFS server

Start and enable rpcbind service
●Command: systemctl enable rpcbind && systemctl start rpcbind
Start and enable the NFS server
●Command: systemctl enable nfs-server && systemctl start nfs-server

Create a directory to share over NFS
●Command: mkdir <directory-name>
Give all permissions to this directory
●Command: chmod a+rwx <directory-name>
Create 3 files inside the directory and add content to them
●Command: cd /nfsdir && touch file1 file2 file3

Edit the ‘/etc/exports’ config file to complete the server configuration
to share the directory over NFS
●Command: vi /etc/exports
Add the following line to the config file.
●Command: /nfsdir *(rw,sync,no_root_squash)

Export the shared directory using the exportfs command
●Command: exportfs -rv
Check the IP address of the server
●Command: ifconfig

NFS Client Configuration
Start and enable the rpcbind services on the client machine
Ensure firewall and iptables are stopped (if running)
●Command: ps–ef | egrep “firewall|iptable”

Create a mount point on client-side
●Command: mkdir /mnt/<directory-name>
Show mount from the NFS server
●Command: showmount -e <server-ip>

Mount the NFS file system on client side
●Command:
mount <ip-address>:/<nfs-directory><client-side-mounting-directory>
Verify the mounted file system
●Command: df -h

To unmount the directory
●Command: umount /mnt/attacheddir

Samba
Allows the linux systems to share files and printer with other
operating systems using smb/cifs protocol

●SMB(Server Message Block): protocol for sharing files and
resources over networks, widely used in Windows.

●CIFS(Common Internet File System): older, less secure version
of SMB for network and internet file sharing.

Source: Setting up a Simple Samba Share - Part I - Collabnix

Install the samba server package
●Command: yum install samba samba-client samba-common

Create a directory to share over Samba
●Command: mkdir /samba && mkdir /samba/<directory-name>
Create a demo file inside the directory and add the content to it
●Command: echo 'From samba server.’> /samba/<directory-name>/<file-name>

Assign the permissions to samba directory
●Command: chmod a+rwx -R /samba
Change the ownership of the directory to nobody
●Command: chown -R nobody:nobody /samba

Open the configuration file and disable the SElinux and replace
('SELINUX=enforcing' with 'SELINUX=disabled’) then reboot the machine
●Command: vi /etc/selinux/config
Note: you can verify the change by using ‘sestatus’ command

Check whether the changes made to the file are correct
●Command: testparm

Enable and start the smb service
●Command: systemctl enable smb && systemctl start smb

Enable and start the nmb service
●Command: systemctl enable nmb && systemctl start nmb

Install the cifs and samba-client
●Command: yum install cifs-utils samba-client

Create a directory to mount the samba share
●Command: mkdir <directory-name>
Mount the directory and leave the field blank when prompted for password because
we are logging in anonymously
●Command: mount -t cifs //<ip-address>/Anonymous <directory-name>

Verify the content of the mounted directory
●Commands: ls /mnt/<mounted-directory>
Unmount the directory
●Command: umount /mnt/<mounted-directory>