Assalamu'alaykum warahmatullah wabarakatuh
Kali ini saya akan share cara install NFS. NFS digunakan untuk sharing folder yang cepat dan instan karena konfigurasi yang sedikit. NFS dapat work di Linux manapun, ataupun Windows termasuk windows server dan win 7,8,10 dll. Ya pokoknya serbaguna lah mirip fitur sharing folder di windows.
Konfigurasi
1. Install paket NFS nya.
yum install nfs-utils nfs-utils-lib -y
yum install nfs-utils nfs-utils-lib -y
2. Kita jalankan dan enable-kan semua paket nya,
systemctl start nfs-server
systemctl start rpcbind
systemctl start nfs-lock
systemctl start nfs-idmap
systemctl enable nfs-server
systemctl enable rpcbind
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start nfs-server
systemctl start rpcbind
systemctl start nfs-lock
systemctl start nfs-idmap
systemctl enable nfs-server
systemctl enable rpcbind
systemctl enable nfs-lock
systemctl enable nfs-idmap
3. Konfigurasi file nfs. Menuju baris ke-5, lalu ubah script menjadi berikut untuk menambahkan domain. Tidak apa-apa jika tidak punya, ini hanya sekedar memudahkan saja
nano /etc/idmapd.conf
nano /etc/idmapd.conf
#baris ke-5
Domain = idn-shc.com
4. Nah, kita edit file konfigurasi untuk menentukan direktori mana yang akan kita jadikan storage untuk di share.
mkdir /var/share
chmod 777 /var/share
mkdir /var/share
chmod 777 /var/share
5. Tambahkan script berikut dibawah konfigurasi utama.nano /etc/exports. Memasukkan script berikut [direktori] [ip network][opsi].
nano /etc/exports
nano /etc/exports
/var/nfs/buat_sharing 192.168.40.200/24(rw,no_root_squash)
Untuk pengertian dari opsi bisa dibaca disini.
Option | Description |
rw | Allow both read and write requests on a NFS volume. |
ro | Allow only read requests on a NFS volume. |
sync | Reply to requests only after the changes have been committed to stable storage. (Default) |
async | This option allows the NFS server to violate the NFS protocol and reply to requests before any changes made by that request have been committed to stable storage. |
secure | This option requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). (Default) |
insecure | This option accepts all ports. |
wdelay | Delay committing a write request to disc slightly if it suspects that another related write request may be in progress or may arrive soon. (Default) |
no_wdelay | This option has no effect if async is also set. The NFS server will normally delay committing a write request to disc slightly if it suspects that another related write request may be in progress or may arrive soon. This allows multiple write requests to be committed to disc with the one operation which can improve performance. If an NFS server received mainly small unrelated requests, this behaviour could actually reduce performance, so no_wdelay is available to turn it off. |
subtree_check | This option enables subtree checking. (Default) |
no_subtree_check | This option disables subtree checking, which has mild security implications, but can improve reliability in some circumstances. |
root_squash | Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does not apply to any other uids or gids that might be equally sensitive, such as user bin or group staff. |
no_root_squash | Turn off root squashing. This option is mainly useful for disk-less clients. |
all_squash | Map all uids and gids to the anonymous user. Useful for NFS exported public FTP directories, news spool directories, etc. |
no_all_squash | Turn off all squashing. (Default) |
anonuid=UID | These options explicitly set the uid and gid of the anonymous account. This option is primarily useful for PC/NFS clients, where you might want all requests appear to be from one user. As an example, consider the export entry for /home/joe in the example section below, which maps all requests to uid 150. |
anongid=GID | Read above (anonuid=UID) |
6. Lalu izinkan nfs berjalan pada startup dan jalankan aplikasinya.
systemctl start nfs-server
systemctl enable nfs-server
systemctl start nfs-server
systemctl enable nfs-server
7. Izinkan NFS berjalan pada firewall agar tidak diblokir.
firewall-cmd --permanent --add-service mountd
firewall-cmd --permanent --add-service rpc-bind
firewall-cmd --permanent --add-service nfs
firewall-cmd --reload
Tinggal verifikasi client aja nih
firewall-cmd --permanent --add-service mountd
firewall-cmd --permanent --add-service rpc-bind
firewall-cmd --permanent --add-service nfs
firewall-cmd --reload
... https://pastebin.com/SXEgfp5B
0 comments: