RHCSA RHEL 8 - Mount and unmount network file systems using NFS

Sdílet
Vložit
  • čas přidán 12. 09. 2024
  • Buy CSG Merchandise:
    tee.pub/lic/csg
    Your support on Ko-Fi is much appreciated:
    ko-fi.com/csg_yt
    More information on Sophos Home Antivirus:
    bit.ly/SophosHP
    More information about Hostinger VPS:
    bit.ly/H-VPS
    This video is based on RHEL 8.
    Video to cover the section 'Mount and unmount network file systems using NFS' for the RHCSA (Red Hat Certified System Administrator).
    More information on the required learning: bit.ly/rhcsa8
    Notes from the video (also can be found on our website): csg.tech.blog/...
    Notes from the video:
    NFS Server Build (10.0.2.5)
    Note: this isn't required knowledge for the RHCSA.
    First on a new server install the NFS server (not required as part of the exam):
    yum groupinstall -y file-server
    Add firewall rule.
    firewall-cmd --permanent --add-service=nfs
    firewall-cmd --reload
    Start NFS at boot:
    systemctl enable rpcbind nfs-server
    systemctl start rpcbind nfs-server
    Create directories to export:
    mkdir /home/nfs-share
    chmod 777 /home/nfs-share
    Update the SELINUX contexts:
    yum install -y setroubleshoot-server
    Enable SELINUX booleans:
    setsebool -P nfs_export_all_rw on
    setsebool -P nfs_export_all_ro on
    setsebool -P use_nfs_home_dirs on
    Edit the /etc/exports file and create a new line with the following:
    /home/nfs-share 10.0.2.6(rw,no_root_squash)
    Restart nfs-server:
    systemctl restart nfs-server
    Check the share is working:
    showmount -e localhost
    NFS Client Setup (10.0.2.6)
    This is the required section for the exam.
    Install NFS-Utils (if not already installed):
    yum install -y nfs-utils
    To mount temporarily:
    mount -t nfs 10.0.2.5:/home/nfs-shared /mnt
    Check the mount is working:
    ls /mnt
    vi /mnt/somefile
    To unmount:
    umount /mnt
    To mount permanently edit /etc/fstab with the following line:
    10.0.2.5:/home/nfs-share /mnt nfs4 defaults 1 2
    To test the fstab mount configuration force a mount:
    mount -a
    #rhcsa #rhel #linux

Komentáře • 15

  • @hairyviking9248
    @hairyviking9248 Před 3 lety +2

    Is there a reason you don't recommend defaults,bg in your /etc/fstab?
    In previous RHCSA's it was always best practice to add, so that if the nfs server is down, the system won't halt on boot simply because it can't mount an nfs drive.

    • @compsecgadgets
      @compsecgadgets  Před 3 lety +1

      Thats a very good point and something I hadn't considered!

  • @ha7763
    @ha7763 Před 2 lety

    At the end, after you've unmounted the nfs server, is it mandatory to remove the entries in /etc/fstab ? I think i didn't before & it caused my VM to crash & go into reboot mode

  • @ha7763
    @ha7763 Před 2 lety

    when i enter the /home/nfs-share ipadd entry into the exports file I get a red colour error on the word "share", do you know why?

  • @mornepretorius7329
    @mornepretorius7329 Před 3 lety +1

    When I try to create a file, "mount-success" in your case, I keep getting the error: "read-only file system". How do I fix this?

    • @compsecgadgets
      @compsecgadgets  Před 3 lety

      What are you mounting in this case. Either you are mounting as read-only or you are mounting something that is read-only such as a CD-ROM or the like?

  • @realplazer8450
    @realplazer8450 Před 4 lety +2

    when i type showmount -e and ip number, i get this response
    "clnt_create: RPC: Program not registered" can you help me resolve this please. i have tried restarting nfs but i still get same error code

    • @compsecgadgets
      @compsecgadgets  Před 4 lety

      Hi, did you check if there are any logs within /var/log/messages is there anything in there?Also might be worth a reboot as it could be holding something open?

    • @realplazer8450
      @realplazer8450 Před 4 lety +1

      @@compsecgadgets yes I did. I will work on it again this week n Hope's all goes well

    • @rickpohly2031
      @rickpohly2031 Před 3 lety +2

      Hi there, I got this message too and after starting both rpc-statd and nfs-idmapd via the systemctl command, it worked.

  • @rickpohly2031
    @rickpohly2031 Před 3 lety +1

    Do you have to run exportfs before the share can become available to the client?

  • @ancientpho
    @ancientpho Před 3 lety +1

    What about Samba or Automounting NFS?

    • @compsecgadgets
      @compsecgadgets  Před 3 lety

      Automating is covered in another video. Samba isn't part of the current objectives for the rhcsa.