TomonoriSoejima / Tejun

notes related to working cases
5 stars 3 forks source link

How to set up NFS server on CentOS #152

Open TomonoriSoejima opened 1 year ago

TomonoriSoejima commented 1 year ago
  1. Install NFS Server Package:

    • Open a terminal on your CentOS server.
    • Run sudo yum install nfs-utils to install the necessary NFS package.
  2. Enable and Start NFS Service:

    • Enable the NFS server to start on boot with the command: sudo systemctl enable nfs-server.
    • Start the NFS service with the command: sudo systemctl start nfs-server.
  3. Configure NFS Exports:

    • Decide which directories you want to share over NFS and create them if they don't already exist, e.g., sudo mkdir /var/nfs.

    • Edit the /etc/exports file to specify the directories to share and their permissions. You can do this with a text editor like vi or nano.

    • For example, to share /var/nfs with a client machine 192.168.1.100 with read-write access, add this line to /etc/exports:

      /var/nfs 192.168.1.100(rw,sync,no_subtree_check)
    • Apply the configuration by running sudo exportfs -a.

  4. Adjust Firewall Settings (if applicable):

    • If you're running a firewall, you'll need to allow NFS traffic:
      • Run sudo firewall-cmd --permanent --zone=public --add-service=nfs
      • Run sudo firewall-cmd --permanent --zone=public --add-service=mountd
      • Run sudo firewall-cmd --permanent --zone=public --add-service=rpc-bind
      • Reload the firewall settings with sudo firewall-cmd --reload.
  5. Verify the NFS Server Configuration:

    • Check the status of the NFS server with sudo systemctl status nfs-server.
    • Show the shares available on the server with showmount -e.

After following these steps, your NFS server should be set up and sharing directories with the specified clients. Clients will then need to mount these directories to access them. Please replace IP addresses and directory paths with ones that are appropriate for your network configuration.

Then go do mount

sudo mkdir /mnt/nfs sudo mount -t nfs 10.146.0.74:/var/nfs /mnt/nfs

TomonoriSoejima commented 1 year ago

https://www.elastic.co/guide/en/elasticsearch/reference/8.11/snapshots-register-repository.html