Build an NFS server on Arch Linux

NFS (Network File System) is a distributed file system (file server) often used on UNIX-like systems. I personally find Samba easier to work with, but NFS seems to have slightly better performance in many use cases.

You can also access the NFS server from Windows, which is a bit more complicated than Samba. However, please consider that it is almost impossible to access from a smartphone or tablet. We recommend using Samba for such use cases. See Build a Samba server on Arch Linux (https://qiita.com/pttkny/items/90f4c335cb6e94ef46e2).

server

Installation

nfs-utils Install the package.

# pacman -Syu nfs-utils

NFS settings

Make settings to publish the directory. Here we publish data / share / public to any host at 192.168.0.0/24.

/etc/exports


/data/share           192.168.0.0/24(ro,sync,no_subtree_check,fsid=0)
/data/share/public    192.168.0.0/24(rw,sync,no_subtree_check,nohide)

Here, it is assumed that the uid and gid of the server and the client are the same. If you can't do it in common, you can access it as an anonymous user by adding the all_squash option.

Creating a shared directory

Create the target directory and reflect the settings.

# mkdir -p /data/share/public
# exportfs -arv

Firewall settings

Open TCP ports 111,2049,20048. The following is an example of iptables configuration.

/etc/iptables/iptables.rules


-A INPUT -m state --state NEW -m tcp -p tcp --syn -m multiport --dports 111,2049,20048 -j ACCEPT

Start NFS server

Start the NFS server.

# systemctl start nfs-server

Also, set NFS to start automatically after a system reboot.

# systemctl enable nfs-server

client

Mac

Please select one of the following methods.

Shell

You can mount the shared directory on the NFS server as follows:

# mkdir /Volumes/Share
# mount -t nfs -o nolockd,resvport,hard,bg,intr,rw,tcp,nfc 192.168.0.16:/data/share /Volumes/Share

However, this will cause it to be unmounted when the system is rebooted. To allow it to be mounted automatically, add /-/ etc / autofs_nfs to the end of / etc / auto_master and create / etc / autofs_nfs with the following content.

/etc/auto_master


+auto_master		# Use directory service
/home			auto_home	-nobrowse,hidefromfinder
/Network/Servers	-fstab
/-			-static
/- /etc/autofs_nfs

/etc/autofs_nfs


/System/Volumes/Data/mnt/share -fstype=nfs,nolockd,resvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.0.16/data/share

Execute the following command to reflect it immediately.

# automount -cv

Finder

Click "Move" and "Connect to Server (Command + K)" to display a dialog. Enter an address such as nfs: //192.168.0.16/data/share.

However, this will cause it to be unmounted when the system is rebooted. To mount it automatically, select the above mount point from "System Preferences", "Users and Groups", "Login Items", and "+".

Recommended Posts

Build an NFS server on Arch Linux
Build a Samba server on Arch Linux
Build an Arch Linux environment on Raspberry Pi
Build a simple WebDAV server on Linux
Build an LNPP environment on Amazon Linux 2
jblas on Arch Linux
Install Minecraft on Arch Linux
[CentOS 7.3] Build an FTP server on the ESXi host
Downgrade Mcomix on Arch Linux
[Part 2] Let's build a web server on EC2 Linux
Build Apache HTTP Server and Wildfly on Oracle Linux 8
Compactly build an Oracle database (19c) on Linux on VirtualBox
Preparing to use Ansible on an existing Linux server
Setting up OpenSSH on Arch Linux
Install Arch Linux on DeskMini A300
Run a Linux server on GCP
Rip Music CDs on Arch Linux
Build a Pypi cache server on QNAP
How to build my own Linux server
[UE4] Build DedicatedServer on Windows and Linux
I created an SFTP-only user on Linux.
Build CGI Server running on Python 3 on Docker
Install and Configure TigerVNC server on Linux
Basic usage of Btrfs on Arch Linux
Dockerfile: Install Docker on your Linux server
Build jupyter notebook on remote server (CentOS)
Arch on lvm on luks build and initialization
Build a web server on your Chromebook
Until you install Arch Linux on VMware
Linux server command
Cross-compile windows version from nim on arch | linux
Deliver OBS footage to Zoom on Arch Linux
Build Oracle Database 19c on Oracle Linux 8.3 (DB Build Part 2)
Set up an Objective-C 2.0 development environment on Linux
How to build Java environment on Ubuntu (Linux)
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server ―― 1. Apache introduction
Arch Linux Recommendation
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server --2 PHP introduction
Build a server on Linux and local network with Raspberry Pi NextCloud and desktop sharing
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux to build a Web server --3 MySQL 8.0 introduction
Build an OpenCV4 environment on Raspberry Pi using Poetry
How to use C216 Audio Controller on Arch Linux
[Linux] WSL2 Build an environment for laravel7 with Ubuntu 20.04
[Fast API + Firebase] Build an API server for Bearer authentication
Create an environment for MkDocs on Amazon Linux (attempted)
[Part 1] Let's set up a Minecraft server on Linux
Build an MS compatible L2TP/Ipsec VPN client on Fedora 33
I wrote an automatic installation script for Arch Linux
Install Docker on Arch Linux and run it remotely
Stray build of Python 3 on Sakura's rental server (Note)
How to build a Python environment on amazon linux 2
Daemonizing processes on Linux
Linux (WSL) on Windows
NAT router on Linux
Linux server load verification
Linux kernel build time
Develop .NET on Linux
Wake on lan on Linux
Build TensorFlow on Windows
Monitor traffic on Linux
Build XGBoost on Windows