Skip to main content

Working with Network Sharing via NFS in SUSE Linux Enterprise

Hands-On Lab

 

Photo of Ross Brunson

Ross Brunson

Linux Training Architect II

Length

00:30:00

Difficulty

Beginner

In this hands-on lab, we will configure Network File Sharing (NFS) on a SUSE Linux Enterprise server. Once we have it configured, we will access that share from a second server. This task allows centralized storage for distributed users and can also be part of a disaster recovery scenario, as files located on the centralized server can be backed up and restored at the central location.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Working with Network Sharing via NFS in SUSE Linux Enterprise

Introduction

In this hands-on lab, we will configure Network File Sharing (NFS) on a SUSE Linux Enterprise server. Once we have it configured, we will access that share from a second server. This task allows centralized storage for distributed users and can also be part of a disaster recovery scenario, as files located on the centralized server can be backed up and restored at the central location.

Solution

Log in to Server 2 using the credentials provided:

ssh cloud_user@<SERVER_2__PUBLIC_IP_ADDRESS>

On Server 2, via YaST, Install and Set Up NFS Server to Share Out /exports/docs Directory. Ensure It Is Writeable by Members of the wheel Group.

  1. On Server 2, create the /exports/docs directory:

    sudo mkdir -p /exports/docs

    Enter the cloud_user password.

  2. Change to the directory:

    cd /exports
  3. Ensure is it writeable by wheel:

    sudo chown -R root:wheel ./docs
  4. Change the permission on ./docs:

    sudo chmod 770 ./docs
  5. Open YaST:

    sudo yast
  6. Down arrow to Network Services.

  7. Tab over to NFS Server and press Enter.

  8. Under NFS Server, press space bar to select Start.

  9. Press F10 (or Next).

  10. Tab to select Add Directory.

  11. Type in /exports/docs.

  12. Tab to select OK.

  13. Leave Host Wild Card as-is.

  14. Tab to Options, and delete all the data currently there.

  15. Type in rw,no_root_squash.

  16. Tab to select OK.

  17. Press F10 to finish.

  18. Press F9 to quit.

  19. Verify that the NFS server is set up properly:

    cat /var/lib/nfs/etab

Mount the Network Share on Server 1 Using the CLI. Create a Directory and a File and Verify They Exist on Server 2.

  1. Access Server 1:

    ssh 10.0.1.101

    Enter the cloud_user password.

  2. Create a mount point:

    sudo mkdir /mnt/nfsdocs

    Enter the cloud_user password.

  3. Mount the share:

    sudo mount 10.0.1.102:/exports/docs /mnt/nfsdocs
  4. Set permissions on the directory:

    sudo chown -R root:wheel /mnt/nfsdocs
    sudo chmod 770 /mnt/nfsdocs
  5. Change to the directory:

    cd /mnt/nfsdocs
  6. Create an example file:

    touch file1
  7. Create an example folder:

    mkdir example
  8. List the directory's contents:

    ls

    We should see the newly created file and folder.

  9. Exit back to Server 2:

    exit
  10. Change to the directory:

    cd /exports/docs
  11. List its contents:

    ls

    We should see the recently created file and directory from Server 1.

Conclusion

Congratulations on successfully completing this hands-on lab!