okecity.com

Setup NFS on orange PI OPI

Setup NFS on orange PI OPI

To set up NFS (Network File System) on an Orange Pi 5 or any other Linux-based system, follow these steps:

  1. Install the necessary packages: Open a terminal on your Orange Pi 5 and install the NFS server package:

    For Debian-based systems (e.g., Ubuntu):

    
     

    bashCopy code

    sudo apt update sudo apt install nfs-kernel-server

    For Red Hat-based systems (e.g., CentOS):

    
     

    bashCopy code

    sudo yum install nfs-utils

  2. Create a directory to share: Choose or create a directory on your Orange Pi 5 that you want to share with other devices on the network. For example, let's create a directory named "shared_folder":

    
     

    bashCopy code

    sudo mkdir /path/to/shared_folder

  3. Configure NFS exports: Edit the NFS exports file to specify which directories you want to share. Open the /etc/exports file using a text editor:

    
     

    bashCopy code

    sudo nano /etc/exports

    Add a line to export the "shared_folder" to the network. Replace <network> with the IP address or network range of the devices you want to allow access (e.g., 192.168.1.0/24 to allow all devices in the 192.168.1.0/24 subnet):

    
     

    bashCopy code

    /path/to/shared_folder <network>(options)

    For example:

    
     

    bashCopy code

    /path/to/shared_folder 192.168.1.0/24(rw,sync,no_subtree_check)

    Save the file and exit the text editor.

  4. Restart the NFS server: After modifying the /etc/exports file, you need to restart the NFS server to apply the changes:

    
     

    bashCopy code

    sudo systemctl restart nfs-kernel-server # For Debian/Ubuntu # OR sudo systemctl restart nfs # For CentOS/RHEL

  5. Allow NFS traffic through the firewall (if applicable): If you have a firewall enabled on your Orange Pi 5, you'll need to open the necessary ports for NFS. On most systems, NFS uses ports 111 (TCP/UDP) and 2049 (TCP/UDP). The exact steps depend on your firewall software, but you can use the following commands as an example:

    
     

    bashCopy code

    sudo ufw allow from <network> to any port 111 proto tcp sudo ufw allow from <network> to any port 2049 proto tcp sudo ufw allow from <network> to any port 111 proto udp sudo ufw allow from <network> to any port 2049 proto udp

    Replace <network> with the appropriate IP address or network range.

Now your Orange Pi 5 is set up to share the "shared_folder" over NFS with other devices on the specified network. Other devices can mount this shared folder using the IP address of the Orange Pi 5 and the exported path.

Remember that NFS does not provide encryption by default, so it's recommended to use NFS in a trusted network environment or consider using additional security measures if needed.

Category: Tekno

Share: