Add nfs_client.sh

This commit is contained in:
Raj 2024-01-28 01:33:19 +05:30
parent 1043045cbc
commit dc66949f18
1 changed files with 25 additions and 0 deletions

25
nfs_client.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Variables
SERVER_IP="192.168.1.2"
NFS_SHARE="/mnt/arkdisk"
MOUNT_POINT="/mnt/arkdisk"
# Step 1: Install NFS Client
echo "Installing NFS client..."
sudo apt update
sudo apt install -y nfs-common
# Step 2: Create a Mount Point
echo "Creating mount point..."
sudo mkdir -p $MOUNT_POINT
# Step 3: Mount the NFS Share
echo "Mounting NFS share..."
sudo mount $SERVER_IP:$NFS_SHARE $MOUNT_POINT
# Step 4: Add Entry to /etc/fstab for Automatic Mounting
echo "Adding entry to /etc/fstab..."
echo "$SERVER_IP:$NFS_SHARE $MOUNT_POINT nfs defaults 0 0" | sudo tee -a /etc/fstab
echo "NFS client setup completed."