1、關閉防火牆(4步)
root@cq ~]# systemctl stop firewalld
[root@cq ~]# systemctl disable firewalld
[root@cq ~]# vim /etc/selinux/config
[root@cq ~]# setenforce 0
2、安裝nfs服務(nfs-utils rpcbind)
[root@cq ~]# yum -y install nfs-utils
[root@cq ~]# yum -y install rpcbind
已加載插件:product-id, search-disabled-repos, subscription-manager
This system is
3、啟動nfs服務 和 rpcbind
[root@cq ~]# systemctl start nfs-server
[root@cq ~]# systemctl start rpcbind
4、編輯配置檔案的共享目錄
5、重新開機nfs服務
[root@cq ~]# systemctl restart nfs-server rpcbind
6、建立共享目錄
[root@cq ~]# mkdir /chenqian
用戶端:
1、關閉防火牆(4步
[root@chenqian ~]# systemctl stop firewalld
[root@chenqian ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@chenqian ~]# vim /etc/selinux/
config final/ semanage.conf targeted/ tmp/
[root@chenqian ~]# vim /etc/selinux/config
2、搭建nfs服務
[root@chenqian ~]# yum -y install nfs-utils rpcbind
已加載插件:product-id, search-disabled-repos, subscription-manager
3、啟動nfs服務
[root@chenqian ~]# systemctl start nfs-server rpcbind
4、驗證nfs服務端的共享目錄
[root@chenqian ~]# showmount -e 172.16.195.128
Export list for 172.16.195.128:
/chenqian 172.16.195.129
5、建立挂載的目錄站點
[root@chenqian ~]# mkdir /nfs
6、挂載
[root@chenqian ~]# mount -t nfs 172.16.195.128:/chenqian /nfs
7、然後在服務端為共享目錄設定匿名使用者群組
[root@cq ~]# chown -R nfsnobody.nfsnobody /chenqian
8、在用戶端驗證挂載目錄站點是否可以建立檔案和删除檔案
[root@chenqian nfs]# touch 4 5
touch: 無法建立"4": 隻讀檔案系統
touch: 無法建立"5": 隻讀檔案系統
[root@chenqian nfs]# ls
1 2 3 4 5
作業
1.手動搭建一個nfs伺服器
開放/nfs/shared目錄,供所有使用者查閱資料
開放/nfs/upload目錄為172.16.12.0/24網段的資料上傳目錄,并将所有使用者及所屬的使用者組都映射為nfs-upload,其UID與GID均為300