Linux總結筆記7-配置NFS服務實現Linux間文件共享

搭建NFS服務器

1.安裝nfs-utils

[root@linux1 ~]# yum -y install nfs-utils

2.創建共享目錄,修改目錄權限爲777

3.在配置文件/etc/exports 裏寫入需要共享的配置信息

[root@linux1 ~]# vim /etc/exports
/nfsshare       192.168.100.*(rw,sync,root_squash)

4.重啓 rpcbind 和 nfs 服務

[root@linux1 ~]# systemctl restart rpcbind
[root@linux1 ~]# systemctl restart nfs-server
(注意先後順序,否則客戶端報錯如下)
[root@Linux2 ~]# showmount -e 192.168.100.10
clnt_create: RPC: Program not registered

在Linux客戶端使用

1.用showmount命令查看遠程主機NFS共享列表

[root@linux2 ~]# showmount -e 192.168.10.10 
Export list for 192.168.10.10: 
/nfsfile 192.168.10.*

2.創建掛載點然後掛載使用

[root@linux2 ~]# mkdir /nfsshare
[root@linux2 ~]# mount -t nfs 192.168.100.10:/nfsshare /nfsshare

3.寫入/etc/fstab文件

[root@linux2 ~]# vim /etc/fstab
192.168.100.10:/nfsshare        /nfsshare       nfs     defaults    0 0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章