Setting Up an NFS Server on VirtualBox

We aim to set up an NFS server and utilize the space created on this server on other systems.

Before proceeding, please prepare the server by following the steps in the articles below:

ایجاد یک ماشین مجازی برای نصب اوراکل

نصب سیستم عامل اوراکل لینوکس 8.9

کانفیگ کارت شبکه با nmcli یا تنظیم ip با nmcli با یک کارت شبکه

نصب پکیج های مورد نیاز اوراکل با dnf

they are in persian but ask google translate to translate  them

However, only follow the last step until you have set up the repository.

Accessing the NFS Server: Log into the Linux virtual machine that you plan to use as the NFS server.

Installing NFS Server: If you are using a Red Hat-based distribution (like Oracle Linux or CentOS), run the following command:

dnf install nfs-utils -y

You will see output similar to this, confirming the installation of the required packages.

Creating a Directory for Sharing: Create a directory that you want to share via NFS. For example, I have allocated a separate partition for this purpose:

df -h

This will display the file system details. I create a directory under the partition:

mkdir /nfspartition/for51

Grant the necessary permissions to make it accessible externally:

chmod 755 /nfspartition/for51/

Edit the following file to specify the addresses that should have access to this space:

vi /etc/exports

Add the following line:

/nfspartition/for51/ 192.168.56.0/24(rw,sync,no_subtree_check,no_root_squash)

Starting and Enabling NFS Service: To ensure the service starts automatically and to start it now, run the following commands:

systemctl start nfs-server
systemctl enable nfs-server

Configuring the Firewall: Add the necessary firewall settings:

firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --reload

On the Client Side: First, install nfs-utils on the client:

dnf install nfs-utils -y

If it's already installed, you can skip this step. Ensure that the dnf repositories are configured and the ISO is mounted.

Create a directory on the client where you want to mount the NFS share:

mkdir /backup/

Mount the NFS share and test it:

mount 192.168.56.56:/nfspartition/for51/ /backup/

Verify the mount:

df -h

Granting Access to Oracle User: To allow the Oracle user access, change the ownership of the mounted directory:

chown oracle:oinstall /backup/ -R

Test it with the Oracle user:

cd /backup/

touch x

ls